tor/src/or/channel.h

477 lines
16 KiB
C
Raw Normal View History

Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* * Copyright (c) 2012, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file channel.h
* \brief Header file for channel.c
**/
#ifndef _TOR_CHANNEL_H
#define _TOR_CHANNEL_H
#include "or.h"
#include "tor_queue.h"
#include "circuitmux.h"
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Channel handler function pointer typedefs */
typedef void (*channel_listener_fn_ptr)(channel_listener_t *, channel_t *);
typedef void (*channel_cell_handler_fn_ptr)(channel_t *, cell_t *);
typedef void (*channel_var_cell_handler_fn_ptr)(channel_t *, var_cell_t *);
struct cell_queue_entry_s;
SIMPLEQ_HEAD(chan_cell_queue, cell_queue_entry_s) incoming_queue;
typedef struct chan_cell_queue chan_cell_queue_t;
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/*
2012-10-09 05:15:09 +02:00
* Channel struct; see the channel_t typedef in or.h. A channel is an
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
* abstract interface for the OR-to-OR connection, similar to connection_or_t,
* but without the strong coupling to the underlying TLS implementation. They
* are constructed by calling a protocol-specific function to open a channel
* to a particular node, and once constructed support the abstract operations
* defined below.
*/
struct channel_s {
/* Magic number for type-checking cast macros */
uint32_t magic;
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Current channel state */
channel_state_t state;
/* Globally unique ID number for a channel over the lifetime of a Tor
* process.
*/
uint64_t global_identifier;
/* Should we expect to see this channel in the channel lists? */
unsigned char registered:1;
/** Why did we close?
*/
enum {
CHANNEL_NOT_CLOSING = 0,
CHANNEL_CLOSE_REQUESTED,
CHANNEL_CLOSE_FROM_BELOW,
CHANNEL_CLOSE_FOR_ERROR
} reason_for_closing;
/* Timestamps for both cell channels and listeners */
time_t timestamp_created; /* Channel created */
time_t timestamp_active; /* Any activity */
/* Methods implemented by the lower layer */
/* Free a channel */
void (*free)(channel_t *);
/* Close an open channel */
void (*close)(channel_t *);
/* Describe the transport subclass for this channel */
const char * (*describe_transport)(channel_t *);
/* Optional method to dump transport-specific statistics on the channel */
void (*dumpstats)(channel_t *, int);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Registered handlers for incoming cells */
channel_cell_handler_fn_ptr cell_handler;
channel_var_cell_handler_fn_ptr var_cell_handler;
/* Methods implemented by the lower layer */
/*
* Ask the underlying transport what the remote endpoint address is, in
* a tor_addr_t. This is optional and subclasses may leave this NULL.
* If they implement it, they should write the address out to the
* provided tor_addr_t *, and return 1 if successful or 0 if no address
* available.
*/
int (*get_remote_addr)(channel_t *, tor_addr_t *);
/*
* Get a text description of the remote endpoint; canonicalized if the
* arg is 0, or the one we originally connected to/received from if it's
* 1.
*/
const char * (*get_remote_descr)(channel_t *, int);
/* Check if the lower layer has queued writes */
int (*has_queued_writes)(channel_t *);
/*
* If the second param is zero, ask the lower layer if this is
* 'canonical', for a transport-specific definition of canonical; if
* it is 1, ask if the answer to the preceding query is safe to rely
* on.
*/
int (*is_canonical)(channel_t *, int);
/* Check if this channel matches a specified extend_info_t */
int (*matches_extend_info)(channel_t *, extend_info_t *);
/* Check if this channel matches a target address when extending */
int (*matches_target)(channel_t *, const tor_addr_t *);
/* Write a cell to an open channel */
int (*write_cell)(channel_t *, cell_t *);
/* Write a packed cell to an open channel */
int (*write_packed_cell)(channel_t *, packed_cell_t *);
/* Write a variable-length cell to an open channel */
int (*write_var_cell)(channel_t *, var_cell_t *);
/*
* Hash of the public RSA key for the other side's identity key, or
* zeroes if the other side hasn't shown us a valid identity key.
*/
char identity_digest[DIGEST_LEN];
/* Nickname of the OR on the other side, or NULL if none. */
char *nickname;
/*
* Linked list of channels with the same identity digest, for the
* digest->channel map
*/
channel_t *next_with_same_id, *prev_with_same_id;
/* List of incoming cells to handle */
chan_cell_queue_t incoming_queue;
/* List of queued outgoing cells */
chan_cell_queue_t outgoing_queue;
/* Circuit mux for circuits sending on this channel */
circuitmux_t *cmux;
/* Circuit ID generation stuff for use by circuitbuild.c */
/*
* When we send CREATE cells along this connection, which half of the
* space should we use?
*/
circ_id_type_t circ_id_type:2;
/*
* Which circ_id do we try to use next on this connection? This is
* always in the range 0..1<<15-1.
*/
circid_t next_circ_id;
/* For how many circuits are we n_chan? What about p_chan? */
unsigned int num_n_circuits, num_p_circuits;
/*
* True iff this channel shouldn't get any new circs attached to it,
* because the connection is too old, or because there's a better one.
* More generally, this flag is used to note an unhealthy connection;
* for example, if a bad connection fails we shouldn't assume that the
* router itself has a problem.
*/
unsigned int is_bad_for_new_circs:1;
/** True iff we have decided that the other end of this connection
* is a client. Channels with this flag set should never be used
* to satisfy an EXTEND request. */
unsigned int is_client:1;
/** Set if the channel was initiated remotely (came from a listener) */
unsigned int is_incoming:1;
/** Set by lower layer if this is local; i.e., everything it communicates
* with for this channel returns true for is_local_addr(). This is used
* to decide whether to declare reachability when we receive something on
* this channel in circuitbuild.c
*/
unsigned int is_local:1;
/** Channel timestamps for cell channels */
time_t timestamp_client; /* Client used this, according to relay.c */
time_t timestamp_drained; /* Output queue empty */
time_t timestamp_recv; /* Cell received from lower layer */
time_t timestamp_xmit; /* Cell sent to lower layer */
/* Timestamp for relay.c */
time_t timestamp_last_added_nonpadding;
/** Unique ID for measuring direct network status requests;vtunneled ones
* come over a circuit_t, which has a dirreq_id field as well, but is a
* distinct namespace. */
uint64_t dirreq_id;
/** Channel counters for cell channels */
uint64_t n_cells_recved;
uint64_t n_cells_xmitted;
};
struct channel_listener_s {
/* Current channel listener state */
channel_listener_state_t state;
/* Globally unique ID number for a channel over the lifetime of a Tor
* process.
*/
uint64_t global_identifier;
/* Should we expect to see this channel in the channel lists? */
unsigned char registered:1;
/** Why did we close?
*/
enum {
CHANNEL_LISTENER_NOT_CLOSING = 0,
CHANNEL_LISTENER_CLOSE_REQUESTED,
CHANNEL_LISTENER_CLOSE_FROM_BELOW,
CHANNEL_LISTENER_CLOSE_FOR_ERROR
} reason_for_closing;
/* Timestamps for both cell channels and listeners */
time_t timestamp_created; /* Channel created */
time_t timestamp_active; /* Any activity */
/* Methods implemented by the lower layer */
/* Free a channel */
void (*free)(channel_listener_t *);
/* Close an open channel */
void (*close)(channel_listener_t *);
/* Describe the transport subclass for this channel */
const char * (*describe_transport)(channel_listener_t *);
/* Optional method to dump transport-specific statistics on the channel */
void (*dumpstats)(channel_listener_t *, int);
/* Registered listen handler to call on incoming connection */
channel_listener_fn_ptr listener;
/* List of pending incoming connections */
smartlist_t *incoming_list;
/* Timestamps for listeners */
time_t timestamp_accepted;
/* Counters for listeners */
uint64_t n_accepted;
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
};
/* Channel state manipulations */
int channel_state_is_valid(channel_state_t state);
int channel_listener_state_is_valid(channel_listener_state_t state);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
int channel_state_can_transition(channel_state_t from, channel_state_t to);
int channel_listener_state_can_transition(channel_listener_state_t from,
channel_listener_state_t to);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
const char * channel_state_to_string(channel_state_t state);
const char *
channel_listener_state_to_string(channel_listener_state_t state);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Abstract channel operations */
void channel_mark_for_close(channel_t *chan);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
void channel_write_cell(channel_t *chan, cell_t *cell);
void channel_write_packed_cell(channel_t *chan, packed_cell_t *cell);
void channel_write_var_cell(channel_t *chan, var_cell_t *cell);
void channel_listener_mark_for_close(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Channel callback registrations */
/* Listener callback */
channel_listener_fn_ptr
channel_listener_get_listener_fn(channel_listener_t *chan);
void channel_listener_set_listener_fn(channel_listener_t *chan,
channel_listener_fn_ptr listener);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Incoming cell callbacks */
channel_cell_handler_fn_ptr channel_get_cell_handler(channel_t *chan);
channel_var_cell_handler_fn_ptr
channel_get_var_cell_handler(channel_t *chan);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
void channel_set_cell_handlers(channel_t *chan,
channel_cell_handler_fn_ptr cell_handler,
channel_var_cell_handler_fn_ptr
var_cell_handler);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Clean up closed channels and channel listeners periodically; these are
* called from run_scheduled_events() in main.c.
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
*/
void channel_run_cleanup(void);
void channel_listener_run_cleanup(void);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Close all channels and deallocate everything */
void channel_free_all(void);
/* Dump some statistics in the log */
void channel_dumpstats(int severity);
void channel_listener_dumpstats(int severity);
/* Set the cmux policy on all active channels */
void channel_set_cmux_policy_everywhere(circuitmux_policy_t *pol);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
#ifdef _TOR_CHANNEL_INTERNAL
/* Channel operations for subclasses and internal use only */
/* Initialize a newly allocated channel - do this first in subclass
* constructors.
*/
void channel_init(channel_t *chan);
void channel_init_listener(channel_listener_t *chan);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Channel registration/unregistration */
void channel_register(channel_t *chan);
void channel_unregister(channel_t *chan);
/* Channel listener registration/unregistration */
void channel_listener_register(channel_listener_t *chan_l);
void channel_listener_unregister(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Close from below */
void channel_close_from_lower_layer(channel_t *chan);
void channel_close_for_error(channel_t *chan);
void channel_closed(channel_t *chan);
void channel_listener_close_from_lower_layer(channel_listener_t *chan_l);
void channel_listener_close_for_error(channel_listener_t *chan_l);
void channel_listener_closed(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Free a channel */
void channel_free(channel_t *chan);
void channel_listener_free(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* State/metadata setters */
void channel_change_state(channel_t *chan, channel_state_t to_state);
void channel_clear_identity_digest(channel_t *chan);
void channel_clear_remote_end(channel_t *chan);
void channel_mark_local(channel_t *chan);
void channel_mark_incoming(channel_t *chan);
void channel_mark_outgoing(channel_t *chan);
void channel_set_identity_digest(channel_t *chan,
const char *identity_digest);
void channel_set_remote_end(channel_t *chan,
const char *identity_digest,
const char *nickname);
void channel_listener_change_state(channel_listener_t *chan_l,
channel_listener_state_t to_state);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Timestamp updates */
void channel_timestamp_created(channel_t *chan);
void channel_timestamp_active(channel_t *chan);
void channel_timestamp_drained(channel_t *chan);
void channel_timestamp_recv(channel_t *chan);
void channel_timestamp_xmit(channel_t *chan);
void channel_listener_timestamp_created(channel_listener_t *chan_l);
void channel_listener_timestamp_active(channel_listener_t *chan_l);
void channel_listener_timestamp_accepted(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Incoming channel handling */
void channel_listener_process_incoming(channel_listener_t *listener);
void channel_listener_queue_incoming(channel_listener_t *listener,
channel_t *incoming);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Incoming cell handling */
void channel_process_cells(channel_t *chan);
void channel_queue_cell(channel_t *chan, cell_t *cell);
void channel_queue_var_cell(channel_t *chan, var_cell_t *var_cell);
/* Outgoing cell handling */
void channel_flush_cells(channel_t *chan);
/* Request from lower layer for more cells if available */
ssize_t channel_flush_some_cells(channel_t *chan, ssize_t num_cells);
/* Query if data available on this channel */
int channel_more_to_flush(channel_t *chan);
/* Notify flushed outgoing for dirreq handling */
void channel_notify_flushed(channel_t *chan);
/* Handle stuff we need to do on open like notifying circuits */
void channel_do_open_actions(channel_t *chan);
#endif
/* Helper functions to perform operations on channels */
int channel_send_destroy(circid_t circ_id, channel_t *chan,
int reason);
/*
* Outside abstract interfaces that should eventually get turned into
* something transport/address format independent.
*/
channel_t * channel_connect(const tor_addr_t *addr, uint16_t port,
const char *id_digest);
channel_t * channel_get_for_extend(const char *digest,
const tor_addr_t *target_addr,
const char **msg_out,
int *launch_out);
/* Ask which of two channels is better for circuit-extension purposes */
int channel_is_better(time_t now,
channel_t *a, channel_t *b,
int forgive_new_connections);
/** Channel lookups
*/
channel_t * channel_find_by_global_id(uint64_t global_identifier);
channel_t * channel_find_by_remote_digest(const char *identity_digest);
/** For things returned by channel_find_by_remote_digest(), walk the list.
*/
channel_t * channel_next_with_digest(channel_t *chan);
channel_t * channel_prev_with_digest(channel_t *chan);
/*
* Metadata queries/updates
*/
const char * channel_describe_transport(channel_t *chan);
void channel_dump_statistics(channel_t *chan, int severity);
void channel_dump_transport_statistics(channel_t *chan, int severity);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
const char * channel_get_actual_remote_descr(channel_t *chan);
int channel_get_addr_if_possible(channel_t *chan, tor_addr_t *addr_out);
const char * channel_get_canonical_remote_descr(channel_t *chan);
int channel_has_queued_writes(channel_t *chan);
int channel_is_bad_for_new_circs(channel_t *chan);
void channel_mark_bad_for_new_circs(channel_t *chan);
int channel_is_canonical(channel_t *chan);
int channel_is_canonical_is_reliable(channel_t *chan);
int channel_is_client(channel_t *chan);
int channel_is_local(channel_t *chan);
int channel_is_incoming(channel_t *chan);
int channel_is_outgoing(channel_t *chan);
void channel_mark_client(channel_t *chan);
int channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info);
int channel_matches_target_addr_for_extend(channel_t *chan,
const tor_addr_t *target);
unsigned int channel_num_circuits(channel_t *chan);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
void channel_set_circid_type(channel_t *chan, crypto_pk_t *identity_rcvd);
void channel_timestamp_client(channel_t *chan);
const char * channel_listener_describe_transport(channel_listener_t *chan_l);
void channel_listener_dump_statistics(channel_listener_t *chan_l,
int severity);
void channel_listener_dump_transport_statistics(channel_listener_t *chan_l,
int severity);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
/* Timestamp queries */
time_t channel_when_created(channel_t *chan);
time_t channel_when_last_active(channel_t *chan);
time_t channel_when_last_client(channel_t *chan);
time_t channel_when_last_drained(channel_t *chan);
time_t channel_when_last_recv(channel_t *chan);
time_t channel_when_last_xmit(channel_t *chan);
time_t channel_listener_when_created(channel_listener_t *chan_l);
time_t channel_listener_when_last_active(channel_listener_t *chan_l);
time_t channel_listener_when_last_accepted(channel_listener_t *chan_l);
/* Counter queries */
uint64_t channel_count_recved(channel_t *chan);
uint64_t channel_count_xmitted(channel_t *chan);
uint64_t channel_listener_count_accepted(channel_listener_t *chan_l);
Add channel.c/channel.h for bug 6465 Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 90 commits: Add channel.c/channel.h for bug 6465 Fix make check-spaces in new channel.c/channel.h Make sure new channel.h is in nodist_HEADERS and Makefile.nmake is up to date too Add channel_state_t and state utility functions Add channel_change_state() Better comments in channel.h Add CHANNEL_STATE_LISTENING for channel_t Fix wide line in channel.c Add structures/prototypes for incoming cell handling Implement channel_queue_cell() and channel_queue_var_cell() Implement channel_process_cells() Fix asserts in channel_queue_cell() and channel_queue_var_cell() Add descriptive comments for channel_queue_cell() and channel_queue_var_cell() Implement channel cell handler getters/setters Queue outgoing writes when not in writeable state Drain queues and test assertions when changing channel_t state Add log_debug() messages for channel_t stuff Add log_debug() messages for channel_t stuff Add some channel_t metadata Add time_t client_used to channel_t Add channel_touched_by_client() Declare a few channel_t metadata queries we'll have to implement later for use by circuitbuild.c Add next_circ_id/circ_id_type to channel_t for use by circuitbuild.c Count n_circuits in channel_t Channel timestamp calls Add create timestamp for channel.h Declare some new metadata queries on channel_t Add get_real_remote_descr() prototype Move active_circuits stuff to channel_t, some other or.h and channel.h changes Make channel_t refcounted and use global lists of active channels Update channel_request_close() and channel_change_state() for channel_t registration mechanism Handle closing channels sensibly Add global_identifier for channels, channel_init() internal use function Add timestamp_last_added_nonpadding to channel_t Better comments in channel_init() Correctly handle next_circ_id in channel_init() Correctly handle next_circ_id in channel_init() and even compile this time Appease make check-spaces Update timestamps when writing cells to channel_t Add channel_flush_some_cells() to call channel_flush_from_first_active_circuit() Add registered channel lookup functions Get rid of client_used in or_connection_t; it's in channel_t now Get rid of circ_id_type in or_connection_t; implement channel_set_circ_id_type() Eliminate is_bad_for_new_circs in or_connection_t; implement getter/setter for it in channel_t Eliminate next_circ_id in or_connection_t in favor of channel_t Handle packed cells in channel_t for relay.c Add channel_identity_map and related functions Handle add/remove from channel identity map on state transitions Implement channel_is_local() and channel_mark_local() Implement channel_is_client() and channel_mark_client() Implement channel_is_outgoing() and channel_mark_outgoing() Eliminate declaration for redundant channel_nonopen_was_started_here() Add channel timestamps Add channel timestamps, fix some make-check-spaces complaints Remove redundant channel_was_started_here() function and initiated_remotely bit Rename channel_get_remote_descr()/channel_get_real_remote_descr() to something clearer in channel.h Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in channel.h Change return type of channel_is_bad_for_new_circs() to int for consistency Implement channel_has_queued_writes() Rename channel_touched_by_client() and client_used field for consistency with other timestamps in channel.{c,h} Implement channel_get_actual_remote_descr() and channel_get_canonical_remote_descr() in channel.{c,h} Implement channel_matches_extend_info() in channel.{c,h} Implement channel_get_for_extend() and channel_is_better() in channel.{c,h} Make channel_is_better() public in channel.{c,h} Implement channel_matches_target_addr_for_extend() in channel.{c,h} Implement channel_is_canonical_is_reliable() in channel.{c,h} Demoronize get_remote_descr() method prototype - what the hell was I thinking there? Timestamp channels in the right places in channel.c Add missing tor_assert() in channel.c Check if the lower layer accepted a cell in channel_write_cell() et al. of channel.c Implement channel_flush_cells() in channel.c (w00t, it builds at last) Call channel_timestamp_drained() at the right places in channel.c Implement channel_run_cleanup() Support optional channel_get_remote_addr() method and use it for GeoIP in channel_do_open_actions() Get rid of channel refcounting; it'll be too complicated to handle it properly with all the pointers from circuits to channels, and closing from channel_run_cleanup() will work okay just like with connections Doxygenate channel.c Appease make check-spaces in channel.c Fix superfluous semicolons in channel.c Add/remove channels from identity digest map in all the right places in channel.c The cell queues on channel_t must be empty when going to a CLOSED or ERROR state Appease make check-spaces in channel.c Add channel_clear/set_identity_digest() and some better logging to channel.{c,h} Fix better logging to channel.c Avoid SIGSEGV testing for queue emptiness in channel_flush_some_cells_from_outgoing_queue() Remove TODO about checking cell queue in channel_free(); no need for it Appease make check-spaces in channel.c Add channel_free_all() and support functions Check nullness of active_circuit_pqueue in channel_free() Fix SMARTLIST_FOREACH_END usage in channel_process_cells() Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in channel.{c,h}
2012-07-31 06:49:39 +02:00
#endif