tor  master
Macros | Functions | Variables
channeltls.h File Reference

Header file for channeltls.c. More...

#include "or.h"
#include "channel.h"
Include dependency graph for channeltls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BASE_CHAN_TO_TLS(c)   (channel_tls_from_base((c)))
 
#define TLS_CHAN_TO_BASE(c)   (channel_tls_to_base((c)))
 
#define TLS_CHAN_MAGIC   0x8a192427U
 

Functions

channel_tchannel_tls_connect (const tor_addr_t *addr, uint16_t port, const char *id_digest, const ed25519_public_key_t *ed_id)
 
channel_listener_tchannel_tls_get_listener (void)
 
channel_listener_tchannel_tls_start_listener (void)
 
channel_tchannel_tls_handle_incoming (or_connection_t *orconn)
 
channel_tchannel_tls_to_base (channel_tls_t *tlschan)
 
channel_tls_t * channel_tls_from_base (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 old_state, 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
 

Detailed Description

Header file for channeltls.c.

Function Documentation

◆ 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 
)

Start a new TLS channel.

Launch a new OR connection to addr:port and expect to handshake with an OR with identity digest id_digest, and wrap it in a channel_tls_t.

Here is the caller graph for this function:

◆ channel_tls_free_all()

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.

◆ channel_tls_from_base()

channel_tls_t* channel_tls_from_base ( channel_t chan)

Cast a channel_t to a channel_tls_t, with appropriate type-checking asserts.

◆ channel_tls_get_listener()

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

Here is the caller graph for this function:

◆ channel_tls_handle_cell()

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().

◆ channel_tls_handle_incoming()

channel_t* channel_tls_handle_incoming ( or_connection_t orconn)

Create a new channel around an incoming or_connection_t.

Here is the caller graph for this function:

◆ 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  old_state,
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.

◆ channel_tls_handle_var_cell()

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.

◆ channel_tls_start_listener()

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.

Here is the caller graph for this function:

◆ channel_tls_to_base()

channel_t* channel_tls_to_base ( channel_tls_t *  tlschan)

Cast a channel_tls_t to a channel_t.

Here is the caller graph for this function:

◆ channel_tls_update_marks()

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.

Variable Documentation

◆ stats_n_auth_challenge_cells_processed

uint64_t stats_n_auth_challenge_cells_processed

How many CELL_AUTH_CHALLENGE cells have we received, ever?

◆ stats_n_authenticate_cells_processed

uint64_t stats_n_authenticate_cells_processed

How many CELL_AUTHENTICATE cells have we received, ever?

◆ stats_n_authorize_cells_processed

uint64_t stats_n_authorize_cells_processed

How many CELL_AUTHORIZE cells have we received, ever?

◆ stats_n_certs_cells_processed

uint64_t stats_n_certs_cells_processed

How many CELL_CERTS cells have we received, ever?

◆ stats_n_netinfo_cells_processed

uint64_t stats_n_netinfo_cells_processed

How many CELL_NETINFO cells have we received, ever?

◆ stats_n_versions_cells_processed

uint64_t stats_n_versions_cells_processed

How many CELL_VERSIONS cells have we received, ever?

◆ stats_n_vpadding_cells_processed

uint64_t stats_n_vpadding_cells_processed

How many CELL_VPADDING cells have we received, ever?