Tor  0.4.7.0-alpha-dev
channeltls.h
Go to the documentation of this file.
1 /* * Copyright (c) 2012-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file channeltls.h
6  * \brief Header file for channeltls.c
7  **/
8 
9 #ifndef TOR_CHANNELTLS_H
10 #define TOR_CHANNELTLS_H
11 
12 #include "core/or/or.h"
13 #include "core/or/channel.h"
14 
17 
18 #define TLS_PER_CELL_OVERHEAD 29
19 
20 #define BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c)))
21 #define TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c)))
22 #define CONST_BASE_CHAN_TO_TLS(c) (channel_tls_from_base_const((c)))
23 #define CONST_TLS_CHAN_TO_BASE(c) (channel_tls_to_base_const((c)))
24 
25 #define TLS_CHAN_MAGIC 0x8a192427U
26 
27 #ifdef CHANNEL_OBJECT_PRIVATE
28 
29 struct channel_tls_t {
30  /* Base channel_t struct */
31  channel_t base_;
32  /* or_connection_t pointer */
33  or_connection_t *conn;
34 };
35 
36 #endif /* defined(CHANNEL_OBJECT_PRIVATE) */
37 
38 channel_t * channel_tls_connect(const tor_addr_t *addr, uint16_t port,
39  const char *id_digest,
40  const struct ed25519_public_key_t *ed_id);
44 
45 /* Casts */
46 
47 channel_t * channel_tls_to_base(channel_tls_t *tlschan);
48 channel_tls_t * channel_tls_from_base(channel_t *chan);
49 const channel_t * channel_tls_to_base_const(const channel_tls_t *tlschan);
50 const channel_tls_t * channel_tls_from_base_const(const channel_t *chan);
51 
52 /* Things for connection_or.c to call back into */
54 void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
55  or_connection_t *conn,
56  uint8_t state);
58  or_connection_t *conn);
60 
61 /* Cleanup at shutdown */
62 void channel_tls_free_all(void);
63 
64 extern uint64_t stats_n_authorize_cells_processed;
66 extern uint64_t stats_n_versions_cells_processed;
67 extern uint64_t stats_n_netinfo_cells_processed;
68 extern uint64_t stats_n_vpadding_cells_processed;
69 extern uint64_t stats_n_certs_cells_processed;
71 
72 #ifdef CHANNELTLS_PRIVATE
74  channel_tls_t *tlschan);
76  channel_tls_t *tlschan);
77 STATIC void channel_tls_common_init(channel_tls_t *tlschan);
79  channel_tls_t *tlschan);
80 #endif /* defined(CHANNELTLS_PRIVATE) */
81 
82 #endif /* !defined(TOR_CHANNELTLS_H) */
Header file for channel.c.
STATIC void channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2390
STATIC void channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2291
STATIC void channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2035
channel_t * channel_tls_connect(const tor_addr_t *addr, uint16_t port, const char *id_digest, const ed25519_public_key_t *ed_id)
Definition: channeltls.c:191
STATIC void channel_tls_common_init(channel_tls_t *tlschan)
Definition: channeltls.c:151
void channel_tls_free_all(void)
Definition: channeltls.c:297
void channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
Definition: channeltls.c:1182
channel_t * channel_tls_to_base(channel_tls_t *tlschan)
Definition: channeltls.c:396
const channel_t * channel_tls_to_base_const(const channel_tls_t *tlschan)
Definition: channeltls.c:421
void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, or_connection_t *conn, uint8_t state)
Definition: channeltls.c:963
channel_listener_t * channel_tls_get_listener(void)
Definition: channeltls.c:254
void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
Definition: channeltls.c:1066
uint64_t stats_n_certs_cells_processed
Definition: channeltls.c:89
uint64_t stats_n_auth_challenge_cells_processed
Definition: channeltls.c:91
const channel_tls_t * channel_tls_from_base_const(const channel_t *chan)
Definition: channeltls.c:431
void channel_tls_update_marks(or_connection_t *conn)
Definition: channeltls.c:1356
uint64_t stats_n_authorize_cells_processed
Definition: channeltls.c:95
uint64_t stats_n_versions_cells_processed
Definition: channeltls.c:83
channel_listener_t * channel_tls_start_listener(void)
Definition: channeltls.c:266
uint64_t stats_n_authenticate_cells_processed
Definition: channeltls.c:93
channel_tls_t * channel_tls_from_base(channel_t *chan)
Definition: channeltls.c:408
uint64_t stats_n_vpadding_cells_processed
Definition: channeltls.c:87
channel_t * channel_tls_handle_incoming(or_connection_t *orconn)
Definition: channeltls.c:329
uint64_t stats_n_netinfo_cells_processed
Definition: channeltls.c:85
Master header file for Tor-specific functionality.
Definition: cell_st.h:17
#define STATIC
Definition: testsupport.h:32