11#define DIRCACHE_PRIVATE
48#define MAX_DIR_UL_SIZE ((1<<24)-1)
52#define FULL_DIR_CACHE_LIFETIME (60*60)
53#define RUNNINGROUTERS_CACHE_LIFETIME (20*60)
54#define DIRPORTFRONTPAGE_CACHE_LIFETIME (20*60)
55#define NETWORKSTATUS_CACHE_LIFETIME (5*60)
56#define ROUTERDESC_CACHE_LIFETIME (30*60)
57#define ROUTERDESC_BY_DIGEST_CACHE_LIFETIME (48*60*60)
58#define ROBOTS_CACHE_LIFETIME (24*60*60)
59#define MICRODESC_CACHE_LIFETIME (48*60*60)
61#define BANDWIDTH_CACHE_LIFETIME (30*60)
81 *url[0] ==
'/' ?
"" :
"/",
95 const char *reason_phrase)
98 char *datestring = NULL;
101 reason_phrase =
"unspecified";
106 char datebuf[RFC1123_TIME_LEN+1];
112 status, reason_phrase, datestring?datestring:
"");
114 log_debug(
LD_DIRSERV,
"Wrote status 'HTTP/1.0 %d %s'", status, reason_phrase);
115 connection_buf_add(buf, strlen(buf),
TO_CONN(conn));
130 const char *type,
const char *encoding,
131 const char *extra_headers,
134 char date[RFC1123_TIME_LEN+1];
158 if (cache_lifetime > 0) {
159 char expbuf[RFC1123_TIME_LEN+1];
164 }
else if (cache_lifetime == 0) {
183 const char *extra_headers,
long cache_lifetime)
226 unsigned result = (1u << NO_METHOD);
229 SPLIT_SKIP_SPACE|SPLIT_STRIP_SPACE|SPLIT_IGNORE_BLANK, 0);
233 if (method != UNKNOWN_METHOD) {
234 tor_assert(((
unsigned)method) < 8*
sizeof(
unsigned));
235 result |= (1u << method);
237 } SMARTLIST_FOREACH_END(m);
240 } SMARTLIST_FOREACH_END(m);
241 smartlist_free(methods);
261 const char *want_url)
268 smartlist_free(voters);
274 need_at_least = smartlist_len(want_authorities)/2+1;
283 } SMARTLIST_FOREACH_END(digest);
286 if (have >= need_at_least)
288 } SMARTLIST_FOREACH_END(want_digest);
291 smartlist_free(want_authorities);
293 smartlist_free(voters);
294 return (have >= need_at_least);
315 return LOW_COMPRESSION;
392 const char *req_body,
size_t req_body_len))
394 char *url, *url_mem, *header;
395 time_t if_modified_since = 0;
396 int zlib_compressed_in_url;
397 unsigned compression_methods_supported;
403 log_debug(
LD_DIRSERV,
"Received GET command.");
415 if_modified_since = 0;
428 size_t url_len = strlen(url);
430 zlib_compressed_in_url = url_len > 2 && !strcmp(url+url_len-2,
".z");
431 if (zlib_compressed_in_url) {
432 url[url_len-2] =
'\0';
440 compression_methods_supported = (1u << NO_METHOD);
442 if (zlib_compressed_in_url) {
443 compression_methods_supported |= (1u << ZLIB_METHOD);
461 match = !strcmp(url,
url_table[i].
string);
464 result =
url_table[i].handler(conn, &args);
488 dlen = strlen(frontpage);
495 NULL, DIRPORTFRONTPAGE_CACHE_LIFETIME);
496 connection_buf_add(frontpage, dlen,
TO_CONN(conn));
511 const char *flavor, time_t now,
bool is_too_new)
513#define NOT_REASONABLY_LIVE_WARNING_INTERVAL (60*60)
514 static ratelim_t warned[2] = { RATELIM_INIT(
515 NOT_REASONABLY_LIVE_WARNING_INTERVAL),
517 NOT_REASONABLY_LIVE_WARNING_INTERVAL) };
518 char timestamp[ISO_TIME_LEN+1];
520 time_t valid_time = 0;
535 log_warn(
LD_DIRSERV,
"Our %s%sconsensus is too %s, so we will not "
536 "serve it to clients. It was valid %s %s local time and we "
537 "continued to serve it for up to 24 hours %s.%s",
538 flavor ? flavor :
"",
540 is_too_new ?
"new" :
"old",
541 is_too_new ?
"after" :
"until",
543 is_too_new ?
"before it was valid" :
"after it expired",
564 "%s contained bogus digest %s; %s.",
565 location,
escaped(hex), action);
584 SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1);
589 smartlist_add(*digests_out, tor_memdup(digest,
sizeof(digest)));
591 } SMARTLIST_FOREACH_END(hex);
593 smartlist_free(hex_digests);
603#define FALLBACK_COMPRESS_METHOD ZLIB_METHOD
614 unsigned compression_methods,
623 if (0 == (compression_methods & (1u<<method)))
627 method) == CONSDIFF_AVAILABLE) {
628 tor_assert_nonfatal(result);
629 *compression_used_out = method;
633 } SMARTLIST_FOREACH_END(diff_from);
638 tor_assert_nonfatal(result);
642 } SMARTLIST_FOREACH_END(diff_from);
653 unsigned compression_methods,
662 if (0 == (compression_methods & (1u<<method)))
666 method) == CONSDIFF_AVAILABLE) {
667 tor_assert_nonfatal(result);
668 *compression_used_out = method;
675 tor_assert_nonfatal(result);
701 for (u = 0; u < length; ++u) {
703 if (compression_methods & (1u<<method))
729 } SMARTLIST_FOREACH_END(digest);
778 const char *url = args->
url;
782 const char CONSENSUS_URL_PREFIX[] =
"/tor/status-vote/current/consensus/";
783 const char CONSENSUS_FLAVORED_PREFIX[] =
784 "/tor/status-vote/current/consensus-";
787 const char *after_flavor = NULL;
789 if (!
strcmpstart(url, CONSENSUS_FLAVORED_PREFIX)) {
791 f = url + strlen(CONSENSUS_FLAVORED_PREFIX);
795 out->
flavor = tor_strndup(f, cp-f);
797 out->
flavor = tor_strdup(f);
805 after_flavor = url+strlen(CONSENSUS_URL_PREFIX);
811 const char DIFF_COMPONENT[] =
"diff/";
812 char *diff_hash_in_url = NULL;
813 if (after_flavor && !
strcmpstart(after_flavor, DIFF_COMPONENT)) {
814 after_flavor += strlen(DIFF_COMPONENT);
815 const char *cp = strchr(after_flavor,
'/');
817 diff_hash_in_url = tor_strndup(after_flavor, cp-after_flavor);
820 diff_hash_in_url = tor_strdup(after_flavor);
827 if (diff_hash_in_url) {
859 long lifetime = NETWORKSTATUS_CACHE_LIFETIME;
861 time_t now = time(NULL);
885 if (req.
diff_only && !cached_consensus) {
891 if (! cached_consensus) {
897 time_t valid_after, fresh_until, valid_until;
898 int have_valid_after = 0, have_fresh_until = 0, have_valid_until = 0;
899 if (cached_consensus) {
908 if (cached_consensus && have_valid_after &&
916 cached_consensus && have_valid_until &&
925 if (cached_consensus && req.
want_fps &&
928 "number of requested authorities");
937 if (cached_consensus) {
943 lifetime = (have_fresh_until && fresh_until > now) ? fresh_until - now : 0;
945 size_t size_guess = 0;
948 compress_method != NO_METHOD,
952 if (!smartlist_len(conn->
spool) && !n_expired) {
956 }
else if (!smartlist_len(conn->
spool)) {
964 "Client asked for network status lists, but we've been "
965 "writing too many bytes lately. Sending 503 Dir busy.");
988 const char vary_header[] =
"Vary: X-Or-Diff-From-Consensus\r\n";
996 compress_method == NO_METHOD ?
997 NO_METHOD : compression_used,
999 smartlist_len(conn->
spool) == 1 ? lifetime : 0);
1001 if (compress_method == NO_METHOD && smartlist_len(conn->
spool))
1006 const int initial_flush_result = connection_dirserv_flushed_some(conn);
1007 tor_assert_nonfatal(initial_flush_result == 0);
1013 dir_conn_clear_spool(conn);
1023 const char *url = args->
url;
1025 ssize_t body_len = 0;
1026 ssize_t estimated_len = 0;
1033 dirvote_dirreq_get_status_vote(url, items, dir_items);
1034 if (!smartlist_len(dir_items) && !smartlist_len(items)) {
1040 tor_assert_nonfatal(smartlist_len(items) == 0 ||
1041 smartlist_len(dir_items) == 0);
1045 if (smartlist_len(items)) {
1053 mask = (1u<<NO_METHOD) | (1u<<ZLIB_METHOD);
1059 body_len += compress_method != NO_METHOD ?
1060 d->dir_compressed_len : d->dir_len);
1061 estimated_len += body_len;
1063 size_t ln = strlen(item);
1064 if (compress_method != NO_METHOD) {
1065 estimated_len += ln/2;
1067 body_len += ln; estimated_len += ln;
1079 if (smartlist_len(items)) {
1080 if (compress_method != NO_METHOD) {
1087 c_sl_idx == c_sl_len - 1));
1090 connection_buf_add(compress_method != NO_METHOD ?
1091 d->dir_compressed : d->dir,
1092 compress_method != NO_METHOD ?
1093 d->dir_compressed_len : d->dir_len,
1097 smartlist_free(items);
1098 smartlist_free(dir_items);
1110 const char *url = args->
url;
1113 int clear_spool = 1;
1118 DIR_SPOOL_MICRODESC,
1120 DSR_DIGEST256|DSR_BASE64|DSR_SORT_UNIQ);
1122 size_t size_guess = 0;
1124 compress_method != NO_METHOD,
1126 if (smartlist_len(conn->
spool) == 0) {
1132 "Client asked for server descriptors, but we've been "
1133 "writing too many bytes lately. Sending 503 Dir busy.");
1141 MICRODESC_CACHE_LIFETIME);
1143 if (compress_method != NO_METHOD)
1147 const int initial_flush_result = connection_dirserv_flushed_some(conn);
1148 tor_assert_nonfatal(initial_flush_result == 0);
1154 dir_conn_clear_spool(conn);
1164 const char *url = args->
url;
1168 int clear_spool = 1;
1173 const char *msg = NULL;
1174 int cache_lifetime = 0;
1176 url += is_extra ? strlen(
"/tor/extra/") : strlen(
"/tor/server/");
1178 time_t publish_cutoff = 0;
1181 is_extra ? DIR_SPOOL_EXTRA_BY_DIGEST : DIR_SPOOL_SERVER_BY_DIGEST;
1184 is_extra ? DIR_SPOOL_EXTRA_BY_FP : DIR_SPOOL_SERVER_BY_FP;
1198 }
else if (smartlist_len(conn->
spool) == 1) {
1199 cache_lifetime = ROUTERDESC_BY_DIGEST_CACHE_LIFETIME;
1202 size_t size_guess = 0;
1205 compress_method != NO_METHOD,
1206 &size_guess, &n_expired);
1212 source == DIR_SPOOL_SERVER_BY_FP) {
1220 } SMARTLIST_FOREACH_END(spooled);
1223 if (res < 0 || size_guess == 0 || smartlist_len(conn->
spool) == 0) {
1230 "Client asked for server descriptors, but we've been "
1231 "writing too many bytes lately. Sending 503 Dir busy.");
1233 "Directory busy, try again later");
1234 dir_conn_clear_spool(conn);
1238 if (compress_method != NO_METHOD)
1243 int initial_flush_result = connection_dirserv_flushed_some(conn);
1244 tor_assert_nonfatal(initial_flush_result == 0);
1250 dir_conn_clear_spool(conn);
1259 const char *url = args->
url;
1266 if (!strcmp(url,
"/tor/keys/all")) {
1268 }
else if (!strcmp(url,
"/tor/keys/authority")) {
1276 DSR_HEX|DSR_SORT_UNIQ);
1282 smartlist_free(fps);
1287 DSR_HEX|DSR_SORT_UNIQ);
1293 smartlist_free(fps);
1294 }
else if (!
strcmpstart(url,
"/tor/keys/fp-sk/")) {
1304 smartlist_free(fp_sks);
1309 if (!smartlist_len(certs)) {
1314 if (c->cache_info.published_on < if_modified_since)
1316 if (!smartlist_len(certs)) {
1325 compress_method != NO_METHOD ? len/2 : len)) {
1331 compress_method != NO_METHOD ? -1 : len,
1334 if (compress_method != NO_METHOD) {
1341 c->cache_info.signed_descriptor_len,
1342 conn, c_sl_idx == c_sl_len - 1));
1344 smartlist_free(certs);
1358 const char *desc_str = NULL;
1359 const char *pubkey_str = NULL;
1360 const char *url = args->
url;
1366 "Rejecting single hop HS v3 descriptor request");
1374 pubkey_str = url + strlen(
"/tor/hs/3/");
1376 pubkey_str, &desc_str);
1377 if (retval <= 0 || desc_str == NULL) {
1384 connection_buf_add(desc_str, strlen(desc_str),
TO_CONN(conn));
1407 const char *headers = args->
headers;
1432 size_t dlen = strlen(status);
1434 connection_buf_add(status, dlen,
TO_CONN(conn));
1447 log_debug(
LD_DIR,
"Getting next bandwidth.");
1455 if (bandwidth != NULL) {
1456 ssize_t len = strlen(bandwidth);
1458 compress_method, BANDWIDTH_CACHE_LIFETIME);
1459 if (compress_method != NO_METHOD) {
1462 log_debug(
LD_DIR,
"Compressing bandwidth file.");
1464 log_debug(
LD_DIR,
"Not compressing bandwidth file.");
1481 const char robots[] =
"User-agent: *\r\nDisallow: /\r\n";
1482 size_t len = strlen(robots);
1484 connection_buf_add(robots, len,
TO_CONN(conn));
1499parse_hs_version_from_post(
const char *url,
const char *prefix,
1500 const char **end_pos)
1503 unsigned long version;
1516 start = url + strlen(prefix);
1525 return (
int) version;
1535handle_post_hs_descriptor(
const char *url,
const char *
body)
1538 const char *end_pos;
1543 version = parse_hs_version_from_post(url,
"/tor/hs/", &end_pos);
1559 log_info(
LD_REND,
"Publish request for HS descriptor handled "
1580 const char *
body,
size_t body_len))
1587 log_debug(
LD_DIRSERV,
"Received POST command.");
1592 log_info(
LD_DIR,
"Rejected dir post request from %s "
1593 "since we're not a public relay.",
1611 "Rejecting single hop HS descriptor post");
1614 const char *msg =
"HS descriptor stored successfully.";
1617 int code = handle_post_hs_descriptor(url,
body);
1619 msg =
"Invalid HS descriptor. Rejected.";
1629 "accept posted server descriptors");
1634 !strcmp(url,
"/tor/")) {
1635 const char *msg =
"[None]";
1642 "New descriptor post, because: %s",
1643 genreason ? genreason :
"not specified");
1648 purpose, conn->base_.
address, &msg);
1651 if (r == ROUTER_ADDED_SUCCESSFULLY) {
1655 "X-Descriptor-Not-New: Yes\r\n", -1);
1658 "Rejected router descriptor or extra-info from %s "
1667 if (authdir_mode_v3(options) &&
1668 !strcmp(url,
"/tor/post/vote")) {
1669 const char *msg =
"OK";
1676 log_warn(
LD_DIRSERV,
"Rejected vote from %s (\"%s\").",
1684 if (authdir_mode_v3(options) &&
1685 !strcmp(url,
"/tor/post/consensus-signature")) {
1686 const char *msg = NULL;
1690 log_warn(
LD_DIR,
"Unable to store signatures posted by %s: %s",
1694 msg?msg:
"Unable to store signatures");
1721 tor_addr_is_internal(&toraddr,0)) {
1722 log_debug(
LD_DIR,
"Ignoring local/internal IP %s",
escaped(fwd));
1728 conn->
address = tor_strdup(fwd);
1741 char *headers=NULL, *
body=NULL;
1753 "Request too large from %s to DirPort. Closing.",
1757 log_debug(
LD_DIRSERV,
"command not all here yet.");
1767 if (!strncasecmp(headers,
"GET",3))
1769 else if (!strncasecmp(headers,
"POST",4))
1773 "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.
hs_ident_dir_conn_t * hs_ident_server_dir_conn_new(const ed25519_public_key_t *blinded_pk)
Header file containing circuit and connection identifier data for the whole HS subsystem.
#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)