Tor 0.4.9.1-alpha-dev
|
Header file for channeltls.c. More...
Go to the source code of this file.
Macros | |
#define | TLS_PER_CELL_OVERHEAD 29 |
#define | BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c))) |
#define | TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c))) |
#define | CONST_BASE_CHAN_TO_TLS(c) (channel_tls_from_base_const((c))) |
#define | CONST_TLS_CHAN_TO_BASE(c) (channel_tls_to_base_const((c))) |
#define | TLS_CHAN_MAGIC 0x8a192427U |
Functions | |
channel_t * | channel_tls_connect (const tor_addr_t *addr, uint16_t port, const char *id_digest, const struct ed25519_public_key_t *ed_id) |
channel_listener_t * | channel_tls_get_listener (void) |
channel_listener_t * | channel_tls_start_listener (void) |
channel_t * | channel_tls_handle_incoming (or_connection_t *orconn) |
channel_t * | channel_tls_to_base (channel_tls_t *tlschan) |
channel_tls_t * | channel_tls_from_base (channel_t *chan) |
const channel_t * | channel_tls_to_base_const (const channel_tls_t *tlschan) |
const channel_tls_t * | channel_tls_from_base_const (const channel_t *chan) |
void | channel_tls_handle_cell (cell_t *cell, or_connection_t *conn) |
void | channel_tls_handle_state_change_on_orconn (channel_tls_t *chan, or_connection_t *conn, uint8_t state) |
void | channel_tls_handle_var_cell (var_cell_t *var_cell, or_connection_t *conn) |
void | channel_tls_update_marks (or_connection_t *conn) |
void | channel_tls_free_all (void) |
Variables | |
uint64_t | stats_n_authorize_cells_processed |
uint64_t | stats_n_authenticate_cells_processed |
uint64_t | stats_n_versions_cells_processed |
uint64_t | stats_n_netinfo_cells_processed |
uint64_t | stats_n_vpadding_cells_processed |
uint64_t | stats_n_certs_cells_processed |
uint64_t | stats_n_auth_challenge_cells_processed |
Header file for channeltls.c.
Definition in file channeltls.h.
#define BASE_CHAN_TO_TLS | ( | c | ) | (channel_tls_from_base((c))) |
Definition at line 20 of file channeltls.h.
#define CONST_BASE_CHAN_TO_TLS | ( | c | ) | (channel_tls_from_base_const((c))) |
Definition at line 22 of file channeltls.h.
#define CONST_TLS_CHAN_TO_BASE | ( | c | ) | (channel_tls_to_base_const((c))) |
Definition at line 23 of file channeltls.h.
#define TLS_CHAN_MAGIC 0x8a192427U |
Definition at line 25 of file channeltls.h.
#define TLS_CHAN_TO_BASE | ( | c | ) | (channel_tls_to_base((c))) |
Definition at line 21 of file channeltls.h.
#define TLS_PER_CELL_OVERHEAD 29 |
Definition at line 18 of file channeltls.h.
void channel_tls_free_all | ( | void | ) |
Free everything on shutdown.
Not much to do here, since channel_free_all() takes care of a lot, but let's get rid of the listener.
Definition at line 300 of file channeltls.c.
channel_tls_t * channel_tls_from_base | ( | channel_t * | chan | ) |
Cast a channel_t to a channel_tls_t, with appropriate type-checking asserts.
Definition at line 425 of file channeltls.c.
Referenced by channel_tls_from_base_const().
const channel_tls_t * channel_tls_from_base_const | ( | const channel_t * | chan | ) |
Cast a const channel_t to a const channel_tls_t, with appropriate type-checking asserts.
Definition at line 448 of file channeltls.c.
channel_listener_t * channel_tls_get_listener | ( | void | ) |
Return the current channel_tls_t listener.
Returns the current channel listener for incoming TLS connections, or NULL if none has been established
Definition at line 257 of file channeltls.c.
Referenced by connection_tls_start_handshake().
void channel_tls_handle_cell | ( | cell_t * | cell, |
or_connection_t * | conn | ||
) |
Handle an incoming cell on a channel_tls_t.
This is called from connection_or.c to handle an arriving cell; it checks for cell types specific to the handshake for this transport protocol and handles them, and queues all other cells to the channel_t layer, which eventually will hand them off to command.c.
The channel layer itself decides whether the cell should be queued or can be handed off immediately to the upper-layer code. It is responsible for copying in the case that it queues; we merely pass pointers through which we get from connection_or_process_cells_from_inbuf().
Definition at line 1083 of file channeltls.c.
channel_t * channel_tls_handle_incoming | ( | or_connection_t * | orconn | ) |
Create a new channel around an incoming or_connection_t.
Definition at line 332 of file channeltls.c.
Referenced by connection_tls_start_handshake().
void channel_tls_handle_state_change_on_orconn | ( | channel_tls_t * | chan, |
or_connection_t * | conn, | ||
uint8_t | state | ||
) |
Handle an orconn state change.
This function will be called by connection_or.c when the or_connection_t associated with this channel_tls_t changes state.
Definition at line 980 of file channeltls.c.
Referenced by connection_or_change_state().
void channel_tls_handle_var_cell | ( | var_cell_t * | var_cell, |
or_connection_t * | conn | ||
) |
Handle an incoming variable-length cell on a channel_tls_t.
Process a var_cell that was just received on conn. Keep internal statistics about how many of each cell we've processed so far this second, and the total number of microseconds it took to process each type of cell. All the var_cell commands are handshake- related and live below the channel_t layer, so no variable-length cells ever get delivered in the current implementation, but I've left the mechanism in place for future use.
If we were handing them off to the upper layer, the channel_t queueing code would be responsible for memory management, and we'd just be passing pointers through from connection_or_process_cells_from_inbuf(). That caller always frees them after this function returns, so this function should never free var_cell.
Definition at line 1199 of file channeltls.c.
channel_listener_t * channel_tls_start_listener | ( | void | ) |
Start a channel_tls_t listener if necessary.
Return the current channel_tls_t listener, or start one if we haven't yet, and return that.
Definition at line 269 of file channeltls.c.
Referenced by connection_tls_start_handshake().
channel_t * channel_tls_to_base | ( | channel_tls_t * | tlschan | ) |
Cast a channel_tls_t to a channel_t.
Definition at line 413 of file channeltls.c.
Referenced by channel_tls_to_base_const(), and connection_or_client_learned_peer_id().
const channel_t * channel_tls_to_base_const | ( | const channel_tls_t * | tlschan | ) |
Cast a const channel_tls_t to a const channel_t.
Definition at line 438 of file channeltls.c.
void channel_tls_update_marks | ( | or_connection_t * | conn | ) |
Update channel marks after connection_or.c has changed an address.
This is called from connection_or_init_conn_from_address() after the connection's _base.addr or real_addr fields have potentially been changed so we can recalculate the local mark. Notably, this happens when incoming connections are reverse-proxied and we only learn the real address of the remote router by looking it up in the consensus after we finish the handshake and know an authenticated identity digest.
Definition at line 1373 of file channeltls.c.
|
extern |
How many CELL_AUTH_CHALLENGE cells have we received, ever?
Definition at line 94 of file channeltls.c.
|
extern |
How many CELL_AUTHENTICATE cells have we received, ever?
Definition at line 96 of file channeltls.c.
|
extern |
How many CELL_AUTHORIZE cells have we received, ever?
Definition at line 98 of file channeltls.c.
|
extern |
How many CELL_CERTS cells have we received, ever?
Definition at line 92 of file channeltls.c.
|
extern |
How many CELL_NETINFO cells have we received, ever?
Definition at line 88 of file channeltls.c.
|
extern |
How many CELL_VERSIONS cells have we received, ever?
Definition at line 86 of file channeltls.c.
|
extern |
How many CELL_VPADDING cells have we received, ever?
Definition at line 90 of file channeltls.c.