connection_t Struct Reference

#include <or.h>


Data Fields

uint32_t magic
uint8_t state
unsigned int type:4
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 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
evutil_socket_t s
int conn_array_index
struct event * read_event
struct event * write_event
buf_tinbuf
buf_toutbuf
size_t outbuf_flushlen
time_t timestamp_lastread
time_t timestamp_lastwritten
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_tlinked_conn
uint64_t global_identifier
struct evdns_server_port * dns_server_port
uint64_t dirreq_id


Detailed Description

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.


Field Documentation

Current state of this connection.

Referenced by _connection_free(), ap_stream_wants_exit_attention(), assert_connection_ok(), assign_onionskin_to_cpuworker(), circuit_get_open_circ_or_launch(), command_process_cell(), command_process_netinfo_cell(), command_process_var_cell(), command_process_versions_cell(), conn_close_if_marked(), connection_about_to_close_connection(), connection_ap_detach_retriable(), connection_ap_expire_beginning(), connection_ap_handshake_attach_chosen_circuit(), connection_ap_handshake_attach_circuit(), connection_ap_handshake_process_socks(), connection_ap_handshake_send_begin(), connection_ap_handshake_send_resolve(), connection_ap_make_link(), connection_ap_process_natd(), connection_ap_process_transparent(), connection_bucket_read_limit(), connection_bucket_should_increase(), connection_bucket_write_limit(), connection_buckets_decrement(), connection_close_immediate(), connection_consider_empty_read_buckets(), connection_consider_empty_write_buckets(), connection_control_process_inbuf(), connection_cpu_process_inbuf(), connection_cpu_reached_eof(), connection_create_listener(), connection_dir_finished_connecting(), connection_dir_finished_flushing(), connection_dir_process_inbuf(), connection_dir_reached_eof(), connection_dirserv_flushed_some(), connection_dns_remove(), connection_edge_finished_connecting(), connection_edge_finished_flushing(), connection_edge_process_inbuf(), connection_edge_process_relay_cell_not_open(), connection_exit_begin_conn(), connection_exit_begin_resolve(), connection_exit_connect(), connection_exit_connect_dir(), connection_flushed_some(), connection_handle_read_impl(), connection_handle_write_impl(), connection_init_accepted_conn(), connection_or_connect(), connection_or_finished_connecting(), connection_or_finished_flushing(), connection_or_get_for_extend(), connection_or_group_set_badness(), connection_or_process_inbuf(), connection_or_set_state_open(), connection_read_to_buf(), connection_state_is_connecting(), connection_state_is_open(), connection_tls_continue_handshake(), connection_tls_finish_handshake(), connection_tls_start_handshake(), directory_handle_command_get(), directory_handle_command_post(), directory_initiate_command_rend(), dns_cancel_pending_resolve(), dns_found_answer(), dns_resolve(), dnsserv_launch_request(), evdns_server_callback(), getinfo_helper_events(), handle_control_attachstream(), handle_control_authenticate(), is_valid_initial_command(), rend_client_desc_trynow(), rend_client_remove_intro_point(), run_connection_housekeeping(), and spawn_cpuworker().

unsigned int connection_t::type

What kind of connection is this?

Referenced by _connection_free(), _connection_mark_unattached_ap(), _connection_write_to_buf_impl(), ap_stream_wants_exit_attention(), assert_circuit_ok(), assert_connection_ok(), check_sockaddr_family_match(), circuit_dump_by_conn(), conn_close_if_marked(), conn_read_callback(), conn_write_callback(), connection_about_to_close_connection(), connection_add(), connection_ap_can_use_exit(), connection_ap_handshake_process_socks(), connection_ap_handshake_send_begin(), connection_ap_handshake_send_resolve(), connection_ap_process_natd(), connection_ap_process_transparent(), connection_bucket_read_limit(), connection_bucket_write_limit(), connection_buckets_decrement(), connection_close_immediate(), connection_counts_as_relayed_traffic(), connection_cpu_finished_flushing(), connection_cpu_process_inbuf(), connection_dir_finished_connecting(), connection_dir_finished_flushing(), connection_dir_process_inbuf(), connection_dns_remove(), connection_edge_destroy(), connection_edge_finished_connecting(), connection_edge_process_inbuf(), connection_edge_process_relay_cell_not_open(), connection_edge_send_command(), connection_exit_connect_dir(), connection_finished_connecting(), connection_finished_flushing(), connection_flushed_some(), connection_free(), connection_handle_listener_read(), connection_handle_read_impl(), connection_handle_write_impl(), connection_init(), connection_init_accepted_conn(), connection_is_listener(), connection_or_get_for_extend(), connection_or_nonopen_was_started_here(), connection_process_inbuf(), connection_reached_eof(), connection_read_to_buf(), connection_remove(), connection_state_is_connecting(), connection_state_is_open(), connection_unlink(), control_event_stream_status(), directory_handle_command(), directory_send_command(), dnsserv_close_listener(), dnsserv_configure_listener(), get_stream(), hibernate_begin(), hibernate_go_dormant(), retry_listeners(), and run_connection_housekeeping().

