tor  0.4.2.0-alpha-dev
Macros | Functions | Variables
hs_circuitmap.c File Reference
#include "core/or/or.h"
#include "app/config/config.h"
#include "core/or/circuitlist.h"
#include "feature/hs/hs_circuitmap.h"
#include "core/or/or_circuit_st.h"
#include "core/or/origin_circuit_st.h"

Go to the source code of this file.

Macros

#define HS_CIRCUITMAP_PRIVATE
 
#define hs_token_free(val)   FREE_AND_NULL(hs_token_t, hs_token_free_, (val))
 

Functions

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)
 
 HT_PROTOTYPE (HT_GENERATE2(hs_circuitmap_ht, HT_GENERATE2(circuit_t, HT_GENERATE2(hs_circuitmap_node, HT_GENERATE2(hs_circuit_hash_token, HT_GENERATE2(hs_circuits_have_same_token)
 
static void hs_token_free_ (hs_token_t *hs_token)
 
static circuit_tget_circuit_with_token (hs_token_t *search_token)
 
static void hs_circuitmap_register_impl (circuit_t *circ, hs_token_t *token)
 
static void hs_circuitmap_register_circuit (circuit_t *circ, hs_token_type_t type, size_t token_len, const uint8_t *token)
 
static circuit_ths_circuitmap_get_circuit_impl (hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
 
static origin_circuit_ths_circuitmap_get_origin_circuit (hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
 
static or_circuit_ths_circuitmap_get_or_circuit (hs_token_type_t type, size_t token_len, const uint8_t *token, uint8_t wanted_circ_purpose)
 
smartlist_ths_circuitmap_get_all_intro_circ_relay_side (void)
 
or_circuit_ths_circuitmap_get_intro_circ_v3_relay_side (const ed25519_public_key_t *auth_key)
 
or_circuit_ths_circuitmap_get_intro_circ_v2_relay_side (const uint8_t *digest)
 
or_circuit_ths_circuitmap_get_rend_circ_relay_side (const uint8_t *cookie)
 
void hs_circuitmap_register_rend_circ_relay_side (or_circuit_t *circ, const uint8_t *cookie)
 
void hs_circuitmap_register_intro_circ_v2_relay_side (or_circuit_t *circ, const uint8_t *digest)
 
void hs_circuitmap_register_intro_circ_v3_relay_side (or_circuit_t *circ, const ed25519_public_key_t *auth_key)
 
origin_circuit_ths_circuitmap_get_intro_circ_v3_service_side (const ed25519_public_key_t *auth_key)
 
origin_circuit_ths_circuitmap_get_intro_circ_v2_service_side (const uint8_t *digest)
 
origin_circuit_ths_circuitmap_get_rend_circ_service_side (const uint8_t *cookie)
 
origin_circuit_ths_circuitmap_get_rend_circ_client_side (const uint8_t *cookie)
 
origin_circuit_ths_circuitmap_get_established_rend_circ_client_side (const uint8_t *cookie)
 
void hs_circuitmap_register_intro_circ_v2_service_side (origin_circuit_t *circ, const uint8_t *digest)
 
void hs_circuitmap_register_intro_circ_v3_service_side (origin_circuit_t *circ, const ed25519_public_key_t *auth_key)
 
void hs_circuitmap_register_rend_circ_service_side (origin_circuit_t *circ, const uint8_t *cookie)
 
void hs_circuitmap_register_rend_circ_client_side (origin_circuit_t *or_circ, const uint8_t *cookie)
 
void hs_circuitmap_remove_circuit (circuit_t *circ)
 
void hs_circuitmap_init (void)
 
void hs_circuitmap_free_all (void)
 

Variables

static struct hs_circuitmap_ht * the_hs_circuitmap = NULL
 

Detailed Description

Hidden service circuitmap: A hash table that maps binary tokens to introduction and rendezvous circuits; it's used: (a) by relays acting as intro points and rendezvous points (b) by hidden services to find intro and rend circuits and (c) by HS clients to find rendezvous circuits.

Definition in file hs_circuitmap.c.

Function Documentation

◆ get_circuit_with_token()

static circuit_t* get_circuit_with_token ( hs_token_t *  search_token)
static

Return the circuit from the circuitmap with token search_token.

Definition at line 129 of file hs_circuitmap.c.

References tor_assert().

◆ hs_circuitmap_get_intro_circ_v3_relay_side()

or_circuit_t* hs_circuitmap_get_intro_circ_v3_relay_side ( const ed25519_public_key_t auth_key)

Public HS circuitmap API: Public relay-side API:

Definition at line 306 of file hs_circuitmap.c.

◆ hs_circuitmap_get_intro_circ_v3_service_side()

origin_circuit_t* hs_circuitmap_get_intro_circ_v3_service_side ( const ed25519_public_key_t auth_key)

Public service-side API:

Definition at line 374 of file hs_circuitmap.c.

◆ hs_circuitmap_register_circuit()

static void hs_circuitmap_register_circuit ( circuit_t circ,
hs_token_type_t  type,
size_t  token_len,
const uint8_t *  token 
)
static

Helper function: Register circ of type on the HS circuitmap. Use the HS token as the key to the hash table. If token is not set, clear the circuit of any HS tokens.

Definition at line 176 of file hs_circuitmap.c.

Referenced by hs_circuitmap_register_rend_circ_relay_side().

◆ hs_circuitmap_register_rend_circ_relay_side()

void hs_circuitmap_register_rend_circ_relay_side ( or_circuit_t circ,
const uint8_t *  cookie 
)

Public relay-side setters:

Definition at line 339 of file hs_circuitmap.c.

References hs_circuitmap_register_circuit(), and TO_CIRCUIT.

◆ hs_circuitmap_remove_circuit()

void hs_circuitmap_remove_circuit ( circuit_t circ)

Public function: Remove this circuit from the HS circuitmap. Clear its HS token, and remove it from the hashtable.

Definition at line 570 of file hs_circuitmap.c.

References tor_assert().

◆ hs_token_free_()

static void hs_token_free_ ( hs_token_t *  hs_token)
static

Free memory allocated by this hs_token.

Definition at line 117 of file hs_circuitmap.c.

References tor_free.