tor  0.4.2.1-alpha-dev
hs_circuitmap.h
Go to the documentation of this file.
1 /* Copyright (c) 2016-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #ifndef TOR_HS_CIRCUITMAP_H
10 #define TOR_HS_CIRCUITMAP_H
11 
12 typedef HT_HEAD(hs_circuitmap_ht, circuit_t) hs_circuitmap_ht;
13 
14 typedef struct hs_token_t hs_token_t;
15 struct or_circuit_t;
16 struct origin_circuit_t;
17 
22 struct or_circuit_t *
24  ed25519_public_key_t *auth_key);
25 struct or_circuit_t *
26 hs_circuitmap_get_intro_circ_v2_relay_side(const uint8_t *digest);
27 struct or_circuit_t *
28 hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie);
29 
31  const uint8_t *cookie);
32 void hs_circuitmap_register_intro_circ_v2_relay_side(struct or_circuit_t *circ,
33  const uint8_t *digest);
34 void hs_circuitmap_register_intro_circ_v3_relay_side(struct or_circuit_t *circ,
35  const ed25519_public_key_t *auth_key);
36 
37 smartlist_t *hs_circuitmap_get_all_intro_circ_relay_side(void);
38 
41 struct origin_circuit_t *
43  ed25519_public_key_t *auth_key);
44 struct origin_circuit_t *
45 hs_circuitmap_get_intro_circ_v2_service_side(const uint8_t *digest);
46 struct origin_circuit_t *
47 hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie);
48 struct origin_circuit_t *
49 hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie);
50 struct origin_circuit_t *
51 hs_circuitmap_get_established_rend_circ_client_side(const uint8_t *cookie);
52 
53 void hs_circuitmap_register_intro_circ_v2_service_side(
54  struct origin_circuit_t *circ,
55  const uint8_t *digest);
56 void hs_circuitmap_register_intro_circ_v3_service_side(
57  struct origin_circuit_t *circ,
58  const ed25519_public_key_t *auth_key);
59 void hs_circuitmap_register_rend_circ_service_side(
60  struct origin_circuit_t *circ,
61  const uint8_t *cookie);
62 void hs_circuitmap_register_rend_circ_client_side(
63  struct origin_circuit_t *circ,
64  const uint8_t *cookie);
65 
66 void hs_circuitmap_remove_circuit(struct circuit_t *circ);
67 
68 void hs_circuitmap_init(void);
69 void hs_circuitmap_free_all(void);
70 
71 #ifdef HS_CIRCUITMAP_PRIVATE
72 
74 typedef enum {
76  HS_TOKEN_REND_RELAY_SIDE,
78  HS_TOKEN_INTRO_V2_RELAY_SIDE,
80  HS_TOKEN_INTRO_V3_RELAY_SIDE,
81 
83  HS_TOKEN_REND_SERVICE_SIDE,
85  HS_TOKEN_INTRO_V2_SERVICE_SIDE,
87  HS_TOKEN_INTRO_V3_SERVICE_SIDE,
88 
90  HS_TOKEN_REND_CLIENT_SIDE,
91 } hs_token_type_t;
92 
95 struct hs_token_t {
96  /* Type of HS token. */
97  hs_token_type_t type;
98 
99  /* The size of the token (depends on the type). */
100  size_t token_len;
101 
102  /* The token itself. Memory allocated at runtime. */
103  uint8_t *token;
104 };
105 
106 #endif /* defined(HS_CIRCUITMAP_PRIVATE) */
107 
108 #ifdef TOR_UNIT_TESTS
109 
110 hs_circuitmap_ht *get_hs_circuitmap(void);
111 
112 #endif /* TOR_UNIT_TESTS */
113 
114 #endif /* !defined(TOR_HS_CIRCUITMAP_H) */
struct origin_circuit_t * hs_circuitmap_get_intro_circ_v3_service_side(const ed25519_public_key_t *auth_key)
void hs_circuitmap_remove_circuit(struct circuit_t *circ)
void hs_circuitmap_register_rend_circ_relay_side(struct or_circuit_t *circ, const uint8_t *cookie)
struct or_circuit_t * hs_circuitmap_get_intro_circ_v3_relay_side(const ed25519_public_key_t *auth_key)