#include "or.h"
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] |
Process a 'create' cell that just arrived from conn. Make a new circuit with the p_circ_id specified in cell. Put the circuit in state onionskin_pending, and pass the onionskin to the cpuworker. Circ will get picked up again when the cpuworker finishes decrypting it.
References or_circuit_t::_base, or_connection_t::_base, connection_t::address, assign_onionskin_to_cpuworker(), cell_t::circ_id, or_connection_t::circ_id_type, CIRC_ID_TYPE_HIGHER, CIRC_ID_TYPE_LOWER, circuit_id_in_use_on_orconn(), CIRCUIT_PURPOSE_OR, circuit_set_state(), CIRCUIT_STATE_ONIONSKIN_PENDING, cell_t::command, connection_or_send_destroy(), DIGEST_LEN, escaped(), fast_server_handshake(), get_options(), or_connection_t::identity_digest, LD_GENERAL, LD_OR, LD_PROTOCOL, routerinfo_t::nickname, onionskin_answer(), or_circuit_new(), cell_t::payload, routerinfo_t::platform, connection_t::port, circuit_t::purpose, router_get_by_digest(), server_mode(), connection_t::timestamp_created, TO_CIRCUIT, tor_assert, and we_are_hibernating().
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] |
Process a 'netinfo' cell: read and act on its contents, and set the connection state to "open".
Warn when we get a netinfo skew with at least this value.
References or_connection_t::_base, connection_t::address, assert_connection_ok(), CELL_PAYLOAD_SIZE, connection_or_set_state_open(), control_event_general_status(), decode_address_from_payload(), format_time_interval(), get_uint32(), or_connection_t::handshake_state, or_connection_t::identity_digest, or_connection_t::is_canonical, LD_GENERAL, LD_OR, or_connection_t::link_proto, OR_CONN_STATE_OR_HANDSHAKING, cell_t::payload, connection_t::port, or_connection_t::real_addr, or_handshake_state_t::received_versions, router_get_by_digest(), safe_str_client(), or_handshake_state_t::sent_versions_at, connection_t::state, TO_CONN, tor_addr_eq, and tor_assert.
static void command_process_relay_cell | ( | cell_t * | cell, | |
or_connection_t * | conn | |||
) | [static] |
Process a 'relay' or 'relay_early' cell that just arrived from conn. Make sure it came in with a recognized circ_id. Pass it on to circuit_receive_relay_cell() for actual processing.
References or_connection_t::_base, connection_t::address, CELL_DIRECTION_IN, CELL_DIRECTION_OUT, cell_t::circ_id, circuit_get_by_circid_orconn(), CIRCUIT_IS_ORIGIN, circuit_receive_relay_cell(), CIRCUIT_STATE_ONIONSKIN_PENDING, or_connection_t::client_used, cell_t::command, LD_OR, LD_PROTOCOL, connection_t::port, or_circuit_t::remaining_relay_early_cells, safe_str(), circuit_t::state, and TO_OR_CIRCUIT().
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.
uint64_t stats_n_create_cells_processed = 0 |
How many CELL_CREATE cells have we received, ever?
Referenced by command_process_cell(), and dumpstats().
uint64_t stats_n_created_cells_processed = 0 |
How many CELL_CREATED cells have we received, ever?
Referenced by command_process_cell(), and dumpstats().
uint64_t stats_n_destroy_cells_processed = 0 |
How many CELL_DESTROY cells have we received, ever?
Referenced by command_process_cell(), and dumpstats().
uint64_t stats_n_netinfo_cells_processed = 0 |
How many CELL_NETINFO cells have we received, ever?
Referenced by command_process_cell().
uint64_t stats_n_padding_cells_processed = 0 |
How many CELL_PADDING cells have we received, ever?
Referenced by command_process_cell(), and dumpstats().
uint64_t stats_n_relay_cells_processed = 0 |
How many CELL_RELAY cells have we received, ever?
Referenced by command_process_cell(), and dumpstats().
uint64_t stats_n_versions_cells_processed = 0 |
How many CELL_VERSIONS cells have we received, ever?
Referenced by command_process_var_cell().