tor
master
|
#include <or.h>
Data Fields | |
uint32_t | magic |
uint8_t | state |
unsigned int | type:5 |
unsigned int | purpose:5 |
unsigned int | read_blocked_on_bw:1 |
unsigned int | write_blocked_on_bw:1 |
unsigned int | hold_open_until_flushed:1 |
unsigned int | inbuf_reached_eof:1 |
unsigned int | in_flushed_some:1 |
unsigned int | in_connection_handle_write:1 |
unsigned int | linked:1 |
unsigned int | reading_from_linked_conn:1 |
unsigned int | writing_to_linked_conn:1 |
unsigned int | active_on_link:1 |
unsigned int | linked_conn_is_closed:1 |
unsigned int | proxy_state:4 |
tor_socket_t | s |
int | conn_array_index |
struct event * | read_event |
struct event * | write_event |
struct buf_t * | inbuf |
struct buf_t * | outbuf |
size_t | outbuf_flushlen |
time_t | timestamp_last_read_allowed |
time_t | timestamp_last_write_allowed |
time_t | timestamp_created |
int | socket_family |
tor_addr_t | addr |
uint16_t | port |
uint16_t | marked_for_close |
const char * | marked_for_close_file |
char * | address |
struct connection_t * | linked_conn |
uint64_t | global_identifier |
uint32_t | n_read_conn_bw |
uint32_t | n_written_conn_bw |
Description of a connection to another host or process, and associated data.
A connection is named based on what it's connected to – an "OR connection" has a Tor node on the other end, an "exit connection" has a website or other server on the other end, and an "AP connection" has an application proxy (and thus a user) on the other end.
Every connection has a type and a state. Connections never change their type, but can go through many state changes in their lifetime.
Every connection has two associated input and output buffers. Listeners don't use them. For non-listener connections, incoming data is appended to conn->inbuf, and outgoing data is taken from conn->outbuf. Connections differ primarily in the functions called to fill and drain these buffers.
unsigned int active_on_link |
True iff we're currently able to read on the linked conn, and our read_event should be made active with libevent.
tor_addr_t addr |
IP that socket "s" is directly connected to; may be the IP address for a proxy or pluggable transport, see "address" for the address of the final destination.
char* address |
FQDN (or IP) and port of the final destination for this connection; this is always the remote address, it is passed to a proxy or pluggable transport if one in use. See "addr" and "port" for the address that socket "s" is directly connected to. strdup into this, because free_connection() frees it.
int conn_array_index |
Index into the global connection array.
uint64_t global_identifier |
Unique identifier for this connection on this Tor instance.
unsigned int hold_open_until_flushed |
Despite this connection's being marked for close, do we flush it before closing it?
unsigned int in_connection_handle_write |
True if connection_handle_write is currently running on this connection.
unsigned int in_flushed_some |
Set to 1 when we're inside connection_flushed_some to keep us from calling connection_handle_write() recursively.
struct buf_t* inbuf |
Buffer holding data read over this connection.
unsigned int inbuf_reached_eof |
Boolean: did read() return 0 on this conn?
unsigned int linked |
True if there is, or has been, a linked_conn.
struct connection_t* linked_conn |
Another connection that's connected to this one in lieu of a socket.
unsigned int linked_conn_is_closed |
True iff we've called connection_close_immediate() on this linked connection.
uint32_t magic |
For memory debugging: must equal one of *_CONNECTION_MAGIC.
uint16_t marked_for_close |
Should we close this conn on the next iteration of the main loop? (If true, holds the line number where this connection was marked.)
const char* marked_for_close_file |
For debugging: in which file were we marked for close?
uint32_t n_read_conn_bw |
Bytes read since last call to control_event_conn_bandwidth_used(). Only used if we're configured to emit CONN_BW events.
uint32_t n_written_conn_bw |
Bytes written since last call to control_event_conn_bandwidth_used(). Only used if we're configured to emit CONN_BW events.
struct buf_t* outbuf |
Buffer holding data to write over this connection.
size_t outbuf_flushlen |
How much data should we try to flush from the outbuf?
uint16_t port |
If non-zero, port that socket "s" is directly connected to; may be the port for a proxy or pluggable transport, see "address" for the port at the final destination.
unsigned int proxy_state |
CONNECT/SOCKS proxy client handshake state (for outgoing connections).
unsigned int purpose |
Only used for DIR and EXIT types currently.
unsigned int read_blocked_on_bw |
Boolean: should we start reading again once the bandwidth throttler allows it?
struct event* read_event |
Libevent event structure.
unsigned int reading_from_linked_conn |
True iff we'd like to be notified about read events from the linked conn.
tor_socket_t s |
Our socket; set to TOR_INVALID_SOCKET if this connection is closed, or has no socket.
int socket_family |
Address family of this connection's socket. Usually AF_INET, but it can also be AF_UNIX, or AF_INET6
uint8_t state |
Current state of this connection.
time_t timestamp_created |
When was this connection_t created?
time_t timestamp_last_read_allowed |
When was the last time libevent said we could read?
time_t timestamp_last_write_allowed |
When was the last time libevent said we could write?
unsigned int type |
What kind of connection is this?
unsigned int write_blocked_on_bw |
Boolean: should we start writing again once the bandwidth throttler allows writes?
struct event* write_event |
Libevent event structure.
unsigned int writing_to_linked_conn |
True iff we're willing to write to the linked conn.