Tor  0.4.7.0-alpha-dev
hs_circuitmap.h
Go to the documentation of this file.
1 /* Copyright (c) 2016-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file hs_circuitmap.h
6  * \brief Header file for hs_circuitmap.c.
7  **/
8 
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;
18 
19 /** Public HS circuitmap API: */
20 
21 /** Public relay-side API: */
22 
23 struct or_circuit_t *
25  struct ed25519_public_key_t *auth_key);
26 struct or_circuit_t *
27 hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie);
28 
30  const uint8_t *cookie);
32  const struct ed25519_public_key_t *auth_key);
33 
35 
36 /** Public service-side API: */
37 
38 struct origin_circuit_t *
40  struct ed25519_public_key_t *auth_key);
41 struct origin_circuit_t *
42 hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie);
43 struct origin_circuit_t *
44 hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie);
45 struct origin_circuit_t *
47 
49  struct origin_circuit_t *circ,
50  const struct ed25519_public_key_t *auth_key);
52  struct origin_circuit_t *circ,
53  const uint8_t *cookie);
55  struct origin_circuit_t *circ,
56  const uint8_t *cookie);
57 
58 void hs_circuitmap_remove_circuit(struct circuit_t *circ);
59 
60 void hs_circuitmap_init(void);
61 void hs_circuitmap_free_all(void);
62 
63 #ifdef HS_CIRCUITMAP_PRIVATE
64 
65 /** Represents the type of HS token. */
66 typedef enum {
67  /** A rendezvous cookie on a relay (128bit)*/
68  HS_TOKEN_REND_RELAY_SIDE,
69  /** A v3 introduction point pubkey on a relay (256bit) */
70  HS_TOKEN_INTRO_V3_RELAY_SIDE,
71 
72  /** A rendezvous cookie on a hidden service (128bit)*/
73  HS_TOKEN_REND_SERVICE_SIDE,
74  /** A v3 introduction point pubkey on a hidden service (256bit) */
75  HS_TOKEN_INTRO_V3_SERVICE_SIDE,
76 
77  /** A rendezvous cookie on the client side (128bit) */
78  HS_TOKEN_REND_CLIENT_SIDE,
79 } hs_token_type_t;
80 
81 /** Represents a token used in the HS protocol. Each such token maps to a
82  * specific introduction or rendezvous circuit. */
83 struct hs_token_t {
84  /* Type of HS token. */
85  hs_token_type_t type;
86 
87  /* The size of the token (depends on the type). */
88  size_t token_len;
89 
90  /* The token itself. Memory allocated at runtime. */
91  uint8_t *token;
92 };
93 
94 #endif /* defined(HS_CIRCUITMAP_PRIVATE) */
95 
96 #ifdef TOR_UNIT_TESTS
97 
98 hs_circuitmap_ht *get_hs_circuitmap(void);
99 
100 #endif /* TOR_UNIT_TESTS */
101 
102 #endif /* !defined(TOR_HS_CIRCUITMAP_H) */
void hs_circuitmap_register_intro_circ_v3_service_side(origin_circuit_t *circ, const ed25519_public_key_t *auth_key)
void hs_circuitmap_register_intro_circ_v3_relay_side(or_circuit_t *circ, const ed25519_public_key_t *auth_key)
struct or_circuit_t * hs_circuitmap_get_intro_circ_v3_relay_side(const struct ed25519_public_key_t *auth_key)
void hs_circuitmap_free_all(void)
struct origin_circuit_t * hs_circuitmap_get_established_rend_circ_client_side(const uint8_t *cookie)
struct or_circuit_t * hs_circuitmap_get_rend_circ_relay_side(const uint8_t *cookie)
void hs_circuitmap_init(void)
struct origin_circuit_t * hs_circuitmap_get_rend_circ_service_side(const uint8_t *cookie)
smartlist_t * hs_circuitmap_get_all_intro_circ_relay_side(void)
void hs_circuitmap_register_rend_circ_client_side(struct origin_circuit_t *circ, const uint8_t *cookie)
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 origin_circuit_t * hs_circuitmap_get_rend_circ_client_side(const uint8_t *cookie)
struct origin_circuit_t * hs_circuitmap_get_intro_circ_v3_service_side(const struct ed25519_public_key_t *auth_key)
void hs_circuitmap_register_rend_circ_service_side(struct origin_circuit_t *circ, const uint8_t *cookie)
typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht