97 #define SIGCLEARDNSCACHE 130
98 #define SIGHEARTBEAT 131
100 #define SIGDORMANT 133
102 #if (SIZEOF_CELL_T != 0)
105 #define cell_t tor_cell_t
109 #define DOWNCAST(to, ptr) ((to*)SUBTYPE_P(ptr, to, base_))
112 #define MAX_NICKNAME_LEN 19
115 #define MAX_HEX_NICKNAME_LEN (HEX_DIGEST_LEN+1)
118 #define MAX_VERBOSE_NICKNAME_LEN (1+HEX_DIGEST_LEN+1+MAX_NICKNAME_LEN)
122 #define MAX_HEADERS_SIZE 50000
127 #define MAX_DESCRIPTOR_UPLOAD_SIZE 20000
130 #define MAX_EXTRAINFO_UPLOAD_SIZE 50000
133 #define MIN_ONION_KEY_LIFETIME_DAYS (1)
136 #define MAX_ONION_KEY_LIFETIME_DAYS (90)
139 #define DEFAULT_ONION_KEY_LIFETIME_DAYS (28)
144 #define MIN_ONION_KEY_GRACE_PERIOD_DAYS (1)
147 #define DEFAULT_ONION_KEY_GRACE_PERIOD_DAYS (7)
151 #define ONION_KEY_CONSENSUS_CHECK_INTERVAL (60*60)
154 #define MAX_SSL_KEY_LIFETIME_INTERNAL (2*60*60)
158 #define ROUTER_MAX_AGE (60*60*48)
161 #define ROUTER_MAX_AGE_TO_PUBLISH (60*60*24)
163 #define OLD_ROUTER_DESC_MAX_AGE (60*60*24*5)
167 #define PROXY_CONNECT 1
168 #define PROXY_SOCKS4 2
169 #define PROXY_SOCKS5 3
170 #define PROXY_HAPROXY 4
176 #define PROXY_PLUGGABLE 5
180 #define MIN_CIRCUITS_HANDLING_STREAM 2
184 #define RELAY_COMMAND_BEGIN 1
185 #define RELAY_COMMAND_DATA 2
186 #define RELAY_COMMAND_END 3
187 #define RELAY_COMMAND_CONNECTED 4
188 #define RELAY_COMMAND_SENDME 5
189 #define RELAY_COMMAND_EXTEND 6
190 #define RELAY_COMMAND_EXTENDED 7
191 #define RELAY_COMMAND_TRUNCATE 8
192 #define RELAY_COMMAND_TRUNCATED 9
193 #define RELAY_COMMAND_DROP 10
194 #define RELAY_COMMAND_RESOLVE 11
195 #define RELAY_COMMAND_RESOLVED 12
196 #define RELAY_COMMAND_BEGIN_DIR 13
197 #define RELAY_COMMAND_EXTEND2 14
198 #define RELAY_COMMAND_EXTENDED2 15
200 #define RELAY_COMMAND_ESTABLISH_INTRO 32
201 #define RELAY_COMMAND_ESTABLISH_RENDEZVOUS 33
202 #define RELAY_COMMAND_INTRODUCE1 34
203 #define RELAY_COMMAND_INTRODUCE2 35
204 #define RELAY_COMMAND_RENDEZVOUS1 36
205 #define RELAY_COMMAND_RENDEZVOUS2 37
206 #define RELAY_COMMAND_INTRO_ESTABLISHED 38
207 #define RELAY_COMMAND_RENDEZVOUS_ESTABLISHED 39
208 #define RELAY_COMMAND_INTRODUCE_ACK 40
210 #define RELAY_COMMAND_PADDING_NEGOTIATE 41
211 #define RELAY_COMMAND_PADDING_NEGOTIATED 42
214 #define END_OR_CONN_REASON_DONE 1
215 #define END_OR_CONN_REASON_REFUSED 2
216 #define END_OR_CONN_REASON_OR_IDENTITY 3
217 #define END_OR_CONN_REASON_CONNRESET 4
218 #define END_OR_CONN_REASON_TIMEOUT 5
219 #define END_OR_CONN_REASON_NO_ROUTE 6
220 #define END_OR_CONN_REASON_IO_ERROR 7
221 #define END_OR_CONN_REASON_RESOURCE_LIMIT 8
222 #define END_OR_CONN_REASON_PT_MISSING 9
223 #define END_OR_CONN_REASON_TLS_ERROR 10
224 #define END_OR_CONN_REASON_MISC 11
228 #define END_STREAM_REASON_MISC 1
229 #define END_STREAM_REASON_RESOLVEFAILED 2
230 #define END_STREAM_REASON_CONNECTREFUSED 3
231 #define END_STREAM_REASON_EXITPOLICY 4
232 #define END_STREAM_REASON_DESTROY 5
233 #define END_STREAM_REASON_DONE 6
234 #define END_STREAM_REASON_TIMEOUT 7
235 #define END_STREAM_REASON_NOROUTE 8
236 #define END_STREAM_REASON_HIBERNATING 9
237 #define END_STREAM_REASON_INTERNAL 10
238 #define END_STREAM_REASON_RESOURCELIMIT 11
239 #define END_STREAM_REASON_CONNRESET 12
240 #define END_STREAM_REASON_TORPROTOCOL 13
241 #define END_STREAM_REASON_NOTDIRECTORY 14
242 #define END_STREAM_REASON_ENTRYPOLICY 15
251 #define END_STREAM_REASON_CANT_ATTACH 257
254 #define END_STREAM_REASON_NET_UNREACHABLE 258
257 #define END_STREAM_REASON_SOCKSPROTOCOL 259
260 #define END_STREAM_REASON_CANT_FETCH_ORIG_DEST 260
263 #define END_STREAM_REASON_INVALID_NATD_DEST 261
266 #define END_STREAM_REASON_PRIVATE_ADDR 262
270 #define END_STREAM_REASON_HTTPPROTOCOL 263
273 #define END_STREAM_REASON_MASK 511
277 #define END_STREAM_REASON_FLAG_REMOTE 512
280 #define END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED 1024
284 #define END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED 2048
287 #define RESOLVED_TYPE_HOSTNAME 0
288 #define RESOLVED_TYPE_IPV4 4
289 #define RESOLVED_TYPE_IPV6 6
290 #define RESOLVED_TYPE_ERROR_TRANSIENT 0xF0
291 #define RESOLVED_TYPE_ERROR 0xF1
297 #define END_CIRC_REASON_IP_NOW_REDUNDANT -4
301 #define END_CIRC_REASON_MEASUREMENT_EXPIRED -3
304 #define END_CIRC_REASON_NOPATH -2
306 #define END_CIRC_AT_ORIGIN -1
310 #define END_CIRC_REASON_MIN_ 0
311 #define END_CIRC_REASON_NONE 0
312 #define END_CIRC_REASON_TORPROTOCOL 1
313 #define END_CIRC_REASON_INTERNAL 2
314 #define END_CIRC_REASON_REQUESTED 3
315 #define END_CIRC_REASON_HIBERNATING 4
316 #define END_CIRC_REASON_RESOURCELIMIT 5
317 #define END_CIRC_REASON_CONNECTFAILED 6
318 #define END_CIRC_REASON_OR_IDENTITY 7
319 #define END_CIRC_REASON_CHANNEL_CLOSED 8
320 #define END_CIRC_REASON_FINISHED 9
321 #define END_CIRC_REASON_TIMEOUT 10
322 #define END_CIRC_REASON_DESTROYED 11
323 #define END_CIRC_REASON_NOSUCHSERVICE 12
324 #define END_CIRC_REASON_MAX_ 12
329 #define END_CIRC_REASON_FLAG_REMOTE 512
334 #define REND_DESC_ID_V2_LEN_BASE32 BASE32_DIGEST_LEN
337 #define REND_CLIENTNAME_MAX_LEN 16
341 #define REND_COOKIE_LEN DIGEST_LEN
360 #define REND_REPLAY_TIME_INTERVAL (5 * 60)
382 #define CIRCWINDOW_START 1000
383 #define CIRCWINDOW_START_MIN 100
384 #define CIRCWINDOW_START_MAX 1000
386 #define CIRCWINDOW_INCREMENT 100
389 #define STREAMWINDOW_START 500
390 #define STREAMWINDOW_START_MAX 500
392 #define STREAMWINDOW_INCREMENT 50
401 #define ORCIRC_MAX_MIDDLE_CELLS (CIRCWINDOW_START_MAX*2)
405 #define ORCIRC_MAX_MIDDLE_KILL_THRESH (1.1f)
408 #define CELL_PADDING 0
409 #define CELL_CREATE 1
410 #define CELL_CREATED 2
412 #define CELL_DESTROY 4
413 #define CELL_CREATE_FAST 5
414 #define CELL_CREATED_FAST 6
415 #define CELL_VERSIONS 7
416 #define CELL_NETINFO 8
417 #define CELL_RELAY_EARLY 9
418 #define CELL_CREATE2 10
419 #define CELL_CREATED2 11
420 #define CELL_PADDING_NEGOTIATE 12
422 #define CELL_VPADDING 128
423 #define CELL_CERTS 129
424 #define CELL_AUTH_CHALLENGE 130
425 #define CELL_AUTHENTICATE 131
426 #define CELL_AUTHORIZE 132
427 #define CELL_COMMAND_MAX_ 132
430 #define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60)
433 #define LEGAL_NICKNAME_CHARACTERS \
434 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
438 #define DEFAULT_CLIENT_NICKNAME "client"
441 #define UNNAMED_ROUTER_NICKNAME "Unnamed"
444 #define SOCKS4_NETWORK_LEN 8
457 #define CELL_PAYLOAD_SIZE 509
460 #define CELL_MAX_NETWORK_SIZE 514
463 #define VAR_CELL_MAX_HEADER_SIZE 7
465 static int get_cell_network_size(
int wide_circ_ids);
466 static inline int get_cell_network_size(
int wide_circ_ids)
470 static int get_var_cell_header_size(
int wide_circ_ids);
471 static inline int get_var_cell_header_size(
int wide_circ_ids)
476 static int get_circ_id_size(
int wide_circ_ids);
477 static inline int get_circ_id_size(
int wide_circ_ids)
479 return wide_circ_ids ? 4 : 2;
484 #define RELAY_HEADER_SIZE (1+2+2+4+2)
486 #define RELAY_PAYLOAD_SIZE (CELL_PAYLOAD_SIZE-RELAY_HEADER_SIZE)
503 typedef struct channel_tls_t channel_tls_t;
507 typedef struct circuitmux_t circuitmux_t;
531 #define OR_AUTH_CHALLENGE_LEN 32
543 #define OR_CERT_TYPE_TLS_LINK 1
546 #define OR_CERT_TYPE_ID_1024 2
550 #define OR_CERT_TYPE_AUTH_1024 3
552 #define OR_CERT_TYPE_RSA_ED_CROSSCERT 7
561 #define AUTHTYPE_RSA_SHA256_TLSSECRET 1
569 #define AUTHTYPE_RSA_SHA256_RFC5705 2
572 #define AUTHTYPE_ED25519_SHA256_RFC5705 3
584 #define V3_AUTH_FIXED_PART_LEN (8+(32*6))
587 #define V3_AUTH_BODY_LEN (V3_AUTH_FIXED_PART_LEN + 8 + 16)
593 #define EXT_OR_CONN_ID_LEN DIGEST_LEN
601 #define OR_CONN_HIGHWATER (32*1024)
605 #define OR_CONN_LOWWATER (16*1024)
616 #define TO_CONN(c) (&(((c)->base_)))
619 #define ENTRY_TO_CONN(c) (TO_CONN(ENTRY_TO_EDGE_CONN(c)))
643 #define saved_location_bitfield_t ENUM_BF(saved_location_t)
648 DL_SCHED_GENERIC = 0,
649 DL_SCHED_CONSENSUS = 1,
652 #define download_schedule_bitfield_t ENUM_BF(download_schedule_t)
660 DL_WANT_ANY_DIRSERVER = 0,
661 DL_WANT_AUTHORITY = 1,
663 #define download_want_authority_bitfield_t \
664 ENUM_BF(download_want_authority_t)
670 DL_SCHED_INCREMENT_FAILURE = 0,
671 DL_SCHED_INCREMENT_ATTEMPT = 1,
673 #define download_schedule_increment_bitfield_t \
674 ENUM_BF(download_schedule_increment_t)
679 #define IMPOSSIBLE_TO_DOWNLOAD 255
684 #define ROUTER_ANNOTATION_BUF_LEN 256
767 #define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1)
797 #define ALL_DIRINFO ((dirinfo_type_t)((1<<7)-1))
799 #define ONION_HANDSHAKE_TYPE_TAP 0x0000
800 #define ONION_HANDSHAKE_TYPE_FAST 0x0001
801 #define ONION_HANDSHAKE_TYPE_NTOR 0x0002
802 #define MAX_ONION_HANDSHAKE_TYPE 0x0002
809 #define CPATH_KEY_MATERIAL_LEN (20*2+16*2)
834 #define MAX_RELAY_EARLY_CELLS_PER_CIRCUIT 8
837 #define path_state_bitfield_t ENUM_BF(path_state_t)
839 #if REND_COOKIE_LEN != DIGEST_LEN
840 #error "The REND_TOKEN_LEN macro assumes REND_COOKIE_LEN == DIGEST_LEN"
842 #define REND_TOKEN_LEN DIGEST_LEN
845 #define TO_CIRCUIT(x) (&((x)->base_))
854 #define ISO_DESTPORT (1u<<0)
856 #define ISO_DESTADDR (1u<<1)
858 #define ISO_SOCKSAUTH (1u<<2)
860 #define ISO_CLIENTPROTO (1u<<3)
862 #define ISO_CLIENTADDR (1u<<4)
864 #define ISO_SESSIONGRP (1u<<5)
866 #define ISO_NYM_EPOCH (1u<<6)
868 #define ISO_STREAM (1u<<7)
872 #define ISO_DEFAULT (ISO_CLIENTADDR|ISO_SOCKSAUTH|ISO_SESSIONGRP|ISO_NYM_EPOCH)
875 #define SESSION_GROUP_UNSET -1
877 #define SESSION_GROUP_DIRCONN -2
879 #define SESSION_GROUP_CONTROL_RESOLVE -3
881 #define SESSION_GROUP_FIRST_AUTO -4
884 typedef struct routerset_t routerset_t;
888 #define CFG_AUTO_PORT 0xc4005e
894 #define MAX_SOCKS_ADDR_LEN 256
899 #define DEFAULT_ROUTE_LEN 3
904 #define BW_WEIGHT_SCALE 10000
905 #define BW_MIN_WEIGHT_SCALE 1
906 #define BW_MAX_WEIGHT_SCALE INT32_MAX
936 #define addressmap_entry_source_bitfield_t ENUM_BF(addressmap_entry_source_t)
938 #define WRITE_STATS_INTERVAL (24*60*60)
951 #define MAX_INTRO_POINT_REACHABILITY_FAILURES 5
956 #define INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS 16384
958 #define INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS \
959 (INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS * 2)
967 #define INTRO_POINT_LIFETIME_MIN_SECONDS (18*60*60)
972 #define INTRO_POINT_LIFETIME_MAX_SECONDS (24*60*60)
977 #define MAX_INTRO_POINT_CIRCUIT_RETRIES 3
983 #define RELAY_REQUIRED_MIN_BANDWIDTH (75*1024)
984 #define BRIDGE_REQUIRED_MIN_BANDWIDTH (50*1024)
986 #define ROUTER_MAX_DECLARED_BANDWIDTH INT32_MAX
Header for approx_time.c.
Header file for buffers.c.
Inline functions for reading and writing multibyte values from the middle of strings,...
Macro definitions for MIN, MAX, and CLAMP.
Utility macros to handle different features and behavior in different compilers.
Locale-independent character-type inspection (header)
Header for compat_string.c.
Functions and types for monotonic times.
Headers for crypto_cipher.c.
Headers for crypto_rsa.c.
Definitions for sizes of Diffie-Hellman groups elements in Z_p.
Configuration structure for client ports.
Wrappers for reading and writing data to files on disk.
Macros for comparing the boolean value of integers.
Headers for util_malloc.c.
#define VAR_CELL_MAX_HEADER_SIZE
addressmap_entry_source_t
#define CELL_MAX_NETWORK_SIZE
download_want_authority_t
download_schedule_increment_t
circuit_channel_direction_t
Summarize similar messages that would otherwise flood the logs.
unsigned int supports_extend2_cells
unsigned int supports_ed25519_link_handshake_compat
unsigned int supports_v3_rendezvous_point
unsigned int supports_hs_setup_padding
unsigned int supports_initiating_ipv6_extends
unsigned int supports_v3_hsdir
unsigned int supports_ed25519_link_handshake_any
unsigned int supports_canonical_ipv6_conns
unsigned int protocols_known
unsigned int supports_accepting_ipv6_extends
unsigned int supports_ed25519_hs_intro
unsigned int supports_establish_intro_dos_extension
unsigned int waiting_time
Macros to implement mocking and selective exposure for the test code.
Definitions for timing-related constants.
Declarations for timeval-related macros that some platforms are missing.
Integer definitions used throughout Tor.
Macros to manage assertions, fatal and non-fatal.
Header for util_string.c.