unsigned int connection_t::purpose

Boolean: should we start reading again once the bandwidth throttler allows it?

Referenced by connection_consider_empty_read_buckets().

Boolean: should we start writing again once the bandwidth throttler allows writes?

Referenced by assert_connection_ok(), connection_consider_empty_write_buckets(), and connection_handle_write_impl().

Boolean: did read() return 0 on this conn?

Referenced by connection_dir_process_inbuf(), connection_handle_read_impl(), and connection_read_to_buf().

Set to 1 when we're inside connection_flushed_some to keep us from calling connection_handle_write() recursively.

Referenced by _connection_write_to_buf_impl(), connection_flushed_some(), and connection_handle_write_impl().

unsigned int connection_t::linked

True iff we'd like to be notified about read events from the linked conn.

Referenced by connection_free(), connection_is_reading(), connection_should_read_from_linked_conn(), connection_start_reading(), connection_stop_reading(), and connection_unlink().

True iff we're willing to write to the linked conn.

Referenced by connection_is_writing(), connection_should_read_from_linked_conn(), connection_start_writing(), and connection_stop_writing().

True iff we're currently able to read on the linked conn, and our read_event should be made active with libevent.

Referenced by connection_handle_read_impl(), connection_start_reading_from_linked_conn(), and connection_stop_reading_from_linked_conn().

True iff we've called connection_close_immediate() on this linked connection.

Referenced by connection_close_immediate().

CONNECT/SOCKS proxy client handshake state (for outgoing connections).

Referenced by connection_proxy_connect(), connection_read_proxy_handshake(), and connection_send_socks5_connect().

evutil_socket_t connection_t::s

struct event* connection_t::read_event [read]

struct event* connection_t::write_event [read]

Address family of this connection's socket. Usually AF_INET, but it can also be AF_UNIX, or in the future AF_INET6

Referenced by _connection_free(), check_sockaddr_family_match(), connection_create_listener(), connection_handle_listener_read(), connection_init(), and retry_listeners().

FQDN (or IP) of the guy on the other end. strdup into this, because free_connection() frees it.

Referenced by _connection_free(), assert_connection_edge_not_dns_pending(), assert_connection_ok(), circuit_build_failed(), circuit_expire_building(), circuit_extend(), circuit_n_conn_done(), command_process_create_cell(), command_process_destroy_cell(), command_process_netinfo_cell(), command_process_relay_cell(), command_process_versions_cell(), conn_close_if_marked(), connection_add(), connection_ap_handshake_send_resolve(), connection_ap_make_link(), connection_create_listener(), connection_dir_client_reached_eof(), connection_dir_finished_connecting(), connection_dir_request_failed(), connection_dns_remove(), connection_edge_finished_connecting(), connection_exit_begin_conn(), connection_exit_begin_resolve(), connection_exit_connect(), connection_exit_connect_dir(), connection_handle_listener_read(), connection_or_check_valid_tls_handshake(), connection_or_connect(), connection_or_finished_connecting(), connection_or_group_set_badness(), connection_or_init_conn_from_address(), connection_read_https_proxy_response(), connection_read_proxy_handshake(), connection_read_to_buf(), connection_tls_finish_handshake(), connection_tls_start_handshake(), directory_handle_command(), directory_handle_command_post(), directory_initiate_command_rend(), directory_send_command(), dns_resolve(), dns_resolve_impl(), http_set_address_origin(), launch_resolve(), orconn_target_get_name(), retry_listeners(), router_new_address_suggestion(), run_connection_housekeeping(), spawn_cpuworker(), and write_http_response_header_impl().

struct evdns_server_port* connection_t::dns_server_port [read]

If the connection is a CONN_TYPE_AP_DNS_LISTENER, this field points to the evdns_server_port is uses to listen to and answer connections.

Referenced by connection_unregister_events(), dnsserv_close_listener(), and dnsserv_configure_listener().

Unique ID for measuring tunneled network status requests.

Referenced by connection_handle_write_impl().


The documentation for this struct was generated from the following file:

Generated on Tue May 25 00:31:09 2010 for tor by  doxygen 1.5.6