diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-07 13:45:32 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:39:54 -0400 |
commit | 6a36e5ff3b7233e430ce8b1ec567d3235ff04999 (patch) | |
tree | 21a5916d7f87809f33d15577646bf3edd4eaeebc /src/or/consdiff.h | |
parent | eff9fbd17d5fb4b1c196c241da4513d51893f52e (diff) | |
download | tor-6a36e5ff3b7233e430ce8b1ec567d3235ff04999.tar.gz tor-6a36e5ff3b7233e430ce8b1ec567d3235ff04999.zip |
String-based API for consensus diffs.
Also, add very strict split/join functions, and totally forbid
nonempty files that end with somethig besides a newline. This
change is necessary to ensure that diff/apply are actually reliable
inverse operations.
Diffstat (limited to 'src/or/consdiff.h')
-rw-r--r-- | src/or/consdiff.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/or/consdiff.h b/src/or/consdiff.h index 42cd3afa83..eef3653f69 100644 --- a/src/or/consdiff.h +++ b/src/or/consdiff.h @@ -7,21 +7,27 @@ #include "or.h" +char *consensus_diff_generate(const char *cons1, + const char *cons2); +char *consensus_diff_apply(const char *consensus, + const char *diff); + +#ifdef CONSDIFF_PRIVATE typedef struct consensus_digest_t { uint8_t sha3_256[DIGEST256_LEN]; } consensus_digest_t; -smartlist_t *consdiff_gen_diff(const smartlist_t *cons1, - const smartlist_t *cons2, - const consensus_digest_t *digests1, - const consensus_digest_t *digests2); -char *consdiff_apply_diff(const smartlist_t *cons1, const smartlist_t *diff, - const consensus_digest_t *digests1); -int consdiff_get_digests(const smartlist_t *diff, - char *digest1_out, - char *digest2_out); +STATIC smartlist_t *consdiff_gen_diff(const smartlist_t *cons1, + const smartlist_t *cons2, + const consensus_digest_t *digests1, + const consensus_digest_t *digests2); +STATIC char *consdiff_apply_diff(const smartlist_t *cons1, + const smartlist_t *diff, + const consensus_digest_t *digests1); +STATIC int consdiff_get_digests(const smartlist_t *diff, + char *digest1_out, + char *digest2_out); -#ifdef CONSDIFF_PRIVATE /** Data structure to define a slice of a smarltist. */ typedef struct smartlist_slice_t { /** |