Tor  0.4.3.0-alpha-dev
channeltls.h
Go to the documentation of this file.
1 /* * Copyright (c) 2012-2019, 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 
23 #define TLS_CHAN_MAGIC 0x8a192427U
24 
25 #ifdef TOR_CHANNEL_INTERNAL_
26 
27 struct channel_tls_s {
28  /* Base channel_t struct */
29  channel_t base_;
30  /* or_connection_t pointer */
31  or_connection_t *conn;
32 };
33 
34 #endif /* defined(TOR_CHANNEL_INTERNAL_) */
35 
36 channel_t * channel_tls_connect(const tor_addr_t *addr, uint16_t port,
37  const char *id_digest,
38  const struct ed25519_public_key_t *ed_id);
39 channel_listener_t * channel_tls_get_listener(void);
40 channel_listener_t * channel_tls_start_listener(void);
41 channel_t * channel_tls_handle_incoming(or_connection_t *orconn);
42 
43 /* Casts */
44 
45 channel_t * channel_tls_to_base(channel_tls_t *tlschan);
46 channel_tls_t * channel_tls_from_base(channel_t *chan);
47 
48 /* Things for connection_or.c to call back into */
50 void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
51  or_connection_t *conn,
52  uint8_t state);
54  or_connection_t *conn);
56 
57 /* Cleanup at shutdown */
58 void channel_tls_free_all(void);
59 
60 extern uint64_t stats_n_authorize_cells_processed;
62 extern uint64_t stats_n_versions_cells_processed;
63 extern uint64_t stats_n_netinfo_cells_processed;
64 extern uint64_t stats_n_vpadding_cells_processed;
65 extern uint64_t stats_n_certs_cells_processed;
67 
68 #ifdef CHANNELTLS_PRIVATE
70  channel_tls_t *tlschan);
72  channel_tls_t *tlschan);
73 STATIC void channel_tls_common_init(channel_tls_t *tlschan);
75  channel_tls_t *tlschan);
76 #endif /* defined(CHANNELTLS_PRIVATE) */
77 
78 #endif /* !defined(TOR_CHANNELTLS_H) */
channel_listener_t * channel_tls_get_listener(void)
Definition: channeltls.c:252
void channel_tls_free_all(void)
Definition: channeltls.c:295
Definition: cell_st.h:17
void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, or_connection_t *conn, uint8_t state)
Definition: channeltls.c:951
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:189
channel_t * channel_tls_handle_incoming(or_connection_t *orconn)
Definition: channeltls.c:327
STATIC void channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2323
uint64_t stats_n_netinfo_cells_processed
Definition: channeltls.c:82
#define STATIC
Definition: testsupport.h:32
uint64_t stats_n_vpadding_cells_processed
Definition: channeltls.c:84
Header file for channel.c.
Master header file for Tor-specific functionality.
STATIC void channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:2222
channel_listener_t * channel_tls_start_listener(void)
Definition: channeltls.c:264
uint64_t stats_n_authorize_cells_processed
Definition: channeltls.c:92
channel_t * channel_tls_to_base(channel_tls_t *tlschan)
Definition: channeltls.c:369
void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
Definition: channeltls.c:1054
uint64_t stats_n_auth_challenge_cells_processed
Definition: channeltls.c:88
STATIC void channel_tls_common_init(channel_tls_t *tlschan)
Definition: channeltls.c:149
STATIC void channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
Definition: channeltls.c:1963
void channel_tls_update_marks(or_connection_t *conn)
Definition: channeltls.c:1345
uint64_t stats_n_authenticate_cells_processed
Definition: channeltls.c:90
uint64_t stats_n_versions_cells_processed
Definition: channeltls.c:80
void channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
Definition: channeltls.c:1170
channel_tls_t * channel_tls_from_base(channel_t *chan)
Definition: channeltls.c:381
uint64_t stats_n_certs_cells_processed
Definition: channeltls.c:86