12 #ifndef TOR_CIRCUITLIST_H
13 #define TOR_CIRCUITLIST_H
21 #define CIRCUIT_STATE_BUILDING 0
23 #define CIRCUIT_STATE_ONIONSKIN_PENDING 1
26 #define CIRCUIT_STATE_CHAN_WAIT 2
30 #define CIRCUIT_STATE_GUARD_WAIT 3
32 #define CIRCUIT_STATE_OPEN 4
34 #define CIRCUIT_PURPOSE_MIN_ 1
37 #define CIRCUIT_PURPOSE_OR_MIN_ 1
39 #define CIRCUIT_PURPOSE_OR 1
42 #define CIRCUIT_PURPOSE_INTRO_POINT 2
45 #define CIRCUIT_PURPOSE_REND_POINT_WAITING 3
47 #define CIRCUIT_PURPOSE_REND_ESTABLISHED 4
48 #define CIRCUIT_PURPOSE_OR_MAX_ 4
70 #define CIRCUIT_PURPOSE_C_GENERAL 5
71 #define CIRCUIT_PURPOSE_C_HS_MIN_ 6
73 #define CIRCUIT_PURPOSE_C_INTRODUCING 6
76 #define CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT 7
79 #define CIRCUIT_PURPOSE_C_INTRODUCE_ACKED 8
81 #define CIRCUIT_PURPOSE_C_ESTABLISH_REND 9
83 #define CIRCUIT_PURPOSE_C_REND_READY 10
86 #define CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED 11
88 #define CIRCUIT_PURPOSE_C_REND_JOINED 12
90 #define CIRCUIT_PURPOSE_C_HSDIR_GET 13
91 #define CIRCUIT_PURPOSE_C_HS_MAX_ 13
93 #define CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT 14
95 #define CIRCUIT_PURPOSE_C_CIRCUIT_PADDING 15
96 #define CIRCUIT_PURPOSE_C_MAX_ 15
98 #define CIRCUIT_PURPOSE_S_HS_MIN_ 16
101 #define CIRCUIT_PURPOSE_S_ESTABLISH_INTRO 16
104 #define CIRCUIT_PURPOSE_S_INTRO 17
107 #define CIRCUIT_PURPOSE_S_CONNECT_REND 18
110 #define CIRCUIT_PURPOSE_S_REND_JOINED 19
112 #define CIRCUIT_PURPOSE_S_HSDIR_POST 20
113 #define CIRCUIT_PURPOSE_S_HS_MAX_ 20
118 #define CIRCUIT_PURPOSE_TESTING 21
121 #define CIRCUIT_PURPOSE_CONTROLLER 22
123 #define CIRCUIT_PURPOSE_PATH_BIAS_TESTING 23
131 #define CIRCUIT_PURPOSE_HS_VANGUARDS 24
133 #define CIRCUIT_PURPOSE_MAX_ 24
136 #define CIRCUIT_PURPOSE_UNKNOWN 255
140 #define CIRCUIT_PURPOSE_IS_ORIGIN(p) ((p)>CIRCUIT_PURPOSE_OR_MAX_)
143 #define CIRCUIT_PURPOSE_IS_CLIENT(p) \
144 ((p)> CIRCUIT_PURPOSE_OR_MAX_ && \
145 (p)<=CIRCUIT_PURPOSE_C_MAX_)
147 #define CIRCUIT_IS_ORIGIN(c) (CIRCUIT_PURPOSE_IS_ORIGIN((c)->purpose))
150 #define CIRCUIT_PURPOSE_IS_ESTABLISHED_REND(p) \
151 ((p) == CIRCUIT_PURPOSE_C_REND_JOINED || \
152 (p) == CIRCUIT_PURPOSE_S_REND_JOINED)
154 #define CIRCUIT_IS_ORCIRC(c) (((circuit_t *)(c))->magic == OR_CIRCUIT_MAGIC)
160 #define CIRCUIT_PURPOSE_COUNTS_TOWARDS_MAXPENDING(p) \
161 ((p) == CIRCUIT_PURPOSE_C_GENERAL || \
162 (p) == CIRCUIT_PURPOSE_C_HSDIR_GET)
211 bool want_client_circ);
221 int line,
const char *cfile));
230 #define circuit_mark_for_close(c, reason) \
231 circuit_mark_for_close_((c), (reason), __LINE__, SHORT_FILE__)
247 #define circuit_handle_free(h) \
248 FREE_AND_NULL(circuit_handle_t, circuit_handle_free_, (h))
250 #ifdef CIRCUITLIST_PRIVATE
252 #define circuit_free(circ) FREE_AND_NULL(circuit_t, circuit_free_, (circ))
STATIC uint32_t circuit_max_queued_item_age(const circuit_t *c, uint32_t now)
STATIC void circuit_free_(circuit_t *circ)
STATIC size_t n_cells_in_circ_queues(const circuit_t *c)
STATIC uint32_t circuit_max_queued_data_age(const circuit_t *c, uint32_t now)
STATIC uint32_t circuit_max_queued_cell_age(const circuit_t *c, uint32_t now)
const char * circuit_purpose_to_controller_hs_state_string(uint8_t purpose)
circuit_t * circuit_get_by_circid_channel_even_if_marked(circid_t circ_id, channel_t *chan)
void circuit_mark_for_close_(circuit_t *circ, int reason, int line, const char *cfile)
void circuit_close_all_marked(void)
int circuit_any_opened_circuits_cached(void)
void channel_note_destroy_pending(channel_t *chan, circid_t id)
origin_circuit_t * circuit_get_next_intro_circ(const origin_circuit_t *start, bool want_client_circ)
int circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan)
void circuit_synchronize_written_or_bandwidth(const circuit_t *c, circuit_channel_direction_t dir)
void circuit_set_n_circid_chan(circuit_t *circ, circid_t id, channel_t *chan)
or_circuit_t * TO_OR_CIRCUIT(circuit_t *)
circuit_t * circuit_get_by_circid_channel(circid_t circ_id, channel_t *chan)
void circuit_mark_all_dirty_circs_as_unusable(void)
origin_circuit_t * origin_circuit_new(void)
void circuit_clear_cpath(origin_circuit_t *circ)
void circuit_set_state(circuit_t *circ, uint8_t state)
void circuit_free_all(void)
origin_circuit_t * circuit_get_next_by_purpose(origin_circuit_t *start, uint8_t purpose)
circuit_t * circuit_get_by_edge_conn(edge_connection_t *conn)
origin_circuit_t * TO_ORIGIN_CIRCUIT(circuit_t *)
int circuit_get_cpath_opened_len(const origin_circuit_t *)
const char * circuit_purpose_to_string(uint8_t purpose)
void channel_mark_circid_unusable(channel_t *chan, circid_t id)
void circuit_dump_by_conn(connection_t *conn, int severity)
int circuit_any_opened_circuits(void)
const char * circuit_purpose_to_controller_string(uint8_t purpose)
int circuit_get_cpath_len(origin_circuit_t *circ)
smartlist_t * circuit_find_circuits_to_upgrade_from_guard_wait(void)
void channel_mark_circid_usable(channel_t *chan, circid_t id)
void circuit_set_p_circid_chan(or_circuit_t *circ, circid_t id, channel_t *chan)
void assert_circuit_ok(const circuit_t *c)
smartlist_t * circuit_get_global_list(void)
origin_circuit_t * circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info, int flags)
int circuit_count_pending_on_channel(channel_t *chan)
size_t circuits_handle_oom(size_t current_allocation)
void circuit_get_all_pending_on_channel(smartlist_t *out, channel_t *chan)
smartlist_t * circuit_get_global_origin_circuit_list(void)
int circuit_event_status(origin_circuit_t *circ, circuit_status_event_t tp, int reason_code)
crypt_path_t * circuit_get_cpath_hop(origin_circuit_t *circ, int hopnum)
time_t circuit_id_when_marked_unusable_on_channel(circid_t circ_id, channel_t *chan)
void circuit_cache_opened_circuit_state(int circuits_are_opened)
origin_circuit_t * circuit_get_next_service_rp_circ(origin_circuit_t *start)
void channel_note_destroy_not_pending(channel_t *chan, circid_t id)
const char * circuit_state_to_string(int state)
void circuit_clear_testing_cell_stats(circuit_t *circ)
void circuit_unlink_all_from_channel(channel_t *chan, int reason)
or_circuit_t * or_circuit_new(circid_t p_circ_id, channel_t *p_chan)
origin_circuit_t * circuit_get_by_global_id(uint32_t id)
void circuit_mark_all_unused_circs(void)
int32_t circuit_initial_package_window(void)
Macros for C weak-handle implementation.
Header file containing circuit and connection identifier data for the whole HS subsystem.
Header file for ocirc_event.c.
circuit_channel_direction_t
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)