|
Tor 0.4.9.8
|
Master header file for Tor-specific functionality. More...
#include "orconfig.h"#include "lib/cc/torint.h"#include "lib/arch/bytes.h"#include "lib/cc/compat_compiler.h"#include "lib/container/map.h"#include "lib/buf/buffers.h"#include "lib/container/smartlist.h"#include "lib/crypt_ops/crypto_cipher.h"#include "lib/crypt_ops/crypto_rsa.h"#include "lib/ctime/di_ops.h"#include "lib/defs/dh_sizes.h"#include "lib/encoding/binascii.h"#include "lib/encoding/cstring.h"#include "lib/encoding/time_fmt.h"#include "lib/err/torerr.h"#include "lib/fs/dir.h"#include "lib/fs/files.h"#include "lib/fs/mmap.h"#include "lib/fs/path.h"#include "lib/fs/userdb.h"#include "lib/geoip/country.h"#include "lib/intmath/addsub.h"#include "lib/intmath/bits.h"#include "lib/intmath/cmp.h"#include "lib/intmath/logic.h"#include "lib/intmath/muldiv.h"#include "lib/log/escape.h"#include "lib/log/ratelim.h"#include "lib/log/util_bug.h"#include "lib/malloc/malloc.h"#include "lib/net/address.h"#include "lib/net/inaddr.h"#include "lib/net/socket.h"#include "lib/string/compat_ctype.h"#include "lib/string/compat_string.h"#include "lib/string/parse_int.h"#include "lib/string/printf.h"#include "lib/string/scanf.h"#include "lib/string/util_string.h"#include "lib/testsupport/testsupport.h"#include "lib/thread/threads.h"#include "lib/time/compat_time.h"#include "lib/wallclock/approx_time.h"#include "lib/wallclock/timeval.h"#include "ht.h"#include "core/or/entry_port_cfg_st.h"Go to the source code of this file.
Data Structures | |
| struct | protover_summary_flags_t |
| struct | testing_cell_stats_entry_t |
Typedefs | |
| typedef uint32_t | circid_t |
| typedef uint16_t | streamid_t |
| typedef struct channel_tls_t | channel_tls_t |
| typedef struct circuitmux_t | circuitmux_t |
| typedef enum path_state_t | path_state_t |
| typedef struct routerset_t | routerset_t |
Enumerations | |
| enum | rend_auth_type_t { REND_NO_AUTH = 0 , REND_V3_AUTH = 1 } |
| enum | cell_direction_t { CELL_DIRECTION_IN =1 , CELL_DIRECTION_OUT =2 } |
| enum | circuit_channel_direction_t { CIRCUIT_N_CHAN = 0 , CIRCUIT_P_CHAN = 1 } |
| enum | relay_cell_fmt_t { RELAY_CELL_FORMAT_V0 , RELAY_CELL_FORMAT_V1 } |
| enum | saved_location_t { SAVED_NOWHERE =0 , SAVED_IN_CACHE , SAVED_IN_JOURNAL } |
| enum | download_schedule_t { DL_SCHED_GENERIC = 0 , DL_SCHED_CONSENSUS = 1 , DL_SCHED_BRIDGE = 2 } |
| enum | download_want_authority_t { DL_WANT_ANY_DIRSERVER = 0 , DL_WANT_AUTHORITY = 1 } |
| enum | download_schedule_increment_t { DL_SCHED_INCREMENT_FAILURE = 0 , DL_SCHED_INCREMENT_ATTEMPT = 1 } |
| enum | consensus_flavor_t { FLAV_NS = 0 , FLAV_MICRODESC = 1 } |
| enum | dirinfo_type_t { NO_DIRINFO = 0 , V3_DIRINFO = 1 << 2 , BRIDGE_DIRINFO = 1 << 4 , EXTRAINFO_DIRINFO =1 << 5 , MICRODESC_DIRINFO =1 << 6 } |
| enum | addressmap_entry_source_t { ADDRMAPSRC_CONTROLLER , ADDRMAPSRC_AUTOMAP , ADDRMAPSRC_TORRC , ADDRMAPSRC_TRACKEXIT , ADDRMAPSRC_DNS , ADDRMAPSRC_NONE } |
Functions | |
| static bool | is_known_relay_command (const uint8_t cmd) |
| static int | get_cell_network_size (int wide_circ_ids) |
| static int | get_var_cell_header_size (int wide_circ_ids) |
| static int | get_circ_id_size (int wide_circ_ids) |
Master header file for Tor-specific functionality.
Definition in file or.h.
| #define addressmap_entry_source_bitfield_t ENUM_BF(addressmap_entry_source_t) |
| #define ALL_DIRINFO ((dirinfo_type_t)((1<<7)-1)) |
| #define AUTHTYPE_ED25519_SHA256_RFC5705 3 |
As AUTHTYPE_RSA_SHA256_RFC5705, but uses an Ed25519 identity key to authenticate.
Definition at line 677 of file or.h.
Referenced by authchallenge_type_is_supported(), channel_tls_process_authenticate_cell(), connection_or_compute_authenticate_cell_body(), and connection_or_send_auth_challenge_cell().
| #define AUTHTYPE_RSA_SHA256_RFC5705 2 |
As AUTHTYPE_RSA_SHA256_TLSSECRET, but instead of using the negotiated TLS secrets, uses exported keying material from the TLS session as described in RFC 5705.
Not used by today's tors, since everything that supports this also supports ED25519_SHA256_5705, which is better.
Definition at line 674 of file or.h.
Referenced by authchallenge_type_is_supported(), and connection_or_compute_authenticate_cell_body().
| #define AUTHTYPE_RSA_SHA256_TLSSECRET 1 |
The first supported type of AUTHENTICATE cell. It contains a bunch of structures signed with an RSA1024 key. The signed structures include a HMAC using negotiated TLS secrets, and a digest of all cells sent or received before the AUTHENTICATE cell (including the random server-generated AUTH_CHALLENGE cell).
Definition at line 666 of file or.h.
Referenced by authchallenge_type_is_supported(), and connection_or_compute_authenticate_cell_body().
| #define BW_WEIGHT_SCALE 10000 |
Precision multiplier for the Bw weights
Definition at line 1010 of file or.h.
Referenced by networkstatus_compute_consensus(), and networkstatus_get_weight_scale_param().
| #define CELL_MAX_NETWORK_SIZE 514 |
Number of bytes in a cell transmitted over the network, in the longest form
Definition at line 532 of file or.h.
Referenced by cell_pack(), circuit_synchronize_written_or_bandwidth(), congestion_control_vegas_log(), connection_or_process_cells_from_inbuf(), and router_perform_bandwidth_test().
| #define CELL_PAYLOAD_SIZE 509 |
Number of bytes in a cell, minus cell header.
Definition at line 529 of file or.h.
Referenced by cell_pack(), cell_unpack(), channel_tls_process_netinfo_cell(), channel_tls_process_padding_negotiate_cell(), channelpadding_send_disable_command(), channelpadding_send_enable_command(), circpad_negotiate_padding(), circpad_padding_negotiated(), circuit_package_relay_cell(), circuit_send_stream_xoff(), circuit_send_stream_xon(), command_process_relay_cell(), connection_edge_package_raw_inbuf(), connection_or_send_netinfo(), connection_outbuf_too_full(), create_cell_parse(), decode_v0_cell(), decode_v1_cell(), relay_cell_max_payload_size(), tor1_crypt_one_payload(), tor1_relay_digest_matches_v0(), and tor1_set_digest_v0().
| #define CFG_AUTO_PORT 0xc4005e |
A magic value for the (Socks|OR|...)Port options below, telling Tor to pick its own port.
Definition at line 994 of file or.h.
Referenced by connection_listener_new_for_port(), describe_portnum(), get_first_listener_addrport_string(), port_parse_config(), retry_listener_ports(), routerconf_find_dir_port(), and routerconf_find_or_port().
| #define CIRCWINDOW_INCREMENT 100 |
Amount to increment a circuit window when we get a circuit SENDME.
Definition at line 450 of file or.h.
Referenced by circuit_reset_sendme_randomness(), circuit_sent_cell_for_sendme(), sendme_get_inc_count(), and sendme_process_circuit_level_impl().
| #define CIRCWINDOW_START 1000 |
Initial value for both sides of a circuit transmission window when the circuit is initialized. Measured in cells.
Definition at line 446 of file or.h.
Referenced by circuit_initial_package_window(), circuit_sent_cell_for_sendme(), cpath_append_hop(), finalize_rend_circuit(), init_circuit_base(), router_perform_bandwidth_test(), and sendme_circuit_consider_sending().
| #define DEFAULT_ONION_KEY_GRACE_PERIOD_DAYS (7) |
Default grace period for acceptance of an onion key in days.
Definition at line 147 of file or.h.
Referenced by get_onion_key_grace_period().
| #define DEFAULT_ONION_KEY_LIFETIME_DAYS (28) |
Default lifetime for an onion key in days.
Definition at line 139 of file or.h.
Referenced by get_onion_key_rotation_days_().
| #define DEFAULT_ROUTE_LEN 3 |
How many hops does a general-purpose circuit have by default?
Definition at line 1005 of file or.h.
Referenced by build_vanguard_middle_exclude_list(), circuit_any_opened_circuits(), circuit_build_times_handle_completed_hop(), circuit_finish_handshake(), circuit_timeout_want_to_count_circ(), and route_len_for_purpose().
| #define DOWNCAST | ( | to, | |
| ptr ) |
Helper macro: Given a pointer to to.base_, of type from*, return &to.
Definition at line 109 of file or.h.
Referenced by TO_CONTROL_CONN(), TO_DIR_CONN(), TO_EDGE_CONN(), TO_LISTENER_CONN(), TO_OR_CIRCUIT(), TO_OR_CONN(), and TO_ORIGIN_CIRCUIT().
| #define download_schedule_bitfield_t ENUM_BF(download_schedule_t) |
| #define download_schedule_increment_bitfield_t ENUM_BF(download_schedule_increment_t) |
| #define download_want_authority_bitfield_t ENUM_BF(download_want_authority_t) |
| #define END_CIRC_AT_ORIGIN -1 |
Catch-all "other" reason for closing origin circuits.
Definition at line 370 of file or.h.
Referenced by circuit_end_reason_to_control_string(), circuit_mark_for_close_(), circuit_receive_relay_cell(), circuit_testing_opened(), and handle_hs_exit_conn().
| #define END_CIRC_REASON_FLAG_REMOTE 512 |
Bitwise-OR this with the argument to circuit_mark_for_close() or control_event_circuit_status() to indicate that the reason was passed through from a destroy or truncate cell.
Definition at line 393 of file or.h.
Referenced by circuit_end_reason_to_control_string(), circuit_mark_for_close_(), circuit_truncated(), circuit_unlink_all_from_channel(), command_process_destroy_cell(), control_event_circuit_status(), and pathbias_check_close().
| #define END_CIRC_REASON_MEASUREMENT_EXPIRED -3 |
Our post-timeout circuit time measurement period expired. We must give up now
Definition at line 365 of file or.h.
Referenced by circuit_end_reason_to_control_string(), and circuit_expire_building().
| #define END_CIRC_REASON_NOPATH -2 |
We couldn't build a path for this circuit.
Definition at line 368 of file or.h.
Referenced by circuit_end_reason_to_control_string(), circuit_establish_circuit(), and circuit_establish_circuit_conflux().
| #define END_OR_CONN_REASON_CONNRESET 4 /* connection reset by peer */ |
| #define END_OR_CONN_REASON_NO_ROUTE 6 /* no route to host/net */ |
| #define END_OR_CONN_REASON_PT_MISSING 9 /* PT failed or not available */ |
| #define END_OR_CONN_REASON_RESOURCE_LIMIT 8 /* sockets, buffers, etc */ |
| #define END_OR_CONN_REASON_TLS_ERROR 10 /* Problem in TLS protocol */ |
| #define END_STREAM_REASON_CANT_ATTACH 257 |
We were unable to attach the connection to any circuit at all.
Definition at line 308 of file or.h.
Referenced by connection_ap_attach_pending(), connection_ap_expire_beginning(), connection_ap_handshake_rewrite_and_attach(), connection_edge_package_raw_inbuf(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_CANT_FETCH_ORIG_DEST 260 |
This is a transparent proxy connection, but we can't extract the original target address:port.
Definition at line 317 of file or.h.
Referenced by connection_ap_process_transparent().
| #define END_STREAM_REASON_ENTRYPOLICY 264 |
The user has asked us to do something that we reject (Like connecting to a plaintext port, or violating OnionTrafficOnly.)
Definition at line 332 of file or.h.
Referenced by connection_ap_handle_onion(), connection_ap_handshake_rewrite_and_attach(), consider_plaintext_ports(), end_reason_to_http_connect_response_line(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED 1024 |
Bitwise-or this with the argument to control_event_stream_status to indicate that we already sent a CLOSED stream event.
Definition at line 342 of file or.h.
Referenced by circuit_about_to_free(), connection_edge_destroy(), and control_event_stream_status().
| #define END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED 2048 |
Bitwise-or this with endreason to indicate that we already sent a socks reply, and no further reply needs to be sent from connection_mark_unattached_ap().
Definition at line 346 of file or.h.
Referenced by connection_ap_handle_onion(), connection_ap_handshake_process_socks(), connection_ap_handshake_rewrite_and_attach(), connection_ap_process_http_connect(), connection_edge_process_resolved_cell(), and connection_mark_unattached_ap_().
| #define END_STREAM_REASON_FLAG_REMOTE 512 |
Bitwise-or this with the argument to control_event_stream_status to indicate that the reason came from an END cell.
Definition at line 339 of file or.h.
Referenced by connection_ap_process_end_not_open(), connection_edge_process_relay_cell_not_open(), control_event_stream_status(), and handle_relay_msg().
| #define END_STREAM_REASON_HTTPPROTOCOL 263 |
This is an HTTP tunnel connection and the client used or misused HTTP in a way we can't handle.
Definition at line 327 of file or.h.
Referenced by connection_ap_process_http_connect(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_INVALID_NATD_DEST 261 |
This is a connection on the NATD port, and the destination IP:Port was either ill-formed or out-of-range.
Definition at line 320 of file or.h.
Referenced by connection_ap_process_natd().
| #define END_STREAM_REASON_MASK 511 |
Bitwise-and this value with endreason to mask out all flags.
Definition at line 335 of file or.h.
Referenced by connection_ap_handshake_rewrite_and_attach(), connection_ap_handshake_socks_reply(), end_reason_to_http_connect_response_line(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_NET_UNREACHABLE 258 |
We can't connect to any directories at all, so we killed our streams before they can time out.
Definition at line 311 of file or.h.
Referenced by directory_all_unreachable_cb(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_PRIVATE_ADDR 262 |
The target address is in a private network (like 127.0.0.1 or 10.0.0.1); you don't want to do that over a randomly chosen exit
Definition at line 323 of file or.h.
Referenced by connection_ap_handshake_rewrite_and_attach(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define END_STREAM_REASON_SOCKSPROTOCOL 259 |
This is a SOCKS connection, and the client used (or misused) the SOCKS protocol in a way we couldn't handle.
Definition at line 314 of file or.h.
Referenced by connection_ap_handle_onion(), connection_ap_handshake_process_socks(), stream_end_reason_to_control_string(), and stream_end_reason_to_socks5_response().
| #define ENTRY_TO_CONN | ( | c | ) |
Cast a entry_connection_t subtype pointer to a connection_t
Definition at line 712 of file or.h.
Referenced by circuit_get_open_circ_or_launch(), circuit_is_better(), client_dns_set_addressmap_impl(), connection_ap_about_to_close(), connection_ap_attach_pending(), connection_ap_detach_retriable(), connection_ap_get_nonrend_circ_purpose(), connection_ap_handle_onion(), connection_ap_handshake_attach_chosen_circuit(), connection_ap_handshake_attach_circuit(), connection_ap_handshake_process_socks(), connection_ap_handshake_rewrite_and_attach(), connection_ap_handshake_socks_reply(), connection_ap_make_link(), connection_ap_mark_as_pending_circuit_(), connection_ap_mark_as_waiting_for_renddesc(), connection_ap_process_end_not_open(), connection_ap_process_http_connect(), connection_ap_process_natd(), connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), connection_entry_set_controller_wait(), connection_mark_unattached_ap_(), connection_new(), consider_recording_trackhost(), control_event_stream_status(), directory_initiate_request(), entry_connection_new(), evdns_server_callback(), handle_control_attachstream(), link_apconn_to_circ(), and tell_controller_about_resolved_result().
| #define EXT_OR_CONN_ID_LEN DIGEST_LEN /* 20 */ |
| #define IMPOSSIBLE_TO_DOWNLOAD 255 |
If n_download_failures is this high, the download can never happen.
Definition at line 772 of file or.h.
Referenced by download_status_increment_attempt(), download_status_increment_failure(), download_status_mark_impossible(), and download_status_reset().
| #define INTRO_POINT_LIFETIME_MAX_SECONDS (24*60*60) |
The maximum number of seconds that an introduction point will last before expiring due to old age.
XXX Should this be configurable?
Definition at line 1078 of file or.h.
Referenced by get_intro_point_max_lifetime().
| #define INTRO_POINT_LIFETIME_MIN_SECONDS (18*60*60) |
The minimum number of seconds that an introduction point will last before expiring due to old age. (If it receives INTRO_POINT_LIFETIME_INTRODUCTIONS INTRODUCE2 cells, it may expire sooner.)
XXX Should this be configurable?
Definition at line 1073 of file or.h.
Referenced by get_intro_point_min_lifetime().
| #define INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS (INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS * 2) |
| #define INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS 16384 |
The minimum and maximum number of distinct INTRODUCE2 cells which a hidden service's introduction point will receive before it begins to expire.
Definition at line 1062 of file or.h.
Referenced by get_intro_point_min_introduce2().
| #define ISO_CLIENTADDR (1u<<4) |
Isolate based on client address
Definition at line 968 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), entry_connection_describe_status_for_controller(), and port_parse_config().
| #define ISO_CLIENTPROTO (1u<<3) |
Isolate based on client protocol choice
Definition at line 966 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), entry_connection_describe_status_for_controller(), and port_parse_config().
| #define ISO_DEFAULT (ISO_CLIENTADDR|ISO_SOCKSAUTH|ISO_SESSIONGRP|ISO_NYM_EPOCH) |
Default isolation level for ports.
Definition at line 978 of file or.h.
Referenced by dnsserv_launch_request(), and port_cfg_new().
| #define ISO_DESTADDR (1u<<1) |
Isolate based on destination address
Definition at line 962 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), entry_connection_describe_status_for_controller(), and port_parse_config().
| #define ISO_DESTPORT (1u<<0) |
Isolate based on destination port
Definition at line 960 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), entry_connection_describe_status_for_controller(), and port_parse_config().
| #define ISO_NYM_EPOCH (1u<<6) |
Isolate based on newnym epoch (always on).
Definition at line 972 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), and entry_connection_describe_status_for_controller().
| #define ISO_SESSIONGRP (1u<<5) |
Isolate based on session group (always on).
Definition at line 970 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), directory_initiate_request(), and entry_connection_describe_status_for_controller().
| #define ISO_SOCKSAUTH (1u<<2) |
Isolate based on SOCKS authentication
Definition at line 964 of file or.h.
Referenced by connection_ap_socks_iso_keepalive_enabled(), connection_edge_compatible_with_circuit(), connection_edge_update_circuit_isolation(), entry_connection_describe_status_for_controller(), and port_parse_config().
| #define ISO_STREAM (1u<<7) |
Isolate all streams (Internal only).
Definition at line 974 of file or.h.
Referenced by connection_edge_compatible_with_circuit(), and directory_initiate_request().
| #define LEGAL_NICKNAME_CHARACTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
Legal characters in a nickname.
Definition at line 502 of file or.h.
Referenced by is_legal_nickname().
| #define MAX_DESCRIPTOR_UPLOAD_SIZE 20000 |
Maximum size, in bytes, of a single router descriptor uploaded to us as a directory authority. Caches and clients fetch whatever descriptors the authorities tell them to fetch, and don't care about size.
Definition at line 127 of file or.h.
Referenced by dirserv_add_descriptor().
| #define MAX_EXTRAINFO_UPLOAD_SIZE 50000 |
Maximum size of a single extrainfo document, as above.
Definition at line 130 of file or.h.
Referenced by dirserv_add_extrainfo(), and extrainfo_dump_to_string().
| #define MAX_HEADERS_SIZE 50000 |
For HTTP parsing: Maximum number of bytes we'll accept in the headers of an HTTP request or response.
Definition at line 122 of file or.h.
Referenced by connection_dir_client_reached_eof(), connection_read_https_proxy_response(), and directory_handle_command().
| #define MAX_HEX_NICKNAME_LEN (HEX_DIGEST_LEN+1) |
| #define MAX_INTRO_POINT_CIRCUIT_RETRIES 3 |
The maximum number of circuit creation retry we do to an intro point before giving up. We try to reuse intro point that fails during their lifetime so this is a hard limit on the amount of time we do that.
Definition at line 1083 of file or.h.
Referenced by cleanup_intro_points(), get_max_intro_circ_per_period(), and should_remove_intro_point().
| #define MAX_INTRO_POINT_REACHABILITY_FAILURES 5 |
The maximum number of non-circuit-build-timeout failures a hidden service client will tolerate while trying to build a circuit to an introduction point.
Definition at line 1057 of file or.h.
Referenced by intro_point_is_usable().
| #define MAX_NICKNAME_LEN 19 |
Length of longest allowable configured nickname.
Definition at line 112 of file or.h.
Referenced by circuit_list_path_impl(), hex_digest_nickname_decode(), hex_digest_nickname_matches(), is_legal_nickname(), node_get_by_hex_id(), node_get_verbose_nickname(), and nodefamily_from_members().
| #define MAX_ONION_KEY_LIFETIME_DAYS (90) |
Maximum lifetime for an onion key in days.
Definition at line 136 of file or.h.
Referenced by get_onion_key_rotation_days_().
| #define MAX_RELAY_EARLY_CELLS_PER_CIRCUIT 8 |
Largest number of relay_early cells that we can send on a given circuit.
Definition at line 940 of file or.h.
Referenced by or_circuit_new(), and origin_circuit_new().
| #define MAX_SSL_KEY_LIFETIME_INTERNAL (2*60*60) |
How often do we rotate TLS contexts?
Definition at line 154 of file or.h.
Referenced by rotate_x509_certificate_callback().
| #define MAX_VERBOSE_NICKNAME_LEN (1+HEX_DIGEST_LEN+1+MAX_NICKNAME_LEN) |
Maximum length of verbose router identifier: dollar sign, hex ID digest, equal sign or tilde, nickname.
Definition at line 118 of file or.h.
Referenced by circuit_list_path_impl(), control_event_descriptors_changed(), control_event_guard(), getinfo_helper_format_single_entry_guard(), node_describe_longname_by_id(), orconn_target_get_name(), and router_get_verbose_nickname().
| #define MIN_CIRCUITS_HANDLING_STREAM 2 |
How many circuits do we want simultaneously in-progress to handle a given stream?
Definition at line 180 of file or.h.
Referenced by ap_stream_wants_exit_attention(), and circuit_remove_handled_ports().
| #define MIN_ONION_KEY_GRACE_PERIOD_DAYS (1) |
Minimum grace period for acceptance of an onion key in days. The maximum value is defined in proposal #274 as being the current network consensus parameter for "onion-key-rotation-days".
Definition at line 144 of file or.h.
Referenced by get_onion_key_grace_period().
| #define MIN_ONION_KEY_LIFETIME_DAYS (1) |
Minimum lifetime for an onion key in days.
Definition at line 133 of file or.h.
Referenced by get_onion_key_rotation_days_().
| #define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1) |
How many different consensus flavors are there?
Definition at line 872 of file or.h.
Referenced by consdiffmgr_cleanup(), consdiffmgr_consensus_load(), consdiffmgr_find_consensus(), consdiffmgr_free_all(), consdiffmgr_rescan(), consensus_compress_worker_replyfn(), dirvote_add_signatures_to_all_pending_consensuses(), dirvote_clear_pending_consensuses(), dirvote_compute_consensuses(), dirvote_fetch_missing_signatures(), dirvote_get_pending_consensus(), dirvote_publish_consensus(), networkstatus_consensus_download_failed(), networkstatus_free_all(), networkstatus_get_dl_status_by_flavor(), networkstatus_get_dl_status_by_flavor_bootstrap(), networkstatus_get_dl_status_by_flavor_running(), networkstatus_note_certs_arrived(), networkstatus_reset_download_failures(), networkstatus_set_current_consensus(), router_reload_consensus_networkstatus(), update_certificate_downloads(), update_consensus_networkstatus_downloads(), update_consensus_networkstatus_fetch_time(), and we_want_to_fetch_flavor().
| #define OLD_ROUTER_DESC_MAX_AGE (60*60*24*5) |
How old do we let a saved descriptor get before force-removing it?
Definition at line 163 of file or.h.
Referenced by networkstatus_set_current_consensus(), router_add_to_routerlist(), and routerlist_remove_old_routers().
| #define ONION_KEY_CONSENSUS_CHECK_INTERVAL (60*60) |
| #define OR_AUTH_CHALLENGE_LEN 32 |
| #define OR_CERT_TYPE_AUTH_1024 3 |
A certificate that authenticates a key used in an AUTHENTICATE cell in the v3 handshake. The subject key must be a 1024-bit RSA key; it must be signed by the identity key
Definition at line 655 of file or.h.
Referenced by connection_or_send_certs_cell().
| #define OR_CERT_TYPE_ID_1024 2 |
A self-signed identity certificate. The subject key must be a 1024-bit RSA key.
Definition at line 651 of file or.h.
Referenced by connection_or_send_certs_cell().
| #define OR_CERT_TYPE_TLS_LINK 1 |
A certificate that authenticates a TLS link key. The subject key must match the key used in the TLS handshake; it must be signed by the identity key.
Definition at line 648 of file or.h.
Referenced by connection_or_send_certs_cell().
| #define ORCIRC_MAX_MIDDLE_CELLS (CIRCWINDOW_START_MAX*2) |
Maximum number of queued cells on a circuit for which we are the midpoint before we give up and kill it. This must be >= circwindow to avoid killing innocent circuits, and >= circwindow*2 to give leaky-pipe a chance of working someday. The ORCIRC_MAX_MIDDLE_KILL_THRESH ratio controls the margin of error between emitting a warning and killing the circuit.
| #define ORCIRC_MAX_MIDDLE_KILL_THRESH (1.1f) |
| #define path_state_bitfield_t ENUM_BF(path_state_t) |
| #define RELAY_HEADER_SIZE_V0 (1+2+2+4+2) |
Number of bytes used for a relay cell's header, in the v0 format.
Definition at line 563 of file or.h.
Referenced by decode_v0_cell(), encode_v0_cell(), and relay_cell_max_payload_size().
| #define RELAY_HEADER_SIZE_V1_NO_STREAM_ID (16+1+2) |
Number of bytes used for a relay cell's header, in the v1 format, if no StreamID is used.
Definition at line 566 of file or.h.
Referenced by relay_cell_max_payload_size().
| #define RELAY_HEADER_SIZE_V1_WITH_STREAM_ID (16+1+2+2) |
Number of bytes used for a relay cell's header, in the v1 format, if a StreamID is used.
Definition at line 569 of file or.h.
Referenced by relay_cell_max_payload_size().
| #define RELAY_PAYLOAD_SIZE_MAX (CELL_PAYLOAD_SIZE - RELAY_HEADER_SIZE_V0) |
Largest number of bytes that can fit in any relay cell payload.
Note that the actual maximum may be smaller if the V1 cell format is in use; see relay_cell_max_payload_size() for the real maximum.
Definition at line 576 of file or.h.
Referenced by check_created_cell(), circuit_read_valid_data(), circuit_send_intermediate_onion_skin(), circuit_sent_valid_data(), command_process_created_cell(), compute_introduce_mac(), conflux_send_switch_command(), connection_ap_handshake_send_begin(), connection_bucket_read_limit(), connection_bucket_write_limit(), connection_edge_end(), dumpstats(), extend_cell_format(), extend_cell_parse(), extended_cell_format(), extended_cell_parse(), flow_control_new_consensus_params(), hs_cell_build_establish_intro(), hs_cell_build_introduce1(), hs_cell_build_rendezvous1(), hs_circ_send_establish_rendezvous(), hs_circ_send_introduce1(), hs_circ_service_rp_has_opened(), introduce1_encrypt_and_encode(), log_heartbeat(), pathbias_send_usable_probe(), relay_msg_copy(), resolved_cell_parse(), send_establish_intro(), and send_resolved_hostname_cell().
| #define RELAY_PAYLOAD_SIZE_MIN (CELL_PAYLOAD_SIZE - RELAY_HEADER_SIZE_V1_WITH_STREAM_ID) |
Smallest capacity of any relay cell payload.
Definition at line 579 of file or.h.
Referenced by flow_control_decide_xoff(), flow_control_new_consensus_params(), and send_resolved_cell().
| #define REND_CLIENTNAME_MAX_LEN 16 |
Maximum length of authorized client names for a hidden service.
Definition at line 401 of file or.h.
Referenced by handle_control_onion_client_auth_add().
| #define REND_COOKIE_LEN DIGEST_LEN |
Length of the rendezvous cookie that is used to connect circuits at the rendezvous point.
Definition at line 405 of file or.h.
Referenced by hs_circ_service_rp_has_opened(), introduce1_set_encrypted(), launch_rendezvous_point_circuit(), rend_mid_establish_rendezvous(), rend_mid_rendezvous(), and service_rendezvous_circ_has_opened().
| #define REND_DESC_ID_V2_LEN_BASE32 BASE32_DIGEST_LEN |
Length of v2 descriptor ID (32 base32 chars = 160 bits).
XXX: It is still used by v3 code but should be renamed or maybe removed.
Definition at line 398 of file or.h.
Referenced by hs_purge_hid_serv_from_last_hid_serv_requests().
| #define REND_REPLAY_TIME_INTERVAL (5 * 60) |
Time interval for tracking replays of DH public keys received in INTRODUCE2 cells. Used only to avoid launching multiple simultaneous attempts to connect to the same rendezvous point.
Definition at line 424 of file or.h.
Referenced by hs_service_new().
| #define REND_TOKEN_LEN DIGEST_LEN |
| #define ROUTER_ANNOTATION_BUF_LEN 256 |
The max size we expect router descriptor annotations we create to be. We'll accept larger ones if we see them on disk, but we won't create any that are larger than this.
Definition at line 777 of file or.h.
Referenced by dirserv_add_multiple_descriptors(), and router_load_single_router().
| #define ROUTER_MAX_AGE (60*60*48) |
How old do we allow a router to get before removing it from the router list? In seconds.
Definition at line 158 of file or.h.
Referenced by routerlist_remove_old_routers().
| #define ROUTER_MAX_AGE_TO_PUBLISH (60*60*24) |
How old can a router get before we (as a server) will no longer consider it live? In seconds.
Definition at line 161 of file or.h.
Referenced by authdir_wants_to_reject_router(), controller_get_routerdescs(), dirserv_generate_networkstatus_vote_obj(), handle_get_descriptor(), networkstatus_getinfo_by_purpose(), and router_is_active().
| #define saved_location_bitfield_t ENUM_BF(saved_location_t) |
| #define SENDME_TAG_LEN_CGO 16 |
Length for authenticated sendme tag with cgo encryption.
Definition at line 461 of file or.h.
Referenced by cgo_crypt_client_backward(), cgo_crypt_client_forward(), cgo_crypt_client_originate(), cgo_crypt_new(), cgo_crypt_relay_backward(), cgo_crypt_relay_forward(), cgo_crypt_relay_originate(), cgo_key_material_len(), relay_crypto_get_sendme_tag(), relay_crypto_sendme_tag_len(), relay_encrypt_cell_inbound(), and tag_len_ok().
| #define SENDME_TAG_LEN_TOR1 20 |
Length for authenticated sendme tag with tor1 encryption.
Definition at line 459 of file or.h.
Referenced by relay_crypto_get_sendme_tag(), relay_crypto_sendme_tag_len(), and tag_len_ok().
| #define SESSION_GROUP_CONTROL_RESOLVE -3 |
Session group reserved for resolve requests launched by a controller
Definition at line 985 of file or.h.
Referenced by dnsserv_launch_request().
| #define SESSION_GROUP_DIRCONN -2 |
Session group reserved for directory connections
Definition at line 983 of file or.h.
Referenced by directory_initiate_request().
| #define SESSION_GROUP_FIRST_AUTO -4 |
First automatically allocated session group number
Definition at line 987 of file or.h.
Referenced by connection_listener_new().
| #define SESSION_GROUP_UNSET -1 |
Indicates that we haven't yet set a session group on a port_cfg_t.
Definition at line 981 of file or.h.
Referenced by port_cfg_new().
| #define SOCKS4_NETWORK_LEN 8 |
Number of bytes in a SOCKS4 header.
Definition at line 509 of file or.h.
Referenced by connection_ap_handshake_socks_reply(), connection_ap_handshake_socks_resolved(), and handle_socks_message().
| #define STREAMWINDOW_INCREMENT 50 |
Amount to increment a stream window when we get a stream SENDME.
Definition at line 456 of file or.h.
Referenced by connection_half_edge_add(), and sendme_connection_edge_consider_sending().
| #define STREAMWINDOW_START 500 |
Initial value on both sides of a stream transmission window when the stream is initialized. Measured in cells.
Definition at line 453 of file or.h.
Referenced by connection_ap_handshake_send_begin(), connection_exit_begin_conn(), connection_half_edge_add(), and sendme_connection_edge_consider_sending().
| #define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) |
How long to test reachability before complaining to the user.
Definition at line 499 of file or.h.
Referenced by check_for_reachability_bw_callback(), inform_testing_reachability(), and reachability_warnings_callback().
| #define TO_CIRCUIT | ( | x | ) |
Convert a circuit subtype to a circuit_t.
Definition at line 951 of file or.h.
Referenced by can_relaunch_service_rendezvous_point(), choose_good_exit_server(), circpad_add_matching_machines(), circpad_machine_conditions_apply(), circpad_machine_conditions_keep(), circpad_negotiate_padding(), circpad_send_command_to_hop(), circpad_shutdown_old_machines(), circuit_any_opened_circuits(), circuit_build_failed(), circuit_build_no_more_hops(), circuit_build_times_mark_circ_as_measurement_only(), circuit_clear_isolation(), circuit_describe_status_for_controller(), circuit_establish_circuit(), circuit_establish_circuit_conflux(), circuit_expire_waiting_for_better_guard(), circuit_extend_to_new_exit(), circuit_finish_handshake(), circuit_get_next_by_purpose(), circuit_get_next_intro_circ(), circuit_get_next_service_rp_circ(), circuit_has_opened(), circuit_is_acceptable(), circuit_is_better(), circuit_launch_by_extend_info(), circuit_log_ancient_one_hop_circuits(), circuit_mark_for_close_(), circuit_receive_relay_cell(), circuit_send_first_onion_skin(), circuit_send_intermediate_onion_skin(), circuit_set_p_circid_chan(), circuit_testing_opened(), circuit_truncated(), circuit_upgrade_circuits_from_guard_wait(), cleanup_intro_points(), client_intro_circ_has_opened(), client_rendezvous_circ_has_opened(), close_intro_circuits(), close_or_reextend_intro_circ(), close_service_rp_circuits(), command_process_create_cell(), conflux_add_guards_to_exclude_list(), conflux_add_middles_to_exclude_list(), conflux_circuit_has_opened(), conflux_launch_leg(), conflux_sync_circ_fields(), conflux_update_half_streams(), conflux_update_n_streams(), conflux_update_p_streams(), conflux_update_resolving_streams(), congestion_control_get_control_port_fields(), connection_ap_detach_retriable(), connection_ap_handshake_attach_chosen_circuit(), connection_ap_handshake_attach_circuit(), connection_exit_begin_resolve(), connection_exit_connect_dir(), consider_sending_introduce1(), count_opened_desc_intro_point_circuits(), cpuworker_onion_handshake_replyfn(), entry_guards_upgrade_waiting_circuits(), finalize_rend_circuit(), get_unique_stream_id_by_circ(), guards_choose_guard(), handle_control_closecircuit(), handle_control_extendcircuit(), handle_control_setcircuitpurpose(), handle_establish_intro(), handle_introduce1(), handle_introduce_ack_bad(), handle_introduce_ack_success(), handle_rendezvous2(), handle_verified_establish_intro_cell(), hs_cell_parse_introduce2(), hs_circ_handle_intro_established(), hs_circ_is_rend_sent_in_intro1(), hs_circ_retry_service_rendezvous_point(), hs_circ_send_establish_rendezvous(), hs_circ_send_introduce1(), hs_circ_service_get_established_intro_circ(), hs_circ_service_intro_has_opened(), hs_circ_service_rp_has_opened(), hs_circ_setup_congestion_control(), hs_circuit_setup_e2e_rend_circ(), hs_circuitmap_register_intro_circ_v3_relay_side(), hs_circuitmap_register_intro_circ_v3_service_side(), hs_circuitmap_register_rend_circ_client_side(), hs_circuitmap_register_rend_circ_relay_side(), hs_circuitmap_register_rend_circ_service_side(), hs_client_circuit_has_opened(), hs_client_close_intro_circuits_from_desc(), hs_client_receive_introduce_ack(), hs_client_receive_rendezvous2(), hs_client_receive_rendezvous_acked(), hs_client_reextend_intro_circuit(), hs_client_setup_intro_circ_auth_key(), hs_dos_can_send_intro2(), hs_intro_received_establish_intro(), hs_intro_received_introduce1(), hs_intro_send_intro_established_cell(), hs_service_circuit_has_opened(), hs_service_receive_intro_established(), hs_service_receive_introduce2(), hs_service_set_conn_addr_port(), intro_circ_is_ok(), launch_rendezvous_point_circuit(), link_apconn_to_circ(), mark_circuit_unusable_for_new_conns(), onion_pending_add(), onion_pick_cpath_exit(), onionskin_answer(), or_circuit_new(), origin_circuit_init(), origin_circuit_new(), parse_introduce2_cell(), parse_introduce2_encrypted(), relay_crypt_from_last_hop(), rend_mid_establish_rendezvous(), rend_mid_rendezvous(), retry_service_rendezvous_point(), router_perform_bandwidth_test(), send_establish_intro(), send_introduce1(), send_introduce_ack_cell(), service_handle_intro_established(), service_handle_introduce2(), service_intro_circ_has_opened(), and service_rendezvous_circ_has_opened().
| #define TO_CONN | ( | c | ) |
Cast a connection_t subtype pointer to a connection_t
Definition at line 709 of file or.h.
Referenced by channel_tls_describe_peer_method(), channel_tls_describe_transport_method(), channel_tls_get_remote_addr_method(), channel_tls_handle_cell(), channel_tls_handle_incoming(), channel_tls_handle_var_cell(), channel_tls_has_queued_writes_method(), channel_tls_matches_extend_info_method(), channel_tls_matches_target_method(), channel_tls_num_bytes_queued_method(), channel_tls_num_cells_writeable_method(), channel_tls_process_auth_challenge_cell(), channel_tls_process_authenticate_cell(), channel_tls_process_certs_cell(), channel_tls_process_netinfo_cell(), channel_tls_process_versions_cell(), channel_tls_update_marks(), channel_tls_write_packed_cell_method(), channelpadding_send_padding_callback(), circuit_about_to_free(), circuit_consider_stop_edge_reading(), circuit_dump_by_conn(), circuit_free_all(), circuit_get_streams_max_data_age(), circuit_log_ancient_one_hop_circuits(), circuit_process_stream_xoff(), circuit_process_stream_xon(), circuit_resume_edge_reading_helper(), circuit_send_stream_xoff(), circuit_send_stream_xon(), client_dir_fetch_200(), client_dir_fetch_unexpected(), connection_ap_about_to_close(), connection_ap_handshake_send_begin(), connection_ap_handshake_send_resolve(), connection_control_process_inbuf(), connection_control_reached_eof(), connection_dir_about_to_close(), connection_dir_buf_add(), connection_dir_client_reached_eof(), connection_dir_client_refetch_hsdesc_if_needed(), connection_dir_client_request_failed(), connection_dir_finished_connecting(), connection_dir_finished_flushing(), connection_dir_is_anonymous(), connection_dir_is_encrypted(), connection_dir_process_inbuf(), connection_dir_reached_eof(), connection_dir_used_obsolete_sendme(), connection_dirserv_flushed_some(), connection_dns_remove(), connection_edge_about_to_close(), connection_edge_destroy(), connection_edge_end_close(), connection_edge_finished_connecting(), connection_edge_package_raw_inbuf(), connection_edge_process_inbuf(), connection_edge_process_ordered_relay_cell(), connection_edge_process_relay_cell_not_open(), connection_edge_reached_eof(), connection_edge_send_command(), connection_exit_about_to_close(), connection_exit_begin_conn(), connection_exit_begin_resolve(), connection_exit_connect(), connection_exit_connect_dir(), connection_ext_or_auth_process_inbuf(), connection_ext_or_finished_flushing(), connection_ext_or_process_inbuf(), connection_ext_or_start_auth(), connection_ext_or_transition(), connection_fetch_var_cell_from_buf(), connection_get_another_active_or_conn(), connection_init_accepted_conn(), connection_listener_new(), connection_new(), connection_or_about_to_close(), connection_or_client_learned_peer_id(), connection_or_close_for_error(), connection_or_close_normally(), connection_or_connect(), connection_or_finished_connecting(), connection_or_finished_flushing(), connection_or_flushed_some(), connection_or_get_state_description(), connection_or_group_set_badness_(), connection_or_notify_error(), connection_or_num_cells_writeable(), connection_or_process_cells_from_inbuf(), connection_or_process_inbuf(), connection_or_send_netinfo(), connection_or_set_identity_digest(), connection_or_set_state_open(), connection_or_single_set_badness_(), connection_or_write_cell_to_buf(), connection_or_write_var_cell_to_buf(), connection_printf_to_buf(), connection_tls_continue_handshake(), connection_tls_start_handshake(), connection_write_str_to_buf(), control_connection_add_local_fd(), control_connection_new(), control_event_bootstrap_prob_or(), control_protocol_is_valid(), control_send_http_reject(), control_send_v0_reject(), control_write_data(), dir_connection_new(), directory_handle_command(), directory_handle_command_post(), directory_initiate_request(), directory_send_command(), dns_cancel_pending_resolve(), dns_resolve(), dns_resolve_impl(), dnsserv_launch_request(), edge_connection_new(), enter_v3_handshake_with_cell(), evdns_server_callback(), flow_control_decide_xoff(), flow_control_decide_xon(), handle_control_authchallenge(), handle_control_authenticate(), handle_control_mapaddress(), handle_control_protocolinfo(), handle_control_signal(), handle_get_current_consensus(), handle_get_descriptor(), handle_get_frontpage(), handle_get_hs_descriptor_v3(), handle_get_keys(), handle_get_microdesc(), handle_get_networkstatus_bridges(), handle_get_robots(), handle_get_status_vote(), handle_hs_exit_conn(), handle_relay_msg(), handle_response_fetch_certificate(), handle_response_fetch_consensus(), handle_response_fetch_desc(), handle_response_fetch_detached_signatures(), handle_response_fetch_microdesc(), handle_response_fetch_status_vote(), handle_response_upload_dir(), handle_response_upload_hsdesc(), handle_response_upload_signatures(), handle_response_upload_vote(), hs_service_set_conn_addr_port(), hs_set_conn_addr_port(), inform_pending_connections(), listener_connection_new(), marked_circuit_streams_free_bytes(), or_connection_new(), process_sendme_cell(), purge_expired_resolves(), queued_events_flush_all(), sendme_connection_edge_consider_sending(), set_block_state_for_streams(), write_http_response_header_impl(), and write_short_http_response().
| #define UNNAMED_ROUTER_NICKNAME "Unnamed" |
Name chosen by routers that don't configure nicknames
Definition at line 506 of file or.h.
Referenced by node_get_by_nickname(), and options_validate_relay_info().
| #define V3_AUTH_BODY_LEN (V3_AUTH_FIXED_PART_LEN + 8 + 16) |
The length of the part of the AUTHENTICATE cell body that the client signs.
Definition at line 692 of file or.h.
Referenced by channel_tls_process_authenticate_cell().
| #define V3_AUTH_FIXED_PART_LEN (8+(32*6)) |
| #define VAR_CELL_MAX_HEADER_SIZE 7 |
Maximum length of a header on a variable-length cell.
Definition at line 535 of file or.h.
Referenced by connection_or_write_var_cell_to_buf(), fetch_var_cell_from_buf(), or_handshake_state_record_var_cell(), and var_cell_pack_header().
| typedef uint32_t circid_t |
| typedef enum path_state_t path_state_t |
| typedef uint16_t streamid_t |
Enumerates possible origins of a client-side address mapping.
| enum cell_direction_t |
| enum consensus_flavor_t |
| enum dirinfo_type_t |
Bitfield enum type listing types of information that directory authorities can be authoritative about, and that directory caches may or may not cache.
Note that the granularity here is based on authority granularity and on cache capabilities. Thus, one particular bit may correspond in practice to a few types of directory info, so long as every authority that pronounces officially about one of the types prounounces officially about all of them, and so long as every cache that caches one of them caches all of them.
| enum download_schedule_t |
Enumeration: is the download schedule for downloading from an authority, or from any available directory mirror? During bootstrap, "any" means a fallback (or an authority, if there are no fallbacks). When we have a valid consensus, "any" means any directory server.
| enum relay_cell_fmt_t |
| enum rend_auth_type_t |
| enum saved_location_t |
Enum used to remember where a signed_descriptor_t is stored and how to manage the memory for signed_descriptor_body.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Helper to learn if we know the relay command. Unfortuantely, they are not contigous and so we need this kind of big switch. We could do better but for now, we'll run with this.
Definition at line 230 of file or.h.
Referenced by decode_v1_cell().