tor/src/or/channel.h

724 lines
25 KiB
C
Raw Normal View History

2017-03-15 21:13:17 +01:00
/* * Copyright (c) 2012-2017, The Tor Project, Inc. */
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
/* See LICENSE for licensing information */
/**
* \file channel.h
* \brief Header file for channel.c
**/
Convert all include-guard macros to avoid reserved identifiers. In C, we technically aren't supposed to define our own things that start with an underscore. This is a purely machine-generated commit. First, I ran this script on all the headers in src/{common,or,test,tools/*}/*.h : ============================== use strict; my %macros = (); my %skipped = (); FILE: for my $fn (@ARGV) { my $f = $fn; if ($fn !~ /^\.\//) { $f = "./$fn"; } $skipped{$fn} = 0; open(F, $fn); while (<F>) { if (/^#ifndef ([A-Za-z0-9_]+)/) { $macros{$fn} = $1; next FILE; } } } print "#!/usr/bin/perl -w -i -p\n\n"; for my $fn (@ARGV) { if (! exists $macros{$fn}) { print "# No macro known for $fn!\n" if (!$skipped{$fn}); next; } if ($macros{$fn} !~ /_H_?$/) { print "# Weird macro for $fn...\n"; } my $goodmacro = uc $fn; $goodmacro =~ s#.*/##; $goodmacro =~ s#[\/\-\.]#_#g; print "s/(?<![A-Za-z0-9_])$macros{$fn}(?![A-Za-z0-9_])/TOR_${goodmacro}/g;\n" } ============================== It produced the following output, which I then re-ran on those same files: ============================== s/(?<![A-Za-z0-9_])_TOR_ADDRESS_H(?![A-Za-z0-9_])/TOR_ADDRESS_H/g; s/(?<![A-Za-z0-9_])_TOR_AES_H(?![A-Za-z0-9_])/TOR_AES_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_H(?![A-Za-z0-9_])/TOR_COMPAT_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_LIBEVENT_H(?![A-Za-z0-9_])/TOR_COMPAT_LIBEVENT_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTAINER_H(?![A-Za-z0-9_])/TOR_CONTAINER_H/g; s/(?<![A-Za-z0-9_])_TOR_CRYPTO_H(?![A-Za-z0-9_])/TOR_CRYPTO_H/g; s/(?<![A-Za-z0-9_])TOR_DI_OPS_H(?![A-Za-z0-9_])/TOR_DI_OPS_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMAREA_H(?![A-Za-z0-9_])/TOR_MEMAREA_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMPOOL_H(?![A-Za-z0-9_])/TOR_MEMPOOL_H/g; s/(?<![A-Za-z0-9_])TOR_PROCMON_H(?![A-Za-z0-9_])/TOR_PROCMON_H/g; s/(?<![A-Za-z0-9_])_TOR_TORGZIP_H(?![A-Za-z0-9_])/TOR_TORGZIP_H/g; s/(?<![A-Za-z0-9_])_TOR_TORINT_H(?![A-Za-z0-9_])/TOR_TORINT_H/g; s/(?<![A-Za-z0-9_])_TOR_LOG_H(?![A-Za-z0-9_])/TOR_TORLOG_H/g; s/(?<![A-Za-z0-9_])_TOR_TORTLS_H(?![A-Za-z0-9_])/TOR_TORTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_UTIL_H(?![A-Za-z0-9_])/TOR_UTIL_H/g; s/(?<![A-Za-z0-9_])_TOR_BUFFERS_H(?![A-Za-z0-9_])/TOR_BUFFERS_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_H(?![A-Za-z0-9_])/TOR_CHANNEL_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_TLS_H(?![A-Za-z0-9_])/TOR_CHANNELTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITBUILD_H(?![A-Za-z0-9_])/TOR_CIRCUITBUILD_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITLIST_H(?![A-Za-z0-9_])/TOR_CIRCUITLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITUSE_H(?![A-Za-z0-9_])/TOR_CIRCUITUSE_H/g; s/(?<![A-Za-z0-9_])_TOR_COMMAND_H(?![A-Za-z0-9_])/TOR_COMMAND_H/g; s/(?<![A-Za-z0-9_])_TOR_CONFIG_H(?![A-Za-z0-9_])/TOR_CONFIG_H/g; s/(?<![A-Za-z0-9_])TOR_CONFPARSE_H(?![A-Za-z0-9_])/TOR_CONFPARSE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_EDGE_H(?![A-Za-z0-9_])/TOR_CONNECTION_EDGE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_H(?![A-Za-z0-9_])/TOR_CONNECTION_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_OR_H(?![A-Za-z0-9_])/TOR_CONNECTION_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTROL_H(?![A-Za-z0-9_])/TOR_CONTROL_H/g; s/(?<![A-Za-z0-9_])_TOR_CPUWORKER_H(?![A-Za-z0-9_])/TOR_CPUWORKER_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRECTORY_H(?![A-Za-z0-9_])/TOR_DIRECTORY_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRSERV_H(?![A-Za-z0-9_])/TOR_DIRSERV_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRVOTE_H(?![A-Za-z0-9_])/TOR_DIRVOTE_H/g; s/(?<![A-Za-z0-9_])_TOR_DNS_H(?![A-Za-z0-9_])/TOR_DNS_H/g; s/(?<![A-Za-z0-9_])_TOR_DNSSERV_H(?![A-Za-z0-9_])/TOR_DNSSERV_H/g; s/(?<![A-Za-z0-9_])TOR_EVENTDNS_TOR_H(?![A-Za-z0-9_])/TOR_EVENTDNS_TOR_H/g; s/(?<![A-Za-z0-9_])_TOR_GEOIP_H(?![A-Za-z0-9_])/TOR_GEOIP_H/g; s/(?<![A-Za-z0-9_])_TOR_HIBERNATE_H(?![A-Za-z0-9_])/TOR_HIBERNATE_H/g; s/(?<![A-Za-z0-9_])_TOR_MAIN_H(?![A-Za-z0-9_])/TOR_MAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_MICRODESC_H(?![A-Za-z0-9_])/TOR_MICRODESC_H/g; s/(?<![A-Za-z0-9_])_TOR_NETWORKSTATUS_H(?![A-Za-z0-9_])/TOR_NETWORKSTATUS_H/g; s/(?<![A-Za-z0-9_])_TOR_NODELIST_H(?![A-Za-z0-9_])/TOR_NODELIST_H/g; s/(?<![A-Za-z0-9_])_TOR_NTMAIN_H(?![A-Za-z0-9_])/TOR_NTMAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_ONION_H(?![A-Za-z0-9_])/TOR_ONION_H/g; s/(?<![A-Za-z0-9_])_TOR_OR_H(?![A-Za-z0-9_])/TOR_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_POLICIES_H(?![A-Za-z0-9_])/TOR_POLICIES_H/g; s/(?<![A-Za-z0-9_])_TOR_REASONS_H(?![A-Za-z0-9_])/TOR_REASONS_H/g; s/(?<![A-Za-z0-9_])_TOR_RELAY_H(?![A-Za-z0-9_])/TOR_RELAY_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCLIENT_H(?![A-Za-z0-9_])/TOR_RENDCLIENT_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCOMMON_H(?![A-Za-z0-9_])/TOR_RENDCOMMON_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDMID_H(?![A-Za-z0-9_])/TOR_RENDMID_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDSERVICE_H(?![A-Za-z0-9_])/TOR_RENDSERVICE_H/g; s/(?<![A-Za-z0-9_])_TOR_REPHIST_H(?![A-Za-z0-9_])/TOR_REPHIST_H/g; s/(?<![A-Za-z0-9_])_TOR_REPLAYCACHE_H(?![A-Za-z0-9_])/TOR_REPLAYCACHE_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTER_H(?![A-Za-z0-9_])/TOR_ROUTER_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERLIST_H(?![A-Za-z0-9_])/TOR_ROUTERLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERPARSE_H(?![A-Za-z0-9_])/TOR_ROUTERPARSE_H/g; s/(?<![A-Za-z0-9_])TOR_ROUTERSET_H(?![A-Za-z0-9_])/TOR_ROUTERSET_H/g; s/(?<![A-Za-z0-9_])TOR_STATEFILE_H(?![A-Za-z0-9_])/TOR_STATEFILE_H/g; s/(?<![A-Za-z0-9_])_TOR_STATUS_H(?![A-Za-z0-9_])/TOR_STATUS_H/g; s/(?<![A-Za-z0-9_])TOR_TRANSPORTS_H(?![A-Za-z0-9_])/TOR_TRANSPORTS_H/g; s/(?<![A-Za-z0-9_])_TOR_TEST_H(?![A-Za-z0-9_])/TOR_TEST_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_NATPMP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_NATPMP_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_UPNP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_UPNP_H/g; ==============================
2012-10-12 18:13:10 +02:00
#ifndef TOR_CHANNEL_H
#define TOR_CHANNEL_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
#include "or.h"
#include "circuitmux.h"
#include "timers.h"
#include "handles.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;
TOR_SIMPLEQ_HEAD(chan_cell_queue, cell_queue_entry_s);
typedef struct chan_cell_queue chan_cell_queue_t;
/**
* This enum is used by channelpadding to decide when to pad channels.
* Don't add values to it without updating the checks in
* channelpadding_decide_to_pad_channel().
*/
typedef enum {
CHANNEL_USED_NOT_USED_FOR_FULL_CIRCS = 0,
CHANNEL_USED_FOR_FULL_CIRCS,
CHANNEL_USED_FOR_USER_TRAFFIC,
} channel_usage_info_t;
/**
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;
/** List entry for hashtable for global-identifier lookup. */
HT_ENTRY(channel_s) gidmap_node;
/** Handle entry for handle-based lookup */
HANDLE_ENTRY(channel, channel_s);
/** Current channel 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
channel_state_t state;
/** Globally unique ID number for a channel over the lifetime of a Tor
* process. This may not be 0.
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
*/
uint64_t global_identifier;
/** Should we expect to see this channel in the channel lists? */
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
unsigned char registered:1;
/** has this channel ever been open? */
unsigned int has_been_open:1;
/**
* This field indicates if the other side has enabled or disabled
* padding via either the link protocol version or
* channelpadding_negotiate cells.
*
* Clients can override this with ConnectionPadding in torrc to
* disable or force padding to relays, but relays cannot override the
* client's request.
*/
unsigned int padding_enabled:1;
/** Cached value of our decision to pad (to avoid expensive
* checks during critical path statistics counting). */
unsigned int currently_padding:1;
/** Is there a pending netflow padding callback? */
unsigned int pending_padding_callback:1;
/** Is our peer likely to consider this channel canonical? */
unsigned int is_canonical_to_peer:1;
/** Has this channel ever been used for non-directory traffic?
* Used to decide what channels to pad, and when. */
channel_usage_info_t channel_usage;
/** When should we send a cell for netflow padding, in absolute
* milliseconds since monotime system start. 0 means no padding
* is scheduled. */
uint64_t next_padding_time_ms;
/** The callback pointer for the padding callbacks */
tor_timer_t *padding_timer;
/** The handle to this channel (to free on canceled timers) */
struct channel_handle_t *timer_handle;
/**
* These two fields specify the minimum and maximum negotiated timeout
* values for inactivity (send or receive) before we decide to pad a
* channel. These fields can be set either via a PADDING_NEGOTIATE cell,
* or the torrc option ReducedConnectionPadding. The consensus parameters
* nf_ito_low and nf_ito_high are used to ensure that padding can only be
* negotiated to be less frequent than what is specified in the consensus.
* (This is done to prevent wingnut clients from requesting excessive
* padding).
*
* The actual timeout value is randomly chosen between these two values
* as per the table in channelpadding_get_netflow_inactive_timeout_ms(),
* after ensuring that these values do not specify lower timeouts than
* the consensus parameters.
*
* If these are 0, we have not negotiated or specified custom padding
* times, and instead use consensus defaults. */
uint16_t padding_timeout_low_ms;
uint16_t padding_timeout_high_ms;
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
/** Why did we close?
*/
enum {
CHANNEL_NOT_CLOSING = 0,
CHANNEL_CLOSE_REQUESTED,
CHANNEL_CLOSE_FROM_BELOW,
CHANNEL_CLOSE_FOR_ERROR
} reason_for_closing;
/** State variable for use by the scheduler */
enum {
/*
* The channel is not open, or it has a full output buffer but no queued
* cells.
*/
SCHED_CHAN_IDLE = 0,
/*
* The channel has space on its output buffer to write, but no queued
* cells.
*/
SCHED_CHAN_WAITING_FOR_CELLS,
/*
* The scheduler has queued cells but no output buffer space to write.
*/
SCHED_CHAN_WAITING_TO_WRITE,
/*
* The scheduler has both queued cells and output buffer space, and is
* eligible for the scheduler loop.
*/
SCHED_CHAN_PENDING
} scheduler_state;
/** Heap index for use by the scheduler */
int sched_heap_idx;
/** Timestamps for both cell channels and listeners */
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
time_t timestamp_created; /* Channel created */
time_t timestamp_active; /* Any activity */
/**
* This is a high-resolution monotonic timestamp that marks when we
* believe the channel has actually sent or received data to/from
* the wire. Right now, it is used to determine when we should send
* a padding cell for channelpadding.
*
* XXX: Are we setting timestamp_xfer_ms in the right places to
* accurately reflect actual network data transfer? Or might this be
* very wrong wrt when bytes actually go on the wire?
*/
uint64_t timestamp_xfer_ms;
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
/* Methods implemented by the lower layer */
/** Free a channel */
void (*free_fn)(channel_t *);
/** Close an open channel */
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 (*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 lower layer for an estimate of the average overhead for
* transmissions on this channel.
*/
double (*get_overhead_estimate)(channel_t *);
/*
* 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 *);
int (*get_transport_name)(channel_t *chan, char **transport_out);
#define GRD_FLAG_ORIGINAL 1
#define GRD_FLAG_ADDR_ONLY 2
/**
* Get a text description of the remote endpoint; canonicalized if the flag
* GRD_FLAG_ORIGINAL is not set, or the one we originally connected
* to/received from if it is. If GRD_FLAG_ADDR_ONLY is set, we return only
* the original address.
*/
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 *);
/* Ask the lower layer how many bytes it has queued but not yet sent */
size_t (*num_bytes_queued)(channel_t *);
/* Ask the lower layer how many cells can be written */
int (*num_cells_writeable)(channel_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 RSA identity key -- or
* zeroes if we don't have an RSA identity in mind for the other side, and
* it hasn't shown us one.
*
* Note that this is the RSA identity that we hope the other side has -- not
* necessarily its true identity. Don't believe this identity unless
* authentication has happened.
*/
char identity_digest[DIGEST_LEN];
/**
* Ed25519 key for the other side of this channel -- or zeroes if we don't
* have an Ed25519 identity in mind for the other side, and it hasn't shown
* us one.
*
* Note that this is the identity that we hope the other side has -- not
* necessarily its true identity. Don't believe this identity unless
* authentication has happened.
*/
ed25519_public_key_t ed25519_identity;
/** Nickname of the OR on the other side, or NULL if none. */
char *nickname;
/**
* Linked list of channels with the same RSA identity digest, for use with
* the digest->channel map
*/
TOR_LIST_ENTRY(channel_s) next_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_bitfield_t circ_id_type:2;
2016-03-26 15:11:45 +01:00
/* DOCDOC */
unsigned wide_circ_ids:1;
/** 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 or bridge relay. Connections 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;
/** Have we logged a warning about circID exhaustion on this channel?
* If so, when? */
ratelim_t last_warned_circ_ids_exhausted;
/** 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 run_connection_housekeeping(). We update this once a
* second when we run housekeeping and find a circuit on this channel, and
* whenever we add a circuit to the channel. */
time_t timestamp_last_had_circuits;
/** 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, n_bytes_recved;
uint64_t n_cells_xmitted, n_bytes_xmitted;
/** Our current contribution to the scheduler's total xmit queue */
uint64_t bytes_queued_for_xmit;
/** Number of bytes in this channel's cell queue; does not include
* lower-layer queueing.
*/
uint64_t bytes_in_queue;
};
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_fn)(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);
Rename all reserved C identifiers we defined For everything we declare that starts with _, make it end with _ instead. This is a machine-generated patch. To make it, start by getting the list of reserved identifiers using: git ls-tree -r --name-only HEAD | grep '\.[ch]$' | \ xargs ctags --c-kinds=defglmpstuvx -o - | grep '^_' | \ cut -f 1 | sort| uniq You might need gnu ctags. Then pipe the output through this script: ============================== use strict; BEGIN { print "#!/usr/bin/perl -w -i -p\n\n"; } chomp; next if ( /^__attribute__/ or /^__func__/ or /^_FILE_OFFSET_BITS/ or /^_FORTIFY_SOURCE/ or /^_GNU_SOURCE/ or /^_WIN32/ or /^_DARWIN_UNLIMITED/ or /^_FILE_OFFSET_BITS/ or /^_LARGEFILE64_SOURCE/ or /^_LFS64_LARGEFILE/ or /^__cdecl/ or /^__attribute__/ or /^__func__/ or /^_WIN32_WINNT/); my $ident = $_; my $better = $ident; $better =~ s/^_//; $better = "${better}_"; print "s/(?<![A-Za-z0-9_])$ident(?![A-Za-z0-9_])/$better/g;\n"; ============================== Then run the resulting script on all the files you want to change. (That is, all the C except that in src/ext.) The resulting script was: ============================== s/(?<![A-Za-z0-9_])_address(?![A-Za-z0-9_])/address_/g; s/(?<![A-Za-z0-9_])_aes_fill_buf(?![A-Za-z0-9_])/aes_fill_buf_/g; s/(?<![A-Za-z0-9_])_AllowInvalid(?![A-Za-z0-9_])/AllowInvalid_/g; s/(?<![A-Za-z0-9_])_AP_CONN_STATE_MAX(?![A-Za-z0-9_])/AP_CONN_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_AP_CONN_STATE_MIN(?![A-Za-z0-9_])/AP_CONN_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_assert_cache_ok(?![A-Za-z0-9_])/assert_cache_ok_/g; s/(?<![A-Za-z0-9_])_A_UNKNOWN(?![A-Za-z0-9_])/A_UNKNOWN_/g; s/(?<![A-Za-z0-9_])_base(?![A-Za-z0-9_])/base_/g; s/(?<![A-Za-z0-9_])_BridgePassword_AuthDigest(?![A-Za-z0-9_])/BridgePassword_AuthDigest_/g; s/(?<![A-Za-z0-9_])_buffer_stats_compare_entries(?![A-Za-z0-9_])/buffer_stats_compare_entries_/g; s/(?<![A-Za-z0-9_])_chan_circid_entries_eq(?![A-Za-z0-9_])/chan_circid_entries_eq_/g; s/(?<![A-Za-z0-9_])_chan_circid_entry_hash(?![A-Za-z0-9_])/chan_circid_entry_hash_/g; s/(?<![A-Za-z0-9_])_check_no_tls_errors(?![A-Za-z0-9_])/check_no_tls_errors_/g; s/(?<![A-Za-z0-9_])_c_hist_compare(?![A-Za-z0-9_])/c_hist_compare_/g; s/(?<![A-Za-z0-9_])_circ(?![A-Za-z0-9_])/circ_/g; s/(?<![A-Za-z0-9_])_circuit_get_global_list(?![A-Za-z0-9_])/circuit_get_global_list_/g; s/(?<![A-Za-z0-9_])_circuit_mark_for_close(?![A-Za-z0-9_])/circuit_mark_for_close_/g; s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_C_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_C_MAX_/g; s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_MAX_/g; s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_MIN(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_MIN_/g; s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_OR_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_OR_MAX_/g; s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_OR_MIN(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_OR_MIN_/g; s/(?<![A-Za-z0-9_])_cmp_int_strings(?![A-Za-z0-9_])/cmp_int_strings_/g; s/(?<![A-Za-z0-9_])_compare_cached_resolves_by_expiry(?![A-Za-z0-9_])/compare_cached_resolves_by_expiry_/g; s/(?<![A-Za-z0-9_])_compare_digests(?![A-Za-z0-9_])/compare_digests_/g; s/(?<![A-Za-z0-9_])_compare_digests256(?![A-Za-z0-9_])/compare_digests256_/g; s/(?<![A-Za-z0-9_])_compare_dir_src_ents_by_authority_id(?![A-Za-z0-9_])/compare_dir_src_ents_by_authority_id_/g; s/(?<![A-Za-z0-9_])_compare_duration_idx(?![A-Za-z0-9_])/compare_duration_idx_/g; s/(?<![A-Za-z0-9_])_compare_int(?![A-Za-z0-9_])/compare_int_/g; s/(?<![A-Za-z0-9_])_compare_networkstatus_v2_published_on(?![A-Za-z0-9_])/compare_networkstatus_v2_published_on_/g; s/(?<![A-Za-z0-9_])_compare_old_routers_by_identity(?![A-Za-z0-9_])/compare_old_routers_by_identity_/g; s/(?<![A-Za-z0-9_])_compare_orports(?![A-Za-z0-9_])/compare_orports_/g; s/(?<![A-Za-z0-9_])_compare_pairs(?![A-Za-z0-9_])/compare_pairs_/g; s/(?<![A-Za-z0-9_])_compare_routerinfo_by_id_digest(?![A-Za-z0-9_])/compare_routerinfo_by_id_digest_/g; s/(?<![A-Za-z0-9_])_compare_routerinfo_by_ip_and_bw(?![A-Za-z0-9_])/compare_routerinfo_by_ip_and_bw_/g; s/(?<![A-Za-z0-9_])_compare_signed_descriptors_by_age(?![A-Za-z0-9_])/compare_signed_descriptors_by_age_/g; s/(?<![A-Za-z0-9_])_compare_string_ptrs(?![A-Za-z0-9_])/compare_string_ptrs_/g; s/(?<![A-Za-z0-9_])_compare_strings_for_pqueue(?![A-Za-z0-9_])/compare_strings_for_pqueue_/g; s/(?<![A-Za-z0-9_])_compare_strs(?![A-Za-z0-9_])/compare_strs_/g; s/(?<![A-Za-z0-9_])_compare_tor_version_str_ptr(?![A-Za-z0-9_])/compare_tor_version_str_ptr_/g; s/(?<![A-Za-z0-9_])_compare_vote_rs(?![A-Za-z0-9_])/compare_vote_rs_/g; s/(?<![A-Za-z0-9_])_compare_votes_by_authority_id(?![A-Za-z0-9_])/compare_votes_by_authority_id_/g; s/(?<![A-Za-z0-9_])_compare_without_first_ch(?![A-Za-z0-9_])/compare_without_first_ch_/g; s/(?<![A-Za-z0-9_])_connection_free(?![A-Za-z0-9_])/connection_free_/g; s/(?<![A-Za-z0-9_])_connection_mark_and_flush(?![A-Za-z0-9_])/connection_mark_and_flush_/g; s/(?<![A-Za-z0-9_])_connection_mark_for_close(?![A-Za-z0-9_])/connection_mark_for_close_/g; s/(?<![A-Za-z0-9_])_connection_mark_unattached_ap(?![A-Za-z0-9_])/connection_mark_unattached_ap_/g; s/(?<![A-Za-z0-9_])_connection_write_to_buf_impl(?![A-Za-z0-9_])/connection_write_to_buf_impl_/g; s/(?<![A-Za-z0-9_])_ConnLimit(?![A-Za-z0-9_])/ConnLimit_/g; s/(?<![A-Za-z0-9_])_CONN_TYPE_MAX(?![A-Za-z0-9_])/CONN_TYPE_MAX_/g; s/(?<![A-Za-z0-9_])_CONN_TYPE_MIN(?![A-Za-z0-9_])/CONN_TYPE_MIN_/g; s/(?<![A-Za-z0-9_])_CONTROL_CONN_STATE_MAX(?![A-Za-z0-9_])/CONTROL_CONN_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_CONTROL_CONN_STATE_MIN(?![A-Za-z0-9_])/CONTROL_CONN_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_CPUWORKER_STATE_MAX(?![A-Za-z0-9_])/CPUWORKER_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_CPUWORKER_STATE_MIN(?![A-Za-z0-9_])/CPUWORKER_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_crypto_dh_get_dh(?![A-Za-z0-9_])/crypto_dh_get_dh_/g; s/(?<![A-Za-z0-9_])_crypto_global_initialized(?![A-Za-z0-9_])/crypto_global_initialized_/g; s/(?<![A-Za-z0-9_])_crypto_new_pk_from_rsa(?![A-Za-z0-9_])/crypto_new_pk_from_rsa_/g; s/(?<![A-Za-z0-9_])_crypto_pk_get_evp_pkey(?![A-Za-z0-9_])/crypto_pk_get_evp_pkey_/g; s/(?<![A-Za-z0-9_])_crypto_pk_get_rsa(?![A-Za-z0-9_])/crypto_pk_get_rsa_/g; s/(?<![A-Za-z0-9_])_DIR_CONN_STATE_MAX(?![A-Za-z0-9_])/DIR_CONN_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_DIR_CONN_STATE_MIN(?![A-Za-z0-9_])/DIR_CONN_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_DIR_PURPOSE_MAX(?![A-Za-z0-9_])/DIR_PURPOSE_MAX_/g; s/(?<![A-Za-z0-9_])_DIR_PURPOSE_MIN(?![A-Za-z0-9_])/DIR_PURPOSE_MIN_/g; s/(?<![A-Za-z0-9_])_dirreq_map_get(?![A-Za-z0-9_])/dirreq_map_get_/g; s/(?<![A-Za-z0-9_])_dirreq_map_put(?![A-Za-z0-9_])/dirreq_map_put_/g; s/(?<![A-Za-z0-9_])_dns_randfn(?![A-Za-z0-9_])/dns_randfn_/g; s/(?<![A-Za-z0-9_])_dummy(?![A-Za-z0-9_])/dummy_/g; s/(?<![A-Za-z0-9_])_edge(?![A-Za-z0-9_])/edge_/g; s/(?<![A-Za-z0-9_])_END_CIRC_REASON_MAX(?![A-Za-z0-9_])/END_CIRC_REASON_MAX_/g; s/(?<![A-Za-z0-9_])_END_CIRC_REASON_MIN(?![A-Za-z0-9_])/END_CIRC_REASON_MIN_/g; s/(?<![A-Za-z0-9_])_EOF(?![A-Za-z0-9_])/EOF_/g; s/(?<![A-Za-z0-9_])_ERR(?![A-Za-z0-9_])/ERR_/g; s/(?<![A-Za-z0-9_])_escaped_val(?![A-Za-z0-9_])/escaped_val_/g; s/(?<![A-Za-z0-9_])_evdns_log(?![A-Za-z0-9_])/evdns_log_/g; s/(?<![A-Za-z0-9_])_evdns_nameserver_add_impl(?![A-Za-z0-9_])/evdns_nameserver_add_impl_/g; s/(?<![A-Za-z0-9_])_EVENT_MAX(?![A-Za-z0-9_])/EVENT_MAX_/g; s/(?<![A-Za-z0-9_])_EVENT_MIN(?![A-Za-z0-9_])/EVENT_MIN_/g; s/(?<![A-Za-z0-9_])_ExcludeExitNodesUnion(?![A-Za-z0-9_])/ExcludeExitNodesUnion_/g; s/(?<![A-Za-z0-9_])_EXIT_CONN_STATE_MAX(?![A-Za-z0-9_])/EXIT_CONN_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_EXIT_CONN_STATE_MIN(?![A-Za-z0-9_])/EXIT_CONN_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_EXIT_PURPOSE_MAX(?![A-Za-z0-9_])/EXIT_PURPOSE_MAX_/g; s/(?<![A-Za-z0-9_])_EXIT_PURPOSE_MIN(?![A-Za-z0-9_])/EXIT_PURPOSE_MIN_/g; s/(?<![A-Za-z0-9_])_extrainfo_free(?![A-Za-z0-9_])/extrainfo_free_/g; s/(?<![A-Za-z0-9_])_find_by_keyword(?![A-Za-z0-9_])/find_by_keyword_/g; s/(?<![A-Za-z0-9_])_free_cached_dir(?![A-Za-z0-9_])/free_cached_dir_/g; s/(?<![A-Za-z0-9_])_free_cached_resolve(?![A-Za-z0-9_])/free_cached_resolve_/g; s/(?<![A-Za-z0-9_])_free_duplicate_routerstatus_entry(?![A-Za-z0-9_])/free_duplicate_routerstatus_entry_/g; s/(?<![A-Za-z0-9_])_free_link_history(?![A-Za-z0-9_])/free_link_history_/g; s/(?<![A-Za-z0-9_])_geoip_compare_entries(?![A-Za-z0-9_])/geoip_compare_entries_/g; s/(?<![A-Za-z0-9_])_geoip_compare_key_to_entry(?![A-Za-z0-9_])/geoip_compare_key_to_entry_/g; s/(?<![A-Za-z0-9_])_hex_decode_digit(?![A-Za-z0-9_])/hex_decode_digit_/g; s/(?<![A-Za-z0-9_])_idxplus1(?![A-Za-z0-9_])/idxplus1_/g; s/(?<![A-Za-z0-9_])__libc_enable_secure(?![A-Za-z0-9_])/_libc_enable_secure_/g; s/(?<![A-Za-z0-9_])_log_debug(?![A-Za-z0-9_])/log_debug_/g; s/(?<![A-Za-z0-9_])_log_err(?![A-Za-z0-9_])/log_err_/g; s/(?<![A-Za-z0-9_])_log_fn(?![A-Za-z0-9_])/log_fn_/g; s/(?<![A-Za-z0-9_])_log_fn_function_name(?![A-Za-z0-9_])/log_fn_function_name_/g; s/(?<![A-Za-z0-9_])_log_global_min_severity(?![A-Za-z0-9_])/log_global_min_severity_/g; s/(?<![A-Za-z0-9_])_log_info(?![A-Za-z0-9_])/log_info_/g; s/(?<![A-Za-z0-9_])_log_notice(?![A-Za-z0-9_])/log_notice_/g; s/(?<![A-Za-z0-9_])_log_prefix(?![A-Za-z0-9_])/log_prefix_/g; s/(?<![A-Za-z0-9_])_log_warn(?![A-Za-z0-9_])/log_warn_/g; s/(?<![A-Za-z0-9_])_magic(?![A-Za-z0-9_])/magic_/g; s/(?<![A-Za-z0-9_])_MALLOC_LOCK(?![A-Za-z0-9_])/MALLOC_LOCK_/g; s/(?<![A-Za-z0-9_])_MALLOC_LOCK_INIT(?![A-Za-z0-9_])/MALLOC_LOCK_INIT_/g; s/(?<![A-Za-z0-9_])_MALLOC_UNLOCK(?![A-Za-z0-9_])/MALLOC_UNLOCK_/g; s/(?<![A-Za-z0-9_])_microdesc_eq(?![A-Za-z0-9_])/microdesc_eq_/g; s/(?<![A-Za-z0-9_])_microdesc_hash(?![A-Za-z0-9_])/microdesc_hash_/g; s/(?<![A-Za-z0-9_])_MIN_TOR_TLS_ERROR_VAL(?![A-Za-z0-9_])/MIN_TOR_TLS_ERROR_VAL_/g; s/(?<![A-Za-z0-9_])_mm_free(?![A-Za-z0-9_])/mm_free_/g; s/(?<![A-Za-z0-9_])_NIL(?![A-Za-z0-9_])/NIL_/g; s/(?<![A-Za-z0-9_])_n_openssl_mutexes(?![A-Za-z0-9_])/n_openssl_mutexes_/g; s/(?<![A-Za-z0-9_])_openssl_dynlock_create_cb(?![A-Za-z0-9_])/openssl_dynlock_create_cb_/g; s/(?<![A-Za-z0-9_])_openssl_dynlock_destroy_cb(?![A-Za-z0-9_])/openssl_dynlock_destroy_cb_/g; s/(?<![A-Za-z0-9_])_openssl_dynlock_lock_cb(?![A-Za-z0-9_])/openssl_dynlock_lock_cb_/g; s/(?<![A-Za-z0-9_])_openssl_locking_cb(?![A-Za-z0-9_])/openssl_locking_cb_/g; s/(?<![A-Za-z0-9_])_openssl_mutexes(?![A-Za-z0-9_])/openssl_mutexes_/g; s/(?<![A-Za-z0-9_])_option_abbrevs(?![A-Za-z0-9_])/option_abbrevs_/g; s/(?<![A-Za-z0-9_])_option_vars(?![A-Za-z0-9_])/option_vars_/g; s/(?<![A-Za-z0-9_])_OR_CONN_STATE_MAX(?![A-Za-z0-9_])/OR_CONN_STATE_MAX_/g; s/(?<![A-Za-z0-9_])_OR_CONN_STATE_MIN(?![A-Za-z0-9_])/OR_CONN_STATE_MIN_/g; s/(?<![A-Za-z0-9_])_OutboundBindAddressIPv4(?![A-Za-z0-9_])/OutboundBindAddressIPv4_/g; s/(?<![A-Za-z0-9_])_OutboundBindAddressIPv6(?![A-Za-z0-9_])/OutboundBindAddressIPv6_/g; s/(?<![A-Za-z0-9_])_PDS_PREFER_TUNNELED_DIR_CONNS(?![A-Za-z0-9_])/PDS_PREFER_TUNNELED_DIR_CONNS_/g; s/(?<![A-Za-z0-9_])_port(?![A-Za-z0-9_])/port_/g; s/(?<![A-Za-z0-9_])__progname(?![A-Za-z0-9_])/_progname_/g; s/(?<![A-Za-z0-9_])_PublishServerDescriptor(?![A-Za-z0-9_])/PublishServerDescriptor_/g; s/(?<![A-Za-z0-9_])_remove_old_client_helper(?![A-Za-z0-9_])/remove_old_client_helper_/g; s/(?<![A-Za-z0-9_])_rend_cache_entry_free(?![A-Za-z0-9_])/rend_cache_entry_free_/g; s/(?<![A-Za-z0-9_])_routerlist_find_elt(?![A-Za-z0-9_])/routerlist_find_elt_/g; s/(?<![A-Za-z0-9_])_SafeLogging(?![A-Za-z0-9_])/SafeLogging_/g; s/(?<![A-Za-z0-9_])_SHORT_FILE_(?![A-Za-z0-9_])/SHORT_FILE__/g; s/(?<![A-Za-z0-9_])_state_abbrevs(?![A-Za-z0-9_])/state_abbrevs_/g; s/(?<![A-Za-z0-9_])_state_vars(?![A-Za-z0-9_])/state_vars_/g; s/(?<![A-Za-z0-9_])_t(?![A-Za-z0-9_])/t_/g; s/(?<![A-Za-z0-9_])_t32(?![A-Za-z0-9_])/t32_/g; s/(?<![A-Za-z0-9_])_test_op_ip6(?![A-Za-z0-9_])/test_op_ip6_/g; s/(?<![A-Za-z0-9_])_thread1_name(?![A-Za-z0-9_])/thread1_name_/g; s/(?<![A-Za-z0-9_])_thread2_name(?![A-Za-z0-9_])/thread2_name_/g; s/(?<![A-Za-z0-9_])_thread_test_func(?![A-Za-z0-9_])/thread_test_func_/g; s/(?<![A-Za-z0-9_])_thread_test_mutex(?![A-Za-z0-9_])/thread_test_mutex_/g; s/(?<![A-Za-z0-9_])_thread_test_start1(?![A-Za-z0-9_])/thread_test_start1_/g; s/(?<![A-Za-z0-9_])_thread_test_start2(?![A-Za-z0-9_])/thread_test_start2_/g; s/(?<![A-Za-z0-9_])_thread_test_strmap(?![A-Za-z0-9_])/thread_test_strmap_/g; s/(?<![A-Za-z0-9_])_tor_calloc(?![A-Za-z0-9_])/tor_calloc_/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_INTERNAL(?![A-Za-z0-9_])/TOR_CHANNEL_INTERNAL_/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_C(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_C_/g; s/(?<![A-Za-z0-9_])_tor_free(?![A-Za-z0-9_])/tor_free_/g; s/(?<![A-Za-z0-9_])_tor_malloc(?![A-Za-z0-9_])/tor_malloc_/g; s/(?<![A-Za-z0-9_])_tor_malloc_zero(?![A-Za-z0-9_])/tor_malloc_zero_/g; s/(?<![A-Za-z0-9_])_tor_memdup(?![A-Za-z0-9_])/tor_memdup_/g; s/(?<![A-Za-z0-9_])_tor_realloc(?![A-Za-z0-9_])/tor_realloc_/g; s/(?<![A-Za-z0-9_])_tor_strdup(?![A-Za-z0-9_])/tor_strdup_/g; s/(?<![A-Za-z0-9_])_tor_strndup(?![A-Za-z0-9_])/tor_strndup_/g; s/(?<![A-Za-z0-9_])_TOR_TLS_SYSCALL(?![A-Za-z0-9_])/TOR_TLS_SYSCALL_/g; s/(?<![A-Za-z0-9_])_TOR_TLS_ZERORETURN(?![A-Za-z0-9_])/TOR_TLS_ZERORETURN_/g; s/(?<![A-Za-z0-9_])__USE_ISOC99(?![A-Za-z0-9_])/_USE_ISOC99_/g; s/(?<![A-Za-z0-9_])_UsingTestNetworkDefaults(?![A-Za-z0-9_])/UsingTestNetworkDefaults_/g; s/(?<![A-Za-z0-9_])_val(?![A-Za-z0-9_])/val_/g; s/(?<![A-Za-z0-9_])_void_for_alignment(?![A-Za-z0-9_])/void_for_alignment_/g; ==============================
2012-10-12 18:22:13 +02:00
#ifdef TOR_CHANNEL_INTERNAL_
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 CHANNEL_PRIVATE_
/* Cell queue structure (here rather than channel.c for test suite use) */
typedef struct cell_queue_entry_s cell_queue_entry_t;
struct cell_queue_entry_s {
TOR_SIMPLEQ_ENTRY(cell_queue_entry_s) next;
enum {
CELL_QUEUE_FIXED,
CELL_QUEUE_VAR,
CELL_QUEUE_PACKED
} type;
union {
struct {
cell_t *cell;
} fixed;
struct {
var_cell_t *var_cell;
} var;
struct {
packed_cell_t *packed_cell;
} packed;
} u;
};
/* Cell queue functions for benefit of test suite */
STATIC int chan_cell_queue_len(const chan_cell_queue_t *queue);
STATIC void cell_queue_entry_free(cell_queue_entry_t *q, int handed_off);
void channel_write_cell_generic_(channel_t *chan, const char *cell_type,
void *cell, cell_queue_entry_t *q);
#endif
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 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_change_state_open(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_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_mark_remote(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_identity_digest(channel_t *chan,
const char *identity_digest,
const ed25519_public_key_t *ed_identity);
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_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 */
MOCK_DECL(ssize_t, channel_flush_some_cells,
(channel_t *chan, ssize_t num_cells));
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
/* 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);
#ifdef TOR_UNIT_TESTS
extern uint64_t estimated_total_queue_size;
#endif
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
/* 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 *rsa_id_digest,
const ed25519_public_key_t *ed_id);
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_t * channel_get_for_extend(const char *rsa_id_digest,
const ed25519_public_key_t *ed_id,
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 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(channel_t *a, channel_t *b);
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 lookups
*/
channel_t * channel_find_by_global_id(uint64_t global_identifier);
channel_t * channel_find_by_remote_identity(const char *rsa_id_digest,
const ed25519_public_key_t *ed_id);
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
/** For things returned by channel_find_by_remote_digest(), walk the list.
* The RSA key will match for all returned elements; the Ed25519 key might not.
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_t * channel_next_with_rsa_identity(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
/*
* Helper macros to lookup state of given channel.
*/
#define CHANNEL_IS_CLOSED(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_CLOSED))
#define CHANNEL_IS_OPENING(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_OPENING))
#define CHANNEL_IS_OPEN(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_OPEN))
#define CHANNEL_IS_MAINT(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_MAINT))
#define CHANNEL_IS_CLOSING(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_CLOSING))
#define CHANNEL_IS_ERROR(chan) (channel_is_in_state((chan), \
CHANNEL_STATE_ERROR))
#define CHANNEL_FINISHED(chan) (CHANNEL_IS_CLOSED(chan) || \
CHANNEL_IS_ERROR(chan))
#define CHANNEL_CONDEMNED(chan) (CHANNEL_IS_CLOSING(chan) || \
CHANNEL_FINISHED(chan))
#define CHANNEL_CAN_HANDLE_CELLS(chan) (CHANNEL_IS_OPENING(chan) || \
CHANNEL_IS_OPEN(chan) || \
CHANNEL_IS_MAINT(chan))
static inline int
channel_is_in_state(channel_t *chan, channel_state_t state)
{
return chan->state == 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
/*
* Metadata queries/updates
*/
const char * channel_describe_transport(channel_t *chan);
MOCK_DECL(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);
const char * channel_get_actual_remote_address(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
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);
MOCK_DECL(void,channel_set_circid_type,(channel_t *chan,
crypto_pk_t *identity_rcvd,
int consider_identity));
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_timestamp_client(channel_t *chan);
void channel_update_xmit_queue_size(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
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);
void channel_check_for_duplicates(void);
void channel_update_bad_for_new_circs(const char *digest, int force);
/* Flow control queries */
uint64_t channel_get_global_queue_estimate(void);
int channel_num_cells_writeable(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
/* 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);
int packed_cell_is_destroy(channel_t *chan,
const packed_cell_t *packed_cell,
circid_t *circid_out);
/* Declare the handle helpers */
HANDLE_DECL(channel, channel_s,)
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