20extern uint64_t stats_n_circ_max_cell_outq_reached;
25uint32_t relay_get_param_max_circuit_cell_queue_size(
29size_t cell_queues_get_total_allocation(
void);
32void relay_header_pack(uint8_t *dest,
const relay_header_t *src);
33void relay_header_unpack(relay_header_t *dest,
const uint8_t *src);
38 uint8_t relay_command,
const char *payload,
40 const char *filename,
int lineno));
42#define CONTROL_CELL_ID 0
43#define relay_send_command_from_edge(stream_id, circ, relay_command, payload, \
44 payload_len, cpath_layer) \
45 relay_send_command_from_edge_((stream_id), (circ), (relay_command), \
46 (payload), (payload_len), (cpath_layer), \
49 uint8_t relay_command,
const char *payload,
63extern uint64_t oom_stats_n_bytes_removed_cell;
64extern uint64_t oom_stats_n_bytes_removed_geoip;
65extern uint64_t oom_stats_n_bytes_removed_hsdir;
74#define packed_cell_free(cell) \
75 FREE_AND_NULL(packed_cell_t, packed_cell_free_, (cell))
81 int exitward,
const cell_t *cell,
82 int wide_circ_ids,
int use_stats);
100 const char *filename,
int lineno));
103 const char *file,
int lineno);
104#define update_circuit_on_cmux(circ, direction) \
105 update_circuit_on_cmux_((circ), (direction), SHORT_FILE__, __LINE__)
109 const uint8_t *payload,
120 uint8_t relay_command);
126 int optimistic_data);
131typedef struct address_ttl_t {
137#define address_ttl_free(addr) \
138 FREE_AND_NULL(address_ttl_t, address_ttl_free_, (addr))
tor_cmdline_mode_t command
STATIC int resolved_cell_parse(const relay_msg_t *msg, smartlist_t *addresses_out, int *errcode_out)
STATIC int connection_edge_process_resolved_cell(edge_connection_t *conn, const relay_msg_t *msg)
STATIC int connection_edge_process_relay_cell(const relay_msg_t *msg, circuit_t *circ, edge_connection_t *conn, crypt_path_t *layer_hint)
STATIC packed_cell_t * packed_cell_new(void)
STATIC packed_cell_t * cell_queue_pop(cell_queue_t *queue)
STATIC destroy_cell_t * destroy_cell_queue_pop(destroy_cell_queue_t *queue)
STATIC int cell_queues_check_size(void)
STATIC int connected_cell_parse(const relay_msg_t *msg, tor_addr_t *addr_out, int *ttl_out)
STATIC size_t connection_edge_get_inbuf_bytes_to_package(size_t n_available, int package_partial, circuit_t *on_circuit, crypt_path_t *cpath)
STATIC void address_ttl_free_(address_ttl_t *addr)
STATIC int handle_relay_msg(const relay_msg_t *msg, circuit_t *circ, edge_connection_t *conn, crypt_path_t *layer_hint, int optimistic_data)
int channel_flush_from_first_active_circuit(channel_t *chan, int max)
void destroy_cell_queue_init(destroy_cell_queue_t *queue)
int append_address_to_payload(uint8_t *payload_out, const tor_addr_t *addr)
uint64_t stats_n_data_cells_received
void packed_cell_free_(packed_cell_t *cell)
void destroy_cell_queue_clear(destroy_cell_queue_t *queue)
void destroy_cell_queue_append(destroy_cell_queue_t *queue, circid_t circid, uint8_t reason)
relay_cell_fmt_t circuit_get_relay_format(const circuit_t *circ, const crypt_path_t *cpath)
int append_cell_to_circuit_queue(circuit_t *circ, channel_t *chan, cell_t *cell, cell_direction_t direction, streamid_t fromstream)
void channel_unlink_all_circuits(channel_t *chan, smartlist_t *detached_out)
void cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue, int exitward, const cell_t *cell, int wide_circ_ids, int use_stats)
uint64_t oom_stats_n_bytes_removed_dns
void dump_cell_pool_usage(int severity)
void circuit_reset_sendme_randomness(circuit_t *circ)
uint64_t stats_n_relay_cells_relayed
size_t circuit_max_relay_payload(const circuit_t *circ, const crypt_path_t *cpath, uint8_t relay_command)
uint64_t stats_n_circ_max_cell_reached
uint64_t stats_n_data_cells_packaged
void cell_queue_clear(cell_queue_t *queue)
void circuit_clear_cell_queue(circuit_t *circ, channel_t *chan)
void cell_queue_init(cell_queue_t *queue)
int circuit_package_relay_cell(cell_t *cell, circuit_t *circ, cell_direction_t cell_direction, crypt_path_t *layer_hint, streamid_t on_stream, const char *filename, int lineno)
int have_been_under_memory_pressure(void)
uint64_t stats_n_data_bytes_received
circid_t packed_cell_get_circid(const packed_cell_t *cell, int wide_circ_ids)
const uint8_t * decode_address_from_payload(tor_addr_t *addr_out, const uint8_t *payload, int payload_len)
void update_circuit_on_cmux_(circuit_t *circ, cell_direction_t direction, const char *file, int lineno)
int relay_send_command_from_edge_(streamid_t stream_id, circuit_t *circ, uint8_t relay_command, const char *payload, size_t payload_len, crypt_path_t *cpath_layer, const char *filename, int lineno)
uint8_t packed_cell_get_command(const packed_cell_t *cell, int wide_circ_ids)
uint64_t stats_n_relay_cells_delivered
const char * relay_command_to_string(uint8_t command)
void cell_queue_append(cell_queue_t *queue, packed_cell_t *cell)
int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, cell_direction_t cell_direction)
int connection_edge_package_raw_inbuf(edge_connection_t *conn, int package_partial, int *max_cells)
int connection_edge_send_command(edge_connection_t *fromconn, uint8_t relay_command, const char *payload, size_t payload_len)
uint64_t stats_n_data_bytes_packaged
size_t packed_cell_mem_cost(void)
A relay message which contains a relay command and parameters, if any, that is from a relay cell.
#define MOCK_DECL(rv, funcname, arglist)