18 #include "tor_queue.h"
20 #define tor_timer_t timeout
33 CHANNEL_USED_NOT_USED_FOR_FULL_CIRCS = 0,
34 CHANNEL_USED_FOR_FULL_CIRCS,
35 CHANNEL_USED_FOR_USER_TRAFFIC,
46 #define circ_id_type_bitfield_t ENUM_BF(circ_id_type_t)
260 uint16_t padding_timeout_high_ms;
265 CHANNEL_NOT_CLOSING = 0,
266 CHANNEL_CLOSE_REQUESTED,
267 CHANNEL_CLOSE_FROM_BELOW,
268 CHANNEL_CLOSE_FOR_ERROR
299 time_t timestamp_active;
340 int (*get_transport_name)(
channel_t *chan,
char **transport_out);
407 unsigned wide_circ_ids:1;
476 CHANNEL_LISTENER_NOT_CLOSING = 0,
477 CHANNEL_LISTENER_CLOSE_REQUESTED,
478 CHANNEL_LISTENER_CLOSE_FROM_BELOW,
479 CHANNEL_LISTENER_CLOSE_FOR_ERROR
484 time_t timestamp_active;
535 channel_listener_fn_ptr listener);
541 channel_cell_handler_fn_ptr cell_handler);
556 #ifdef CHANNEL_OBJECT_PRIVATE
558 #ifdef CHANNEL_FILE_PRIVATE
591 #define channel_free(chan) FREE_AND_NULL(channel_t, channel_free_, (chan))
593 #define channel_listener_free(chan_l) \
594 FREE_AND_NULL(channel_listener_t, channel_listener_free_, (chan_l))
607 const char *identity_digest,
657 const char *rsa_id_digest,
661 const char *rsa_id_digest,
665 bool for_origin_circ,
666 const char **msg_out,
688 #define CHANNEL_IS_CLOSED(chan) (channel_is_in_state((chan), \
689 CHANNEL_STATE_CLOSED))
690 #define CHANNEL_IS_OPENING(chan) (channel_is_in_state((chan), \
691 CHANNEL_STATE_OPENING))
692 #define CHANNEL_IS_OPEN(chan) (channel_is_in_state((chan), \
694 #define CHANNEL_IS_MAINT(chan) (channel_is_in_state((chan), \
695 CHANNEL_STATE_MAINT))
696 #define CHANNEL_IS_CLOSING(chan) (channel_is_in_state((chan), \
697 CHANNEL_STATE_CLOSING))
698 #define CHANNEL_IS_ERROR(chan) (channel_is_in_state((chan), \
699 CHANNEL_STATE_ERROR))
701 #define CHANNEL_FINISHED(chan) (CHANNEL_IS_CLOSED(chan) || \
702 CHANNEL_IS_ERROR(chan))
704 #define CHANNEL_CONDEMNED(chan) (CHANNEL_IS_CLOSING(chan) || \
705 CHANNEL_FINISHED(chan))
707 #define CHANNEL_CAN_HANDLE_CELLS(chan) (CHANNEL_IS_OPENING(chan) || \
708 CHANNEL_IS_OPEN(chan) || \
709 CHANNEL_IS_MAINT(chan))
714 return chan->
state == state;
739 const char *rsa_id_digest,
744 int consider_identity));
771 #define channel_handle_free(h) \
772 FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h))
channel_t * channel_find_by_remote_identity(const char *rsa_id_digest, const ed25519_public_key_t *ed_id)
void channel_timestamp_active(channel_t *chan)
void channel_listener_process_incoming(channel_listener_t *listener)
void channel_timestamp_recv(channel_t *chan)
void channel_set_identity_digest(channel_t *chan, const char *identity_digest, const ed25519_public_key_t *ed_identity)
void channel_listener_unregister(channel_listener_t *chan_l)
channel_t * channel_connect(const tor_addr_t *addr, uint16_t port, const char *id_digest, const ed25519_public_key_t *ed_id)
void channel_mark_local(channel_t *chan)
void channel_mark_incoming(channel_t *chan)
void channel_closed(channel_t *chan)
void channel_init_listener(channel_listener_t *chan_l)
STATIC void channel_add_to_digest_map(channel_t *chan)
void channel_do_open_actions(channel_t *chan)
void channel_close_from_lower_layer(channel_t *chan)
void channel_process_cell(channel_t *chan, cell_t *cell)
void channel_change_state_open(channel_t *chan)
void channel_listener_queue_incoming(channel_listener_t *listener, channel_t *incoming)
void channel_timestamp_created(channel_t *chan)
void channel_register(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_register(channel_listener_t *chan_l)
void channel_mark_remote(channel_t *chan)
void channel_unregister(channel_t *chan)
ssize_t channel_flush_some_cells(channel_t *chan, ssize_t num_cells)
STATIC bool channel_matches_target_addr_for_extend(channel_t *chan, const tor_addr_t *target_ipv4_addr, const tor_addr_t *target_ipv6_addr)
void channel_close_for_error(channel_t *chan)
void channel_listener_free_(channel_listener_t *chan_l)
void channel_listener_timestamp_accepted(channel_listener_t *chan_l)
void channel_notify_flushed(channel_t *chan)
void channel_timestamp_xmit(channel_t *chan)
void channel_clear_identity_digest(channel_t *chan)
void channel_clear_remote_end(channel_t *chan)
void channel_listener_change_state(channel_listener_t *chan_l, channel_listener_state_t to_state)
void channel_mark_outgoing(channel_t *chan)
channel_t * channel_get_for_extend(const char *rsa_id_digest, const ed25519_public_key_t *ed_id, const tor_addr_t *target_ipv4_addr, const tor_addr_t *target_ipv6_addr, bool for_origin_circ, const char **msg_out, int *launch_out)
int channel_more_to_flush(channel_t *chan)
void channel_init(channel_t *chan)
void channel_free_(channel_t *chan)
void channel_change_state(channel_t *chan, channel_state_t to_state)
const char * channel_listener_describe_transport(channel_listener_t *chan_l)
int channel_has_queued_writes(channel_t *chan)
channel_t * channel_find_by_global_id(uint64_t global_identifier)
void channel_set_circid_type(channel_t *chan, crypto_pk_t *identity_rcvd, int consider_identity)
int channel_is_better(channel_t *a, channel_t *b)
int channel_is_bad_for_new_circs(channel_t *chan)
int channel_is_outgoing(channel_t *chan)
const char * channel_describe_transport(channel_t *chan)
channel_t * channel_next_with_rsa_identity(channel_t *chan)
void channel_mark_as_used_for_origin_circuit(channel_t *chan)
void channel_run_cleanup(void)
void channel_update_bad_for_new_circs(const char *digest, int force)
void channel_dumpstats(int severity)
void channel_timestamp_client(channel_t *chan)
void channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
void channel_set_cell_handlers(channel_t *chan, channel_cell_handler_fn_ptr cell_handler)
void channel_mark_client(channel_t *chan)
time_t channel_when_last_xmit(channel_t *chan)
void channel_listener_run_cleanup(void)
int channel_listener_state_can_transition(channel_listener_state_t from, channel_listener_state_t to)
int channel_state_is_valid(channel_state_t state)
void channel_listener_mark_for_close(channel_listener_t *chan_l)
void channel_check_for_duplicates(void)
int channel_is_canonical(channel_t *chan)
int channel_listener_state_is_valid(channel_listener_state_t state)
int channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info)
@ CHANNEL_LISTENER_STATE_ERROR
@ CHANNEL_LISTENER_STATE_LAST
@ CHANNEL_LISTENER_STATE_LISTENING
@ CHANNEL_LISTENER_STATE_CLOSING
@ CHANNEL_LISTENER_STATE_CLOSED
int channel_state_can_transition(channel_state_t from, channel_state_t to)
int channel_remote_identity_matches(const channel_t *chan, const char *rsa_id_digest, const ed25519_public_key_t *ed_id)
time_t channel_when_last_client(channel_t *chan)
void channel_listener_set_listener_fn(channel_listener_t *chan, channel_listener_fn_ptr listener)
void channel_listener_dump_transport_statistics(channel_listener_t *chan_l, int severity)
int channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
void channel_mark_bad_for_new_circs(channel_t *chan)
int channel_is_incoming(channel_t *chan)
int channel_is_client(const channel_t *chan)
channel_cell_handler_fn_ptr channel_get_cell_handler(channel_t *chan)
int packed_cell_is_destroy(channel_t *chan, const packed_cell_t *packed_cell, circid_t *circid_out)
void channel_listener_dumpstats(int severity)
int channel_is_local(channel_t *chan)
int channel_num_cells_writeable(channel_t *chan)
int channel_get_addr_if_possible(const channel_t *chan, tor_addr_t *addr_out)
const char * channel_state_to_string(channel_state_t state)
void channel_mark_for_close(channel_t *chan)
const char * channel_describe_peer(channel_t *chan)
void channel_dump_statistics(channel_t *chan, int severity)
void channel_free_all(void)
void channel_dump_transport_statistics(channel_t *chan, int severity)
unsigned int channel_num_circuits(channel_t *chan)
void channel_clear_client(channel_t *chan)
int channel_write_packed_cell(channel_t *chan, packed_cell_t *cell)
const char * channel_listener_state_to_string(channel_listener_state_t state)
time_t channel_when_created(channel_t *chan)
Header file for circuitmux.c.
Header for crypto_ed25519.c.
Macros for C weak-handle implementation.
Master header file for Tor-specific functionality.
channel_listener_state_t state
enum channel_listener_t::@10 reason_for_closing
void(* dumpstats)(channel_listener_t *, int)
uint64_t global_identifier
void(* free_fn)(channel_listener_t *)
smartlist_t * incoming_list
channel_listener_fn_ptr listener
time_t timestamp_accepted
void(* close)(channel_listener_t *)
void(* free_fn)(channel_t *)
int(* is_canonical)(channel_t *)
void(* close)(channel_t *)
uint16_t padding_timeout_low_ms
monotime_coarse_t next_padding_time
void(* dumpstats)(channel_t *, int)
time_t timestamp_last_had_circuits
unsigned int num_n_circuits
int(* matches_extend_info)(channel_t *, extend_info_t *)
enum channel_t::@9 scheduler_state
circ_id_type_bitfield_t circ_id_type
unsigned int padding_enabled
char identity_digest[DIGEST_LEN]
uint64_t global_identifier
int(* write_packed_cell)(channel_t *, packed_cell_t *)
channel_usage_info_t channel_usage
HT_ENTRY(channel_t) gidmap_node
TOR_LIST_ENTRY(channel_t) next_with_same_id
struct channel_handle_t * timer_handle
double(* get_overhead_estimate)(channel_t *)
unsigned int pending_padding_callback
tor_addr_t addr_according_to_peer
channel_cell_handler_fn_ptr cell_handler
@ SCHED_CHAN_WAITING_FOR_CELLS
@ SCHED_CHAN_WAITING_TO_WRITE
int(* matches_target)(channel_t *, const tor_addr_t *)
struct ed25519_public_key_t ed25519_identity
unsigned int has_been_open
monotime_coarse_t timestamp_xfer
unsigned int currently_padding
unsigned int is_bad_for_new_circs
unsigned int is_canonical_to_peer
int(* write_var_cell)(channel_t *, var_cell_t *)
struct tor_timer_t * padding_timer
HANDLE_ENTRY(channel, channel_t)
ratelim_t last_warned_circ_ids_exhausted
int(* has_queued_writes)(channel_t *)
enum channel_t::@8 reason_for_closing
#define MOCK_DECL(rv, funcname, arglist)