14 #define HS_CIRCUITMAP_PRIVATE
21 #include "core/or/or_circuit_st.h"
37 const hs_token_t *first_token;
38 const hs_token_t *second_token;
43 first_token = first_circuit->
hs_token;
44 second_token = second_circuit->
hs_token;
47 if (BUG(!first_token) || BUG(!second_token)) {
51 if (first_token->type != second_token->type) {
55 if (first_token->token_len != second_token->token_len)
60 first_token->token_len);
66 static inline unsigned int
71 return (
unsigned) siphash24g(circuit->
hs_token->token,
81 HT_GENERATE2(hs_circuitmap_ht,
circuit_t, hs_circuitmap_node,
89 get_hs_circuitmap(
void)
101 const uint8_t *token)
105 hs_token_t *hs_token = tor_malloc_zero(
sizeof(hs_token_t));
106 hs_token->type = type;
107 hs_token->token_len = token_len;
108 hs_token->token = tor_memdup(token, token_len);
113 #define hs_token_free(val) \
114 FREE_AND_NULL(hs_token_t, hs_token_free_, (val))
136 search_circ.
hs_token = search_token;
163 circuit_mark_for_close(found_circ, END_CIRC_REASON_FINISHED);
178 hs_token_type_t type,
size_t token_len,
179 const uint8_t *token)
181 hs_token_t *hs_token = NULL;
199 const uint8_t *token,
200 uint8_t wanted_circ_purpose)
208 hs_token_t *search_hs_token =
hs_token_new(type, token_len, token);
211 hs_token_free(search_hs_token);
216 found_circ->
purpose != wanted_circ_purpose ||
231 const uint8_t *token,
232 uint8_t wanted_circ_purpose)
239 wanted_circ_purpose);
255 const uint8_t *token,
256 uint8_t wanted_circ_purpose)
263 wanted_circ_purpose);
293 circ->
hs_token->type != HS_TOKEN_INTRO_V3_RELAY_SIDE) {
320 REND_TOKEN_LEN, cookie,
330 const uint8_t *cookie)
333 HS_TOKEN_REND_RELAY_SIDE,
334 REND_TOKEN_LEN, cookie);
344 HS_TOKEN_INTRO_V3_RELAY_SIDE,
385 REND_TOKEN_LEN, cookie,
393 REND_TOKEN_LEN, cookie,
426 REND_TOKEN_LEN, cookie,
452 REND_TOKEN_LEN, cookie,
459 REND_TOKEN_LEN, cookie,
466 REND_TOKEN_LEN, cookie,
480 HS_TOKEN_INTRO_V3_SERVICE_SIDE,
488 const uint8_t *cookie)
491 HS_TOKEN_REND_SERVICE_SIDE,
492 REND_TOKEN_LEN, cookie);
499 const uint8_t *cookie)
507 REND_TOKEN_LEN, cookie);
530 log_warn(
LD_BUG,
"Could not find circuit (%u) in circuitmap.",
origin_circuit_t * TO_ORIGIN_CIRCUIT(circuit_t *x)
or_circuit_t * TO_OR_CIRCUIT(circuit_t *x)
Header file for circuitlist.c.
#define CIRCUIT_PURPOSE_S_CONNECT_REND
#define CIRCUIT_PURPOSE_REND_POINT_WAITING
#define CIRCUIT_IS_ORCIRC(c)
#define CIRCUIT_PURPOSE_IS_ORIGIN(p)
#define CIRCUIT_PURPOSE_C_REND_JOINED
#define CIRCUIT_PURPOSE_S_INTRO
#define CIRCUIT_PURPOSE_INTRO_POINT
#define CIRCUIT_IS_ORIGIN(c)
#define CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED
#define CIRCUIT_PURPOSE_S_REND_JOINED
#define CIRCUIT_PURPOSE_C_REND_READY
#define CIRCUIT_PURPOSE_S_ESTABLISH_INTRO
#define CIRCUIT_PURPOSE_C_ESTABLISH_REND
Header file for config.c.
int tor_memeq(const void *a, const void *b, size_t sz)
static circuit_t * get_circuit_with_token(hs_token_t *search_token)
or_circuit_t * hs_circuitmap_get_intro_circ_v3_relay_side(const ed25519_public_key_t *auth_key)
void hs_circuitmap_free_all(void)
void hs_circuitmap_remove_circuit(circuit_t *circ)
static int hs_circuits_have_same_token(const circuit_t *first_circuit, const circuit_t *second_circuit)
static unsigned int hs_circuit_hash_token(const circuit_t *circuit)
void hs_circuitmap_register_rend_circ_client_side(origin_circuit_t *or_circ, const uint8_t *cookie)
static hs_token_t * hs_token_new(hs_token_type_t type, size_t token_len, const uint8_t *token)
void hs_circuitmap_init(void)
origin_circuit_t * hs_circuitmap_get_intro_circ_v3_service_side(const ed25519_public_key_t *auth_key)
static void hs_circuitmap_register_circuit(circuit_t *circ, hs_token_type_t type, size_t token_len, const uint8_t *token)
or_circuit_t * hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie)
origin_circuit_t * hs_circuitmap_get_established_rend_circ_client_side(const uint8_t *cookie)
void hs_circuitmap_register_intro_circ_v3_service_side(origin_circuit_t *circ, const ed25519_public_key_t *auth_key)
static or_circuit_t * hs_circuitmap_get_or_circuit(hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
origin_circuit_t * hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie)
static struct hs_circuitmap_ht * the_hs_circuitmap
smartlist_t * hs_circuitmap_get_all_intro_circ_relay_side(void)
HT_PROTOTYPE(hs_circuitmap_ht, circuit_t, hs_circuitmap_node, hs_circuit_hash_token, hs_circuits_have_same_token)
static origin_circuit_t * hs_circuitmap_get_origin_circuit(hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
static circuit_t * hs_circuitmap_get_circuit_impl(hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
origin_circuit_t * hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie)
void hs_circuitmap_register_rend_circ_service_side(origin_circuit_t *circ, const uint8_t *cookie)
static void hs_token_free_(hs_token_t *hs_token)
void hs_circuitmap_register_rend_circ_relay_side(or_circuit_t *circ, const uint8_t *cookie)
static void hs_circuitmap_register_impl(circuit_t *circ, hs_token_t *token)
void hs_circuitmap_register_intro_circ_v3_relay_side(or_circuit_t *circ, const ed25519_public_key_t *auth_key)
Header file for hs_circuitmap.c.
void tor_free_(void *mem)
Master header file for Tor-specific functionality.
Origin circuit structure.
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
struct hs_token_t * hs_token
uint16_t marked_for_close
#define ED25519_PUBKEY_LEN