Tor  0.4.7.0-alpha-dev
Functions
ns_parse.h File Reference

Header file for ns_parse.c. More...

Go to the source code of this file.

Functions

int router_get_networkstatus_v3_hashes (const char *s, size_t len, common_digests_t *digests)
 
int router_get_networkstatus_v3_signed_boundaries (const char *s, size_t len, const char **start_out, const char **end_out)
 
int router_get_networkstatus_v3_sha3_as_signed (uint8_t *digest_out, const char *s, size_t len)
 
int compare_vote_routerstatus_entries (const void **_a, const void **_b)
 
int networkstatus_verify_bw_weights (networkstatus_t *ns, int)
 
networkstatus_tnetworkstatus_parse_vote_from_string (const char *s, size_t len, const char **eos_out, enum networkstatus_type_t ns_type)
 

Detailed Description

Header file for ns_parse.c.

Definition in file ns_parse.h.

Function Documentation

◆ networkstatus_parse_vote_from_string()

networkstatus_t* networkstatus_parse_vote_from_string ( const char *  s,
size_t  s_len,
const char **  eos_out,
networkstatus_type_t  ns_type 
)

Parse a v3 networkstatus vote, opinion, or consensus (depending on ns_type), from s, and return the result. Return NULL on failure.

Definition at line 1089 of file ns_parse.c.

Referenced by dirvote_add_vote().

◆ networkstatus_verify_bw_weights()

int networkstatus_verify_bw_weights ( networkstatus_t ns,
int  consensus_method 
)

Verify the bandwidth weights of a network status document

Definition at line 608 of file ns_parse.c.

◆ router_get_networkstatus_v3_hashes()

int router_get_networkstatus_v3_hashes ( const char *  s,
size_t  len,
common_digests_t digests 
)

Set digests to all the digests of the consensus document in s

Definition at line 197 of file ns_parse.c.

◆ router_get_networkstatus_v3_sha3_as_signed()

int router_get_networkstatus_v3_sha3_as_signed ( uint8_t *  digest_out,
const char *  s,
size_t  len 
)

Set digest_out to the SHA3-256 digest of the signed portion of the networkstatus vote in s – or of the entirety of s if no signed portion can be identified. Return 0 on success, -1 on failure.

Definition at line 179 of file ns_parse.c.

Referenced by consensus_compute_digest_as_signed().

◆ router_get_networkstatus_v3_signed_boundaries()

int router_get_networkstatus_v3_signed_boundaries ( const char *  s,
size_t  len,
const char **  start_out,
const char **  end_out 
)

Try to find the start and end of the signed portion of a networkstatus document in s. On success, set start_out to the first character of the document, and end_out to a position one after the final character of the signed document, and return 0. On failure, return -1.

Definition at line 163 of file ns_parse.c.

Referenced by router_get_networkstatus_v3_sha3_as_signed().