1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2013, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for routerparse.c.
12 #ifndef TOR_ROUTERPARSE_H
13 #define TOR_ROUTERPARSE_H
15 int router_get_router_hash(const char *s
, size_t s_len
, char *digest
);
16 int router_get_dir_hash(const char *s
, char *digest
);
17 int router_get_networkstatus_v3_hashes(const char *s
, digests_t
*digests
);
18 int router_get_extrainfo_hash(const char *s
, size_t s_len
, char *digest
);
19 #define DIROBJ_MAX_SIG_LEN 256
20 char *router_get_dirobj_signature(const char *digest
,
22 crypto_pk_t
*private_key
);
23 int router_append_dirobj_signature(char *buf
, size_t buf_len
,
26 crypto_pk_t
*private_key
);
27 int router_parse_list_from_string(const char **s
, const char *eos
,
29 saved_location_t saved_location
,
31 int allow_annotations
,
32 const char *prepend_annotations
);
34 routerinfo_t
*router_parse_entry_from_string(const char *s
, const char *end
,
36 int allow_annotations
,
37 const char *prepend_annotations
);
38 extrainfo_t
*extrainfo_parse_entry_from_string(const char *s
, const char *end
,
39 int cache_copy
, struct digest_ri_map_t
*routermap
);
40 addr_policy_t
*router_parse_addr_policy_item_from_string(const char *s
,
42 version_status_t
tor_version_is_obsolete(const char *myversion
,
43 const char *versionlist
);
44 int tor_version_supports_microdescriptors(const char *platform
);
45 int tor_version_as_new_as(const char *platform
, const char *cutoff
);
46 int tor_version_parse(const char *s
, tor_version_t
*out
);
47 int tor_version_compare(tor_version_t
*a
, tor_version_t
*b
);
48 int tor_version_same_series(tor_version_t
*a
, tor_version_t
*b
);
49 void sort_version_list(smartlist_t
*lst
, int remove_duplicates
);
50 void assert_addr_policy_ok(smartlist_t
*t
);
51 void dump_distinct_digest_count(int severity
);
53 int compare_vote_routerstatus_entries(const void **_a
, const void **_b
);
54 int networkstatus_verify_bw_weights(networkstatus_t
*ns
, int);
55 networkstatus_t
*networkstatus_parse_vote_from_string(const char *s
,
57 networkstatus_type_t ns_type
);
58 ns_detached_signatures_t
*networkstatus_parse_detached_signatures(
59 const char *s
, const char *eos
);
61 smartlist_t
*microdescs_parse_from_string(const char *s
, const char *eos
,
62 int allow_annotations
,
63 saved_location_t where
);
65 authority_cert_t
*authority_cert_parse_from_string(const char *s
,
66 const char **end_of_string
);
67 int rend_parse_v2_service_descriptor(rend_service_descriptor_t
**parsed_out
,
69 char **intro_points_encrypted_out
,
70 size_t *intro_points_encrypted_size_out
,
71 size_t *encoded_size_out
,
72 const char **next_out
, const char *desc
);
73 int rend_decrypt_introduction_points(char **ipos_decrypted
,
74 size_t *ipos_decrypted_size
,
75 const char *descriptor_cookie
,
76 const char *ipos_encrypted
,
77 size_t ipos_encrypted_size
);
78 int rend_parse_introduction_points(rend_service_descriptor_t
*parsed
,
79 const char *intro_points_encoded
,
80 size_t intro_points_encoded_size
);
81 int rend_parse_client_keys(strmap_t
*parsed_clients
, const char *str
);