Tor 0.4.9.1-alpha-dev
|
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 | relay_header_t |
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 | 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 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 |
#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.
#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).
#define BW_WEIGHT_SCALE 10000 |
#define CELL_MAX_NETWORK_SIZE 514 |
#define CELL_PAYLOAD_SIZE 509 |
#define CFG_AUTO_PORT 0xc4005e |
#define CIRCWINDOW_INCREMENT 100 |
#define CIRCWINDOW_START 1000 |
#define DEFAULT_ONION_KEY_GRACE_PERIOD_DAYS (7) |
#define DEFAULT_ONION_KEY_LIFETIME_DAYS (28) |
#define DEFAULT_ROUTE_LEN 3 |
#define DOWNCAST | ( | to, | |
ptr | |||
) | ((to*)SUBTYPE_P(ptr, to, base_)) |
#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 |
#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.
#define END_CIRC_REASON_MEASUREMENT_EXPIRED -3 |
#define END_CIRC_REASON_NOPATH -2 |
#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 |
#define END_STREAM_REASON_CANT_FETCH_ORIG_DEST 260 |
#define END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED 1024 |
#define END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED 2048 |
#define END_STREAM_REASON_FLAG_REMOTE 512 |
#define END_STREAM_REASON_HTTPPROTOCOL 263 |
#define END_STREAM_REASON_INVALID_NATD_DEST 261 |
#define END_STREAM_REASON_MASK 511 |
#define END_STREAM_REASON_NET_UNREACHABLE 258 |
#define END_STREAM_REASON_PRIVATE_ADDR 262 |
#define END_STREAM_REASON_SOCKSPROTOCOL 259 |
#define ENTRY_TO_CONN | ( | c | ) | (TO_CONN(ENTRY_TO_EDGE_CONN(c))) |
Cast a entry_connection_t subtype pointer to a connection_t
#define EXT_OR_CONN_ID_LEN DIGEST_LEN /* 20 */ |
#define IMPOSSIBLE_TO_DOWNLOAD 255 |
#define INTRO_POINT_LIFETIME_MAX_SECONDS (24*60*60) |
#define INTRO_POINT_LIFETIME_MIN_SECONDS (18*60*60) |
#define INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS (INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS * 2) |
#define INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS 16384 |
#define ISO_CLIENTPROTO (1u<<3) |
#define ISO_DEFAULT (ISO_CLIENTADDR|ISO_SOCKSAUTH|ISO_SESSIONGRP|ISO_NYM_EPOCH) |
#define ISO_DESTADDR (1u<<1) |
#define ISO_NYM_EPOCH (1u<<6) |
#define ISO_SESSIONGRP (1u<<5) |
#define ISO_SOCKSAUTH (1u<<2) |
#define ISO_STREAM (1u<<7) |
#define LEGAL_NICKNAME_CHARACTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
#define MAX_DESCRIPTOR_UPLOAD_SIZE 20000 |
#define MAX_EXTRAINFO_UPLOAD_SIZE 50000 |
#define MAX_HEADERS_SIZE 50000 |
#define MAX_HEX_NICKNAME_LEN (HEX_DIGEST_LEN+1) |
#define MAX_INTRO_POINT_CIRCUIT_RETRIES 3 |
#define MAX_INTRO_POINT_REACHABILITY_FAILURES 5 |
#define MAX_NICKNAME_LEN 19 |
#define MAX_ONION_KEY_LIFETIME_DAYS (90) |
#define MAX_RELAY_EARLY_CELLS_PER_CIRCUIT 8 |
#define MAX_SSL_KEY_LIFETIME_INTERNAL (2*60*60) |
#define MAX_VERBOSE_NICKNAME_LEN (1+HEX_DIGEST_LEN+1+MAX_NICKNAME_LEN) |
#define MIN_CIRCUITS_HANDLING_STREAM 2 |
#define MIN_ONION_KEY_GRACE_PERIOD_DAYS (1) |
#define MIN_ONION_KEY_LIFETIME_DAYS (1) |
#define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1) |
#define OLD_ROUTER_DESC_MAX_AGE (60*60*24*5) |
#define ONION_KEY_CONSENSUS_CHECK_INTERVAL (60*60) |
#define OR_AUTH_CHALLENGE_LEN 32 |
#define OR_CERT_TYPE_AUTH_1024 3 |
#define OR_CERT_TYPE_ID_1024 2 |
#define OR_CERT_TYPE_TLS_LINK 1 |
#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 (1+2+2+4+2) |
#define RELAY_PAYLOAD_SIZE (CELL_PAYLOAD_SIZE-RELAY_HEADER_SIZE) |
#define REND_CLIENTNAME_MAX_LEN 16 |
#define REND_COOKIE_LEN DIGEST_LEN |
#define REND_DESC_ID_V2_LEN_BASE32 BASE32_DIGEST_LEN |
#define REND_REPLAY_TIME_INTERVAL (5 * 60) |
#define REND_TOKEN_LEN DIGEST_LEN |
#define ROUTER_ANNOTATION_BUF_LEN 256 |
#define ROUTER_MAX_AGE (60*60*48) |
#define ROUTER_MAX_AGE_TO_PUBLISH (60*60*24) |
#define saved_location_bitfield_t ENUM_BF(saved_location_t) |
#define SESSION_GROUP_CONTROL_RESOLVE -3 |
#define SESSION_GROUP_DIRCONN -2 |
#define SESSION_GROUP_FIRST_AUTO -4 |
#define SESSION_GROUP_UNSET -1 |
Indicates that we haven't yet set a session group on a port_cfg_t.
#define SOCKS4_NETWORK_LEN 8 |
#define STREAMWINDOW_INCREMENT 50 |
#define STREAMWINDOW_START 500 |
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) |
#define TO_CIRCUIT | ( | x | ) | (&((x)->base_)) |
#define TO_CONN | ( | c | ) | (&(((c)->base_))) |
Cast a connection_t subtype pointer to a connection_t
#define UNNAMED_ROUTER_NICKNAME "Unnamed" |
#define V3_AUTH_BODY_LEN (V3_AUTH_FIXED_PART_LEN + 8 + 16) |
#define V3_AUTH_FIXED_PART_LEN (8+(32*6)) |
#define VAR_CELL_MAX_HEADER_SIZE 7 |
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 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 |