Report only the top 10 ports in exit-port stats.
[tor/rransom.git] / src / or / relay.h
blob08a1ffe7891a1d170cfb4aa8488dd86df2f3f7e6
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2010, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * \file relay.h
9 * \brief Header file for relay.c.
10 **/
12 #ifndef _TOR_RELAY_H
13 #define _TOR_RELAY_H
15 extern uint64_t stats_n_relay_cells_relayed;
16 extern uint64_t stats_n_relay_cells_delivered;
18 int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
19 cell_direction_t cell_direction);
21 void relay_header_pack(char *dest, const relay_header_t *src);
22 void relay_header_unpack(relay_header_t *dest, const char *src);
23 int relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
24 uint8_t relay_command, const char *payload,
25 size_t payload_len, crypt_path_t *cpath_layer);
26 int connection_edge_send_command(edge_connection_t *fromconn,
27 uint8_t relay_command, const char *payload,
28 size_t payload_len);
29 int connection_edge_package_raw_inbuf(edge_connection_t *conn,
30 int package_partial,
31 int *max_cells);
32 void connection_edge_consider_sending_sendme(edge_connection_t *conn);
34 extern uint64_t stats_n_data_cells_packaged;
35 extern uint64_t stats_n_data_bytes_packaged;
36 extern uint64_t stats_n_data_cells_received;
37 extern uint64_t stats_n_data_bytes_received;
39 void init_cell_pool(void);
40 void free_cell_pool(void);
41 void clean_cell_pool(void);
42 void dump_cell_pool_usage(int severity);
44 void cell_queue_clear(cell_queue_t *queue);
45 void cell_queue_append(cell_queue_t *queue, packed_cell_t *cell);
46 void cell_queue_append_packed_copy(cell_queue_t *queue, const cell_t *cell);
48 void append_cell_to_circuit_queue(circuit_t *circ, or_connection_t *orconn,
49 cell_t *cell, cell_direction_t direction,
50 streamid_t fromstream);
51 void connection_or_unlink_all_active_circs(or_connection_t *conn);
52 int connection_or_flush_from_first_active_circuit(or_connection_t *conn,
53 int max, time_t now);
54 void assert_active_circuits_ok(or_connection_t *orconn);
55 void make_circuit_inactive_on_conn(circuit_t *circ, or_connection_t *conn);
56 void make_circuit_active_on_conn(circuit_t *circ, or_connection_t *conn);
58 int append_address_to_payload(char *payload_out, const tor_addr_t *addr);
59 const char *decode_address_from_payload(tor_addr_t *addr_out,
60 const char *payload,
61 int payload_len);
62 unsigned cell_ewma_get_tick(void);
63 void cell_ewma_set_scale_factor(or_options_t *options,
64 networkstatus_t *consensus);
65 void circuit_clear_cell_queue(circuit_t *circ, or_connection_t *orconn);
67 #endif