command.c File Reference

Functions for processing incoming cells. More...

#include "or.h"

Defines

#define PROCESS_CELL(tp, cl, cn)   command_process_ ## tp ## _cell(cl, cn)
#define NETINFO_NOTICE_SKEW   3600

Functions

static void command_process_create_cell (cell_t *cell, or_connection_t *conn)
static void command_process_created_cell (cell_t *cell, or_connection_t *conn)
static void command_process_relay_cell (cell_t *cell, or_connection_t *conn)
static void command_process_destroy_cell (cell_t *cell, or_connection_t *conn)
static void command_process_versions_cell (var_cell_t *cell, or_connection_t *conn)
static void command_process_netinfo_cell (cell_t *cell, or_connection_t *conn)
void command_process_cell (cell_t *cell, or_connection_t *conn)
void command_process_var_cell (var_cell_t *cell, or_connection_t *conn)

Variables

uint64_t stats_n_padding_cells_processed = 0
uint64_t stats_n_create_cells_processed = 0
uint64_t stats_n_created_cells_processed = 0
uint64_t stats_n_relay_cells_processed = 0
uint64_t stats_n_destroy_cells_processed = 0
uint64_t stats_n_versions_cells_processed = 0
uint64_t stats_n_netinfo_cells_processed = 0


Detailed Description

Functions for processing incoming cells.


Function Documentation

void command_process_cell ( cell_t cell,
or_connection_t conn 
)

Process a 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.

References or_connection_t::_base, cell_t::command, LD_OR, LD_PROTOCOL, OR_CONN_STATE_OR_HANDSHAKING, connection_t::state, stats_n_create_cells_processed, stats_n_created_cells_processed, stats_n_destroy_cells_processed, stats_n_netinfo_cells_processed, stats_n_padding_cells_processed, stats_n_relay_cells_processed, and tor_fragile_assert.

Referenced by connection_or_process_cells_from_inbuf().

static void command_process_create_cell ( cell_t cell,
or_connection_t conn 
) [static]

static void command_process_created_cell ( cell_t cell,
or_connection_t conn 
) [static]

Process a 'created' cell that just arrived from conn. Find the circuit that it's intended for. If we're not the origin of the circuit, package the 'created' cell in an 'extended' relay cell and pass it back. If we are the origin of the circuit, send it to circuit_finish_handshake() to finish processing keys, and then call circuit_send_next_onion_skin() to extend to the next hop in the circuit if necessary.

References cell_t::circ_id, circuit_finish_handshake(), circuit_get_by_circid_orconn(), CIRCUIT_IS_ORIGIN, circuit_send_next_onion_skin(), cell_t::command, LD_OR, LD_PROTOCOL, circuit_t::n_circ_id, cell_t::payload, relay_send_command_from_edge(), and TO_ORIGIN_CIRCUIT().

static void command_process_destroy_cell ( cell_t cell,
or_connection_t conn 
) [static]

Process a 'destroy' cell that just arrived from conn. Find the circ that it refers to (if any).

If the circ is in state onionskin_pending, then call onion_pending_remove() to remove it from the pending onion list (note that if it's already being processed by the cpuworker, it won't be in the list anymore; but when the cpuworker returns it, the circuit will be gone, and the cpuworker response will be dropped).

Then mark the circuit for close (which marks all edges for close, and passes the destroy cell onward if necessary).

References or_connection_t::_base, connection_t::address, cell_t::circ_id, circuit_get_by_circid_orconn(), CIRCUIT_IS_ORIGIN, circuit_set_n_circid_orconn(), circuit_set_p_circid_orconn(), END_CIRC_REASON_FLAG_REMOTE, LD_OR, cell_t::payload, connection_t::port, relay_send_command_from_edge(), and TO_OR_CIRCUIT().

static void command_process_netinfo_cell ( cell_t cell,
or_connection_t conn 
) [static]

static void command_process_relay_cell ( cell_t cell,
or_connection_t conn 
) [static]

void command_process_var_cell ( var_cell_t cell,
or_connection_t conn 
)

Process a 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.

References or_connection_t::_base, var_cell_t::command, LD_BUG, LD_OR, OR_CONN_STATE_OR_HANDSHAKING, connection_t::state, stats_n_versions_cells_processed, and tor_fragile_assert.

Referenced by connection_or_process_cells_from_inbuf().

static void command_process_versions_cell ( var_cell_t cell,
or_connection_t conn 
) [static]

Process a 'versions' cell. The current link protocol version must be 0 to indicate that no version has yet been negotiated. We compare the versions in the cell to the list of versions we support, pick the highest version we have in common, and continue the negotiation from there.

References or_connection_t::_base, connection_t::address, connection_or_send_netinfo(), get_uint16(), or_connection_t::handshake_state, is_or_protocol_version_known(), LD_OR, or_connection_t::link_proto, OR_CONN_STATE_OR_HANDSHAKING, var_cell_t::payload, var_cell_t::payload_len, connection_t::port, or_handshake_state_t::received_versions, safe_str_client(), connection_t::state, TO_CONN, and tor_assert.


Variable Documentation

How many CELL_CREATE cells have we received, ever?

Referenced by command_process_cell(), and dumpstats().

How many CELL_CREATED cells have we received, ever?

Referenced by command_process_cell(), and dumpstats().

How many CELL_DESTROY cells have we received, ever?

Referenced by command_process_cell(), and dumpstats().

How many CELL_NETINFO cells have we received, ever?

Referenced by command_process_cell().

How many CELL_PADDING cells have we received, ever?

Referenced by command_process_cell(), and dumpstats().

How many CELL_RELAY cells have we received, ever?

Referenced by command_process_cell(), and dumpstats().

How many CELL_VERSIONS cells have we received, ever?

Referenced by command_process_var_cell().


Generated on Tue May 25 00:30:40 2010 for tor by  doxygen 1.5.6