Tor  0.4.6.0-alpha-dev
channeltls.h
Go to the documentation of this file.
1 /* * Copyright (c) 2012-2020, 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) */
channel_tls_get_listener
channel_listener_t * channel_tls_get_listener(void)
Definition: channeltls.c:254
tor_addr_t
Definition: address.h:69
channel_tls_handle_state_change_on_orconn
void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, or_connection_t *conn, uint8_t state)
Definition: channeltls.c:963
channel.h
Header file for channel.c.
channel_tls_free_all
void channel_tls_free_all(void)
Definition: channeltls.c:297
channel_tls_handle_incoming
channel_t * channel_tls_handle_incoming(or_connection_t *orconn)
Definition: channeltls.c:329
stats_n_netinfo_cells_processed
uint64_t stats_n_netinfo_cells_processed
Definition: channeltls.c:85
or_connection_t
Definition: or_connection_st.h:22
channel_tls_process_authenticate_cell
STATIC void channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2390
channel_tls_connect
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
cell_t
Definition: cell_st.h:17
channel_tls_from_base_const
const channel_tls_t * channel_tls_from_base_const(const channel_t *chan)
Definition: channeltls.c:431
stats_n_vpadding_cells_processed
uint64_t stats_n_vpadding_cells_processed
Definition: channeltls.c:87
channel_tls_start_listener
channel_listener_t * channel_tls_start_listener(void)
Definition: channeltls.c:266
ed25519_public_key_t
Definition: crypto_ed25519.h:23
channel_tls_process_auth_challenge_cell
STATIC void channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2291
stats_n_authorize_cells_processed
uint64_t stats_n_authorize_cells_processed
Definition: channeltls.c:95
channel_t
Definition: channel.h:181
channel_tls_handle_cell
void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
Definition: channeltls.c:1066
channel_tls_to_base
channel_t * channel_tls_to_base(channel_tls_t *tlschan)
Definition: channeltls.c:396
stats_n_auth_challenge_cells_processed
uint64_t stats_n_auth_challenge_cells_processed
Definition: channeltls.c:91
channel_tls_common_init
STATIC void channel_tls_common_init(channel_tls_t *tlschan)
Definition: channeltls.c:151
curve25519_public_key_t
Definition: crypto_curve25519.h:24
stats_n_versions_cells_processed
uint64_t stats_n_versions_cells_processed
Definition: channeltls.c:83
channel_tls_update_marks
void channel_tls_update_marks(or_connection_t *conn)
Definition: channeltls.c:1356
channel_listener_t
Definition: channel.h:461
channel_tls_handle_var_cell
void channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
Definition: channeltls.c:1182
channel_tls_from_base
channel_tls_t * channel_tls_from_base(channel_t *chan)
Definition: channeltls.c:408
channel_tls_process_certs_cell
STATIC void channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2035
stats_n_authenticate_cells_processed
uint64_t stats_n_authenticate_cells_processed
Definition: channeltls.c:93
STATIC
#define STATIC
Definition: testsupport.h:32
var_cell_t
Definition: var_cell_st.h:16
channel_tls_to_base_const
const channel_t * channel_tls_to_base_const(const channel_tls_t *tlschan)
Definition: channeltls.c:421
or.h
Master header file for Tor-specific functionality.
stats_n_certs_cells_processed
uint64_t stats_n_certs_cells_processed
Definition: channeltls.c:89