11#define DIRCACHE_PRIVATE
46#define MAX_DIR_UL_SIZE ((1<<24)-1)
50#define FULL_DIR_CACHE_LIFETIME (60*60)
51#define RUNNINGROUTERS_CACHE_LIFETIME (20*60)
52#define DIRPORTFRONTPAGE_CACHE_LIFETIME (20*60)
53#define NETWORKSTATUS_CACHE_LIFETIME (5*60)
54#define ROUTERDESC_CACHE_LIFETIME (30*60)
55#define ROUTERDESC_BY_DIGEST_CACHE_LIFETIME (48*60*60)
56#define ROBOTS_CACHE_LIFETIME (24*60*60)
57#define MICRODESC_CACHE_LIFETIME (48*60*60)
59#define BANDWIDTH_CACHE_LIFETIME (30*60)
79 *url[0] ==
'/' ?
"" :
"/",
93 const char *reason_phrase)
96 char *datestring = NULL;
99 reason_phrase =
"unspecified";
104 char datebuf[RFC1123_TIME_LEN+1];
110 status, reason_phrase, datestring?datestring:
"");
112 log_debug(
LD_DIRSERV,
"Wrote status 'HTTP/1.0 %d %s'", status, reason_phrase);
113 connection_buf_add(buf, strlen(buf),
TO_CONN(conn));
128 const char *type,
const char *encoding,
129 const char *extra_headers,
132 char date[RFC1123_TIME_LEN+1];
156 if (cache_lifetime > 0) {
157 char expbuf[RFC1123_TIME_LEN+1];
162 }
else if (cache_lifetime == 0) {
181 const char *extra_headers,
long cache_lifetime)
224 unsigned result = (1u << NO_METHOD);
227 SPLIT_SKIP_SPACE|SPLIT_STRIP_SPACE|SPLIT_IGNORE_BLANK, 0);
231 if (method != UNKNOWN_METHOD) {
232 tor_assert(((
unsigned)method) < 8*
sizeof(
unsigned));
233 result |= (1u << method);
235 } SMARTLIST_FOREACH_END(m);
238 } SMARTLIST_FOREACH_END(m);
239 smartlist_free(methods);
259 const char *want_url)
266 smartlist_free(voters);
272 need_at_least = smartlist_len(want_authorities)/2+1;
281 } SMARTLIST_FOREACH_END(digest);
284 if (have >= need_at_least)
286 } SMARTLIST_FOREACH_END(want_digest);
289 smartlist_free(want_authorities);
291 smartlist_free(voters);
292 return (have >= need_at_least);
313 return LOW_COMPRESSION;
390 const char *req_body,
size_t req_body_len))
392 char *url, *url_mem, *header;
393 time_t if_modified_since = 0;
394 int zlib_compressed_in_url;
395 unsigned compression_methods_supported;
401 log_debug(
LD_DIRSERV,
"Received GET command.");
413 if_modified_since = 0;
426 size_t url_len = strlen(url);
428 zlib_compressed_in_url = url_len > 2 && !strcmp(url+url_len-2,
".z");
429 if (zlib_compressed_in_url) {
430 url[url_len-2] =
'\0';
438 compression_methods_supported = (1u << NO_METHOD);
440 if (zlib_compressed_in_url) {
441 compression_methods_supported |= (1u << ZLIB_METHOD);
459 match = !strcmp(url,
url_table[i].
string);
462 result =
url_table[i].handler(conn, &args);
486 dlen = strlen(frontpage);
493 NULL, DIRPORTFRONTPAGE_CACHE_LIFETIME);
494 connection_buf_add(frontpage, dlen,
TO_CONN(conn));
509 const char *flavor, time_t now,
bool is_too_new)
511#define NOT_REASONABLY_LIVE_WARNING_INTERVAL (60*60)
512 static ratelim_t warned[2] = { RATELIM_INIT(
513 NOT_REASONABLY_LIVE_WARNING_INTERVAL),
515 NOT_REASONABLY_LIVE_WARNING_INTERVAL) };
516 char timestamp[ISO_TIME_LEN+1];
518 time_t valid_time = 0;
533 log_warn(
LD_DIRSERV,
"Our %s%sconsensus is too %s, so we will not "
534 "serve it to clients. It was valid %s %s local time and we "
535 "continued to serve it for up to 24 hours %s.%s",
536 flavor ? flavor :
"",
538 is_too_new ?
"new" :
"old",
539 is_too_new ?
"after" :
"until",
541 is_too_new ?
"before it was valid" :
"after it expired",
562 "%s contained bogus digest %s; %s.",
563 location,
escaped(hex), action);
582 SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1);
587 smartlist_add(*digests_out, tor_memdup(digest,
sizeof(digest)));
589 } SMARTLIST_FOREACH_END(hex);
591 smartlist_free(hex_digests);
601#define FALLBACK_COMPRESS_METHOD ZLIB_METHOD
612 unsigned compression_methods,
621 if (0 == (compression_methods & (1u<<method)))
625 method) == CONSDIFF_AVAILABLE) {
626 tor_assert_nonfatal(result);
627 *compression_used_out = method;
631 } SMARTLIST_FOREACH_END(diff_from);
636 tor_assert_nonfatal(result);
640 } SMARTLIST_FOREACH_END(diff_from);
651 unsigned compression_methods,
660 if (0 == (compression_methods & (1u<<method)))
664 method) == CONSDIFF_AVAILABLE) {
665 tor_assert_nonfatal(result);
666 *compression_used_out = method;
673 tor_assert_nonfatal(result);
699 for (u = 0; u < length; ++u) {
701 if (compression_methods & (1u<<method))
727 } SMARTLIST_FOREACH_END(digest);
776 const char *url = args->
url;
780 const char CONSENSUS_URL_PREFIX[] =
"/tor/status-vote/current/consensus/";
781 const char CONSENSUS_FLAVORED_PREFIX[] =
782 "/tor/status-vote/current/consensus-";
785 const char *after_flavor = NULL;
787 if (!
strcmpstart(url, CONSENSUS_FLAVORED_PREFIX)) {
789 f = url + strlen(CONSENSUS_FLAVORED_PREFIX);
793 out->
flavor = tor_strndup(f, cp-f);
795 out->
flavor = tor_strdup(f);
803 after_flavor = url+strlen(CONSENSUS_URL_PREFIX);
809 const char DIFF_COMPONENT[] =
"diff/";
810 char *diff_hash_in_url = NULL;
811 if (after_flavor && !
strcmpstart(after_flavor, DIFF_COMPONENT)) {
812 after_flavor += strlen(DIFF_COMPONENT);
813 const char *cp = strchr(after_flavor,
'/');
815 diff_hash_in_url = tor_strndup(after_flavor, cp-after_flavor);
818 diff_hash_in_url = tor_strdup(after_flavor);
825 if (diff_hash_in_url) {
857 long lifetime = NETWORKSTATUS_CACHE_LIFETIME;
859 time_t now = time(NULL);
883 if (req.
diff_only && !cached_consensus) {
889 if (! cached_consensus) {
895 time_t valid_after, fresh_until, valid_until;
896 int have_valid_after = 0, have_fresh_until = 0, have_valid_until = 0;
897 if (cached_consensus) {
906 if (cached_consensus && have_valid_after &&
914 cached_consensus && have_valid_until &&
923 if (cached_consensus && req.
want_fps &&
926 "number of requested authorities");
935 if (cached_consensus) {
941 lifetime = (have_fresh_until && fresh_until > now) ? fresh_until - now : 0;
943 size_t size_guess = 0;
946 compress_method != NO_METHOD,
950 if (!smartlist_len(conn->
spool) && !n_expired) {
954 }
else if (!smartlist_len(conn->
spool)) {
962 "Client asked for network status lists, but we've been "
963 "writing too many bytes lately. Sending 503 Dir busy.");
986 const char vary_header[] =
"Vary: X-Or-Diff-From-Consensus\r\n";
994 compress_method == NO_METHOD ?
995 NO_METHOD : compression_used,
997 smartlist_len(conn->
spool) == 1 ? lifetime : 0);
999 if (compress_method == NO_METHOD && smartlist_len(conn->
spool))
1004 const int initial_flush_result = connection_dirserv_flushed_some(conn);
1005 tor_assert_nonfatal(initial_flush_result == 0);
1011 dir_conn_clear_spool(conn);
1021 const char *url = args->
url;
1023 ssize_t body_len = 0;
1024 ssize_t estimated_len = 0;
1031 dirvote_dirreq_get_status_vote(url, items, dir_items);
1032 if (!smartlist_len(dir_items) && !smartlist_len(items)) {
1038 tor_assert_nonfatal(smartlist_len(items) == 0 ||
1039 smartlist_len(dir_items) == 0);
1043 if (smartlist_len(items)) {
1051 mask = (1u<<NO_METHOD) | (1u<<ZLIB_METHOD);
1057 body_len += compress_method != NO_METHOD ?
1058 d->dir_compressed_len : d->dir_len);
1059 estimated_len += body_len;
1061 size_t ln = strlen(item);
1062 if (compress_method != NO_METHOD) {
1063 estimated_len += ln/2;
1065 body_len += ln; estimated_len += ln;
1077 if (smartlist_len(items)) {
1078 if (compress_method != NO_METHOD) {
1085 c_sl_idx == c_sl_len - 1));
1088 connection_buf_add(compress_method != NO_METHOD ?
1089 d->dir_compressed : d->dir,
1090 compress_method != NO_METHOD ?
1091 d->dir_compressed_len : d->dir_len,
1095 smartlist_free(items);
1096 smartlist_free(dir_items);
1108 const char *url = args->
url;
1111 int clear_spool = 1;
1116 DIR_SPOOL_MICRODESC,
1118 DSR_DIGEST256|DSR_BASE64|DSR_SORT_UNIQ);
1120 size_t size_guess = 0;
1122 compress_method != NO_METHOD,
1124 if (smartlist_len(conn->
spool) == 0) {
1130 "Client asked for server descriptors, but we've been "
1131 "writing too many bytes lately. Sending 503 Dir busy.");
1139 MICRODESC_CACHE_LIFETIME);
1141 if (compress_method != NO_METHOD)
1145 const int initial_flush_result = connection_dirserv_flushed_some(conn);
1146 tor_assert_nonfatal(initial_flush_result == 0);
1152 dir_conn_clear_spool(conn);
1162 const char *url = args->
url;
1166 int clear_spool = 1;
1171 const char *msg = NULL;
1172 int cache_lifetime = 0;
1174 url += is_extra ? strlen(
"/tor/extra/") : strlen(
"/tor/server/");
1176 time_t publish_cutoff = 0;
1179 is_extra ? DIR_SPOOL_EXTRA_BY_DIGEST : DIR_SPOOL_SERVER_BY_DIGEST;
1182 is_extra ? DIR_SPOOL_EXTRA_BY_FP : DIR_SPOOL_SERVER_BY_FP;
1196 }
else if (smartlist_len(conn->
spool) == 1) {
1197 cache_lifetime = ROUTERDESC_BY_DIGEST_CACHE_LIFETIME;
1200 size_t size_guess = 0;
1203 compress_method != NO_METHOD,
1204 &size_guess, &n_expired);
1210 source == DIR_SPOOL_SERVER_BY_FP) {
1218 } SMARTLIST_FOREACH_END(spooled);
1221 if (res < 0 || size_guess == 0 || smartlist_len(conn->
spool) == 0) {
1228 "Client asked for server descriptors, but we've been "
1229 "writing too many bytes lately. Sending 503 Dir busy.");
1231 "Directory busy, try again later");
1232 dir_conn_clear_spool(conn);
1236 if (compress_method != NO_METHOD)
1241 int initial_flush_result = connection_dirserv_flushed_some(conn);
1242 tor_assert_nonfatal(initial_flush_result == 0);
1248 dir_conn_clear_spool(conn);
1257 const char *url = args->
url;
1264 if (!strcmp(url,
"/tor/keys/all")) {
1266 }
else if (!strcmp(url,
"/tor/keys/authority")) {
1274 DSR_HEX|DSR_SORT_UNIQ);
1280 smartlist_free(fps);
1285 DSR_HEX|DSR_SORT_UNIQ);
1291 smartlist_free(fps);
1292 }
else if (!
strcmpstart(url,
"/tor/keys/fp-sk/")) {
1302 smartlist_free(fp_sks);
1307 if (!smartlist_len(certs)) {
1312 if (c->cache_info.published_on < if_modified_since)
1314 if (!smartlist_len(certs)) {
1323 compress_method != NO_METHOD ? len/2 : len)) {
1329 compress_method != NO_METHOD ? -1 : len,
1332 if (compress_method != NO_METHOD) {
1339 c->cache_info.signed_descriptor_len,
1340 conn, c_sl_idx == c_sl_len - 1));
1342 smartlist_free(certs);
1356 const char *desc_str = NULL;
1357 const char *pubkey_str = NULL;
1358 const char *url = args->
url;
1364 "Rejecting single hop HS v3 descriptor request");
1372 pubkey_str = url + strlen(
"/tor/hs/3/");
1374 pubkey_str, &desc_str);
1375 if (retval <= 0 || desc_str == NULL) {
1382 connection_buf_add(desc_str, strlen(desc_str),
TO_CONN(conn));
1394 const char *headers = args->
headers;
1419 size_t dlen = strlen(status);
1421 connection_buf_add(status, dlen,
TO_CONN(conn));
1434 log_debug(
LD_DIR,
"Getting next bandwidth.");
1442 if (bandwidth != NULL) {
1443 ssize_t len = strlen(bandwidth);
1445 compress_method, BANDWIDTH_CACHE_LIFETIME);
1446 if (compress_method != NO_METHOD) {
1449 log_debug(
LD_DIR,
"Compressing bandwidth file.");
1451 log_debug(
LD_DIR,
"Not compressing bandwidth file.");
1468 const char robots[] =
"User-agent: *\r\nDisallow: /\r\n";
1469 size_t len = strlen(robots);
1471 connection_buf_add(robots, len,
TO_CONN(conn));
1486parse_hs_version_from_post(
const char *url,
const char *prefix,
1487 const char **end_pos)
1490 unsigned long version;
1503 start = url + strlen(prefix);
1512 return (
int) version;
1522handle_post_hs_descriptor(
const char *url,
const char *
body)
1525 const char *end_pos;
1530 version = parse_hs_version_from_post(url,
"/tor/hs/", &end_pos);
1546 log_info(
LD_REND,
"Publish request for HS descriptor handled "
1567 const char *
body,
size_t body_len))
1574 log_debug(
LD_DIRSERV,
"Received POST command.");
1579 log_info(
LD_DIR,
"Rejected dir post request from %s "
1580 "since we're not a public relay.",
1598 "Rejecting single hop HS descriptor post");
1601 const char *msg =
"HS descriptor stored successfully.";
1604 int code = handle_post_hs_descriptor(url,
body);
1606 msg =
"Invalid HS descriptor. Rejected.";
1616 "accept posted server descriptors");
1621 !strcmp(url,
"/tor/")) {
1622 const char *msg =
"[None]";
1629 "New descriptor post, because: %s",
1630 genreason ? genreason :
"not specified");
1635 purpose, conn->base_.
address, &msg);
1638 if (r == ROUTER_ADDED_SUCCESSFULLY) {
1642 "X-Descriptor-Not-New: Yes\r\n", -1);
1645 "Rejected router descriptor or extra-info from %s "
1654 if (authdir_mode_v3(options) &&
1655 !strcmp(url,
"/tor/post/vote")) {
1656 const char *msg =
"OK";
1663 log_warn(
LD_DIRSERV,
"Rejected vote from %s (\"%s\").",
1671 if (authdir_mode_v3(options) &&
1672 !strcmp(url,
"/tor/post/consensus-signature")) {
1673 const char *msg = NULL;
1677 log_warn(
LD_DIR,
"Unable to store signatures posted by %s: %s",
1681 msg?msg:
"Unable to store signatures");
1708 tor_addr_is_internal(&toraddr,0)) {
1709 log_debug(
LD_DIR,
"Ignoring local/internal IP %s",
escaped(fwd));
1715 conn->
address = tor_strdup(fwd);
1728 char *headers=NULL, *
body=NULL;
1740 "Request too large from %s to DirPort. Closing.",
1744 log_debug(
LD_DIRSERV,
"command not all here yet.");
1754 if (!strncasecmp(headers,
"GET",3))
1756 else if (!strncasecmp(headers,
"POST",4))
1760 "Got headers %s with unknown command. Closing.",
int tor_addr_parse(tor_addr_t *addr, const char *src)
void authority_cert_get_all(smartlist_t *certs_out)
authority_cert_t * authority_cert_get_newest_by_id(const char *id_digest)
authority_cert_t * authority_cert_get_by_sk_digest(const char *sk_digest)
authority_cert_t * authority_cert_get_by_digests(const char *id_digest, const char *sk_digest)
Header file for authcert.c.
int authdir_mode(const or_options_t *options)
int authdir_mode_bridge(const or_options_t *options)
Header file for directory authority mode.
Authority certificate structure.
int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
void buf_add_printf(buf_t *buf, const char *format,...)
buf_t * buf_new_with_capacity(size_t size)
void buf_add_string(buf_t *buf, const char *string)
Cached large directory object structure.
compress_method_t compression_method_get_by_name(const char *name)
unsigned tor_compress_get_supported_method_bitmask(void)
tor_compress_state_t * tor_compress_new(int compress, compress_method_t method, compression_level_t compression_level)
const char * compression_method_get_name(compress_method_t method)
const or_options_t * get_options(void)
tor_cmdline_mode_t command
Header file for config.c.
int connection_fetch_from_buf_http(connection_t *conn, char **headers_out, size_t max_headerlen, char **body_out, size_t *body_used, size_t max_bodylen, int force_complete)
bool connection_dir_is_global_write_low(const connection_t *conn, size_t attempt)
void connection_buf_add_buf(connection_t *conn, buf_t *buf)
const char * connection_describe_peer(const connection_t *conn)
void connection_dir_buf_add(const char *string, size_t len, dir_connection_t *dir_conn, int done)
Header file for connection.c.
int consensus_cache_entry_get_valid_until(const consensus_cache_entry_t *ent, time_t *out)
int consensus_cache_entry_get_fresh_until(const consensus_cache_entry_t *ent, time_t *out)
consdiff_status_t consdiffmgr_find_diff_from(consensus_cache_entry_t **entry_out, consensus_flavor_t flavor, int digest_type, const uint8_t *digest, size_t digestlen, compress_method_t method)
int consensus_cache_entry_get_voter_id_digests(const consensus_cache_entry_t *ent, smartlist_t *out)
consdiff_status_t consdiffmgr_find_consensus(struct consensus_cache_entry_t **entry_out, consensus_flavor_t flavor, compress_method_t method)
int consensus_cache_entry_get_valid_after(const consensus_cache_entry_t *ent, time_t *out)
Header for consdiffmgr.c.
int crypto_digest256(char *digest, const char *m, size_t len, digest_algorithm_t algorithm)
int tor_memeq(const void *a, const void *b, size_t sz)
#define tor_memneq(a, b, sz)
Client/server directory connection structure.
static int handle_get_descriptor(dir_connection_t *conn, const get_handler_args_t *args)
STATIC int directory_handle_command_post(dir_connection_t *conn, const char *headers, const char *body, size_t body_len)
static compress_method_t srv_meth_pref_precompressed[]
static int handle_get_networkstatus_bridges(dir_connection_t *conn, const get_handler_args_t *args)
int directory_handle_command(dir_connection_t *conn)
static struct consensus_cache_entry_t * find_best_diff(const smartlist_t *digests, int flav, unsigned compression_methods, compress_method_t *compression_used_out)
static int digest_list_contains_best_consensus(consensus_flavor_t flavor, const smartlist_t *digests)
static void write_http_response_header(dir_connection_t *conn, ssize_t length, compress_method_t method, long cache_lifetime)
STATIC int parse_http_url(const char *headers, char **url)
static compress_method_t srv_meth_pref_streaming_compression[]
static int parse_one_diff_hash(uint8_t *digest, const char *hex, const char *location, const char *action)
static int handle_get_keys(dir_connection_t *conn, const get_handler_args_t *args)
STATIC int handle_get_hs_descriptor_v3(dir_connection_t *conn, const get_handler_args_t *args)
static int handle_get_current_consensus(dir_connection_t *conn, const get_handler_args_t *args)
static int handle_get_next_bandwidth(dir_connection_t *conn, const get_handler_args_t *args)
static const url_table_ent_t url_table[]
#define FALLBACK_COMPRESS_METHOD
static int parse_or_diff_from_header(smartlist_t **digests_out, const char *headers)
static int handle_get_microdesc(dir_connection_t *conn, const get_handler_args_t *args)
static int handle_get_robots(dir_connection_t *conn, const get_handler_args_t *args)
static int handle_get_frontpage(dir_connection_t *conn, const get_handler_args_t *args)
static void parsed_consensus_request_clear(parsed_consensus_request_t *req)
static int client_likes_consensus(const struct consensus_cache_entry_t *ent, const char *want_url)
STATIC unsigned parse_accept_encoding_header(const char *h)
static void http_set_address_origin(const char *headers, connection_t *conn)
static int parse_consensus_request(parsed_consensus_request_t *out, const get_handler_args_t *args)
static struct consensus_cache_entry_t * find_best_consensus(int flav, unsigned compression_methods, compress_method_t *compression_used_out)
static void write_http_response_headers(dir_connection_t *conn, ssize_t length, compress_method_t method, const char *extra_headers, long cache_lifetime)
static void warn_consensus_is_not_reasonably_live(const struct consensus_cache_entry_t *consensus, const char *flavor, time_t now, bool is_too_new)
STATIC int directory_handle_command_get(dir_connection_t *conn, const char *headers, const char *req_body, size_t req_body_len)
static void write_short_http_response(dir_connection_t *conn, int status, const char *reason_phrase)
static int handle_get_status_vote(dir_connection_t *conn, const get_handler_args_t *args)
#define FULL_DIR_CACHE_LIFETIME
STATIC compression_level_t choose_compression_level(void)
static void write_http_response_header_impl(dir_connection_t *conn, ssize_t length, const char *type, const char *encoding, const char *extra_headers, long cache_lifetime)
static compress_method_t find_best_compression_method(unsigned compression_methods, int stream)
Header file for dircache.c.
int dir_split_resource_into_fingerprint_pairs(const char *res, smartlist_t *pairs_out)
int connection_dir_is_encrypted(const dir_connection_t *conn)
int dir_split_resource_into_fingerprints(const char *resource, smartlist_t *fp_out, int *compressed_out, int flags)
bool connection_dir_is_anonymous(const dir_connection_t *dir_conn)
char * http_get_header(const char *headers, const char *which)
int parse_http_command(const char *headers, char **command_out, char **url_out)
Header file for directory.c.
#define DIR_CONN_STATE_SERVER_WRITING
void dirserv_spool_remove_missing_and_guess_size(dir_connection_t *conn, time_t cutoff, int compression, size_t *size_out, int *n_expired_out)
int dirserv_get_routerdesc_spool(smartlist_t *spool_out, const char *key, dir_spool_source_t source, int conn_is_encrypted, const char **msg_out)
spooled_resource_t * spooled_resource_new_from_cache_entry(consensus_cache_entry_t *entry)
int dir_split_resource_into_spoolable(const char *resource, dir_spool_source_t source, smartlist_t *spool_out, int *compressed_out, int flags)
Header file for dirserv.c.
pending_vote_t * dirvote_add_vote(const char *vote_body, time_t time_posted, const char *where_from, const char **msg_out, int *status_out)
int dirvote_add_signatures(const char *detached_signatures_body, const char *source, const char **msg)
Header file for dirvote.c.
const char * escaped(const char *s)
#define RFTS_IGNORE_MISSING
Header file for fp_pair.c.
Header file for geoip_stats.c.
void geoip_note_ns_response(geoip_ns_response_t response)
@ GEOIP_CLIENT_NETWORKSTATUS
void geoip_start_dirreq(uint64_t dirreq_id, size_t response_size, dirreq_type_t type)
void geoip_note_client_seen(geoip_client_action_t action, const tor_addr_t *addr, const char *transport_name, time_t now)
@ GEOIP_REJECT_NOT_MODIFIED
@ GEOIP_REJECT_NOT_ENOUGH_SIGS
int hs_cache_lookup_as_dir(uint32_t version, const char *query, const char **desc_out)
int hs_cache_store_as_dir(const char *desc)
Header file for hs_cache.c.
#define log_fn(severity, domain, args,...)
networkstatus_t * networkstatus_get_latest_consensus_by_flavor(consensus_flavor_t f)
int networkstatus_valid_after_is_reasonably_live(time_t valid_after, time_t now)
int networkstatus_parse_flavor_name(const char *flavname)
int networkstatus_valid_until_is_reasonably_live(time_t valid_until, time_t now)
char * networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
Header file for networkstatus.c.
Networkstatus consensus/vote structure.
Master header file for Tor-specific functionality.
#define ROUTER_MAX_AGE_TO_PUBLISH
long tor_parse_long(const char *s, int base, long min, long max, int *ok, char **next)
int tor_asprintf(char **strp, const char *fmt,...)
was_router_added_t dirserv_add_multiple_descriptors(const char *desc, size_t desclen, uint8_t purpose, const char *source, const char **msg)
Header file for process_descs.c.
char * rate_limit_log(ratelim_t *lim, time_t now)
const char * relay_get_dirportfrontpage(void)
Header for feature/relay/relay_config.c.
void rep_hist_note_desc_served(const char *desc)
Header file for rephist.c.
bool is_local_to_resolve_addr(const tor_addr_t *addr)
: Return true iff the given addr is judged to be local to our resolved address.
Header file for resolve_addr.c.
authority_cert_t * get_my_v3_authority_cert(void)
Router descriptor structure.
#define ROUTER_PURPOSE_GENERAL
#define ROUTER_PURPOSE_BRIDGE
const routerinfo_t * router_get_by_id_digest(const char *digest)
Header file for routerlist.c.
static int WRA_WAS_OUTDATED(was_router_added_t s)
int public_server_mode(const or_options_t *options)
int server_mode(const or_options_t *options)
Header file for routermode.c.
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
#define SMARTLIST_DEL_CURRENT(sl, var)
int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, int flags, int max)
signed_descriptor_t cache_info
struct tor_compress_state_t * compress_state
unsigned compression_supported
uint8_t digest_sha3_as_signed[DIGEST256_LEN]
char * BridgePassword_AuthDigest_
int BridgeAuthoritativeDir
smartlist_t * diff_from_digests
char identity_digest[DIGEST_LEN]
size_t signed_descriptor_len
#define MOCK_IMPL(rv, funcname, arglist)
void format_rfc1123_time(char *buf, time_t t)
int parse_http_time(const char *date, struct tm *tm)
void format_local_iso_time(char *buf, time_t t)
int tor_timegm(const struct tm *tm, time_t *time_out)
#define IF_BUG_ONCE(cond)
int strcasecmpstart(const char *s1, const char *s2)
int strcmpstart(const char *s1, const char *s2)