tor  0.4.1.0-alpha-dev
Functions
ns_parse.h File Reference

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 1060 of file ns_parse.c.

References DIGEST256_LEN.

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 592 of file ns_parse.c.

References networkstatus_get_bw_weight(), networkstatus_get_weight_scale_param(), T, and tor_assert().

◆ 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 187 of file ns_parse.c.

References router_get_hashes_impl().

◆ 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 169 of file ns_parse.c.

References crypto_digest256(), router_get_networkstatus_v3_signed_boundaries(), and tor_assert().

◆ 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 153 of file ns_parse.c.

References LOG_INFO, and router_get_hash_impl_helper().

Referenced by router_get_networkstatus_v3_sha3_as_signed().