tor  0.4.1.0-alpha-dev
Data Structures | Typedefs | Enumerations | Functions
orconn_event.h File Reference

Go to the source code of this file.

Data Structures

struct  orconn_state_msg_t
 
struct  orconn_status_msg_t
 
struct  orconn_event_msg_t
 

Macros

States of OR connections

These must be in a partial ordering such that usually no OR connection will transition from a higher-numbered state to a lower-numbered one. Code such as bto_update_best() depends on this ordering to determine the best state it's seen so far.

#define OR_CONN_STATE_MIN_   1
 
#define OR_CONN_STATE_CONNECTING   1
 
#define OR_CONN_STATE_PROXY_HANDSHAKING   2
 
#define OR_CONN_STATE_TLS_HANDSHAKING   3
 
#define OR_CONN_STATE_TLS_CLIENT_RENEGOTIATING   4
 
#define OR_CONN_STATE_TLS_SERVER_RENEGOTIATING   5
 
#define OR_CONN_STATE_OR_HANDSHAKING_V2   6
 
#define OR_CONN_STATE_OR_HANDSHAKING_V3   7
 
#define OR_CONN_STATE_OPEN   8
 
#define OR_CONN_STATE_MAX_   8
 

Typedefs

typedef enum or_conn_status_event_t or_conn_status_event_t
 
typedef enum orconn_msgtype_t orconn_msgtype_t
 
typedef struct orconn_state_msg_t orconn_state_msg_t
 
typedef struct orconn_status_msg_t orconn_status_msg_t
 
typedef struct orconn_event_msg_t orconn_event_msg_t
 
typedef void(* orconn_event_rcvr_t) (const orconn_event_msg_t *)
 

Enumerations

enum  or_conn_status_event_t {
  OR_CONN_EVENT_LAUNCHED = 0, OR_CONN_EVENT_CONNECTED = 1, OR_CONN_EVENT_FAILED = 2, OR_CONN_EVENT_CLOSED = 3,
  OR_CONN_EVENT_NEW = 4
}
 
enum  orconn_msgtype_t { ORCONN_MSGTYPE_STATE, ORCONN_MSGTYPE_STATUS }
 

Functions

void orconn_event_subscribe (orconn_event_rcvr_t)
 

Detailed Description

Header file for orconn_event.c.

The OR_CONN_STATE_* symbols are here to make it easier for subscribers to make decisions based on the messages that they receive.

Definition in file orconn_event.h.

Macro Definition Documentation

◆ OR_CONN_STATE_CONNECTING

#define OR_CONN_STATE_CONNECTING   1

State for a connection to an OR: waiting for connect() to finish.

Definition at line 29 of file orconn_event.h.

Referenced by bto_cevent_anyconn(), bto_cevent_apconn(), connection_or_finished_connecting(), connection_or_notify_error(), and connection_state_is_connecting().

◆ OR_CONN_STATE_OPEN

#define OR_CONN_STATE_OPEN   8

State for an OR connection: Ready to send/receive cells.

Definition at line 51 of file orconn_event.h.

Referenced by connection_or_finished_flushing(), connection_or_group_set_badness_(), connection_or_set_state_open(), and connection_state_is_open().

◆ OR_CONN_STATE_OR_HANDSHAKING_V2

#define OR_CONN_STATE_OR_HANDSHAKING_V2   6

State for an OR connection: We're done with our SSL handshake, we've done renegotiation, but we haven't yet negotiated link protocol versions and sent a netinfo cell.

Definition at line 45 of file orconn_event.h.

Referenced by connection_or_finished_flushing().

◆ OR_CONN_STATE_OR_HANDSHAKING_V3

#define OR_CONN_STATE_OR_HANDSHAKING_V3   7

State for an OR connection: We're done with our SSL handshake, but we haven't yet negotiated link protocol versions, done a V3 handshake, and sent a netinfo cell.

Definition at line 49 of file orconn_event.h.

Referenced by channel_tls_process_auth_challenge_cell(), channel_tls_process_authenticate_cell(), connection_or_finished_flushing(), connection_or_launch_v3_or_handshake(), connection_or_send_auth_challenge_cell(), and connection_or_send_certs_cell().

◆ OR_CONN_STATE_PROXY_HANDSHAKING

#define OR_CONN_STATE_PROXY_HANDSHAKING   2

State for a connection to an OR: waiting for proxy handshake to complete

Definition at line 31 of file orconn_event.h.

Referenced by connection_or_finished_flushing(), and connection_or_process_inbuf().

◆ OR_CONN_STATE_TLS_CLIENT_RENEGOTIATING

#define OR_CONN_STATE_TLS_CLIENT_RENEGOTIATING   4

State for a connection to an OR: We're doing a second SSL handshake for renegotiation purposes. (V2 handshake only.)

Definition at line 37 of file orconn_event.h.

◆ OR_CONN_STATE_TLS_HANDSHAKING

#define OR_CONN_STATE_TLS_HANDSHAKING   3

State for an OR connection client: SSL is handshaking, not done yet.

Definition at line 34 of file orconn_event.h.

Referenced by enter_v3_handshake_with_cell(), and MOCK_IMPL().

◆ OR_CONN_STATE_TLS_SERVER_RENEGOTIATING

#define OR_CONN_STATE_TLS_SERVER_RENEGOTIATING   5

State for a connection at an OR: We're waiting for the client to renegotiate (to indicate a v2 handshake) or send a versions cell (to indicate a v3 handshake)

Definition at line 41 of file orconn_event.h.

Referenced by enter_v3_handshake_with_cell().

Typedef Documentation

◆ or_conn_status_event_t

Used to indicate the type of an OR connection event passed to the controller. The various types are defined in control-spec.txt

◆ orconn_event_msg_t

Discriminated union for the actual message

◆ orconn_event_rcvr_t

typedef void(* orconn_event_rcvr_t) (const orconn_event_msg_t *)

Receiver function pointer for OR subscribers

This function gets called synchronously by the publisher.

Definition at line 112 of file orconn_event.h.

◆ orconn_msgtype_t

Discriminant values for orconn event message

◆ orconn_state_msg_t

Message for orconn state update

This contains information about internal state changes of or_connection_t objects. The chan and proxy_type fields are additional information that a subscriber may need to make decisions.

◆ orconn_status_msg_t

Message for orconn status event

This contains information that ends up in ORCONN control protocol events.

Enumeration Type Documentation

◆ or_conn_status_event_t

Used to indicate the type of an OR connection event passed to the controller. The various types are defined in control-spec.txt

Definition at line 57 of file orconn_event.h.

◆ orconn_msgtype_t

Discriminant values for orconn event message

Definition at line 66 of file orconn_event.h.

Function Documentation

◆ orconn_event_subscribe()

void orconn_event_subscribe ( orconn_event_rcvr_t  fn)

Subscribe to messages about OR connection events

Register a callback function to receive messages about ORCONNs. The publisher calls this function synchronously.

Definition at line 51 of file orconn_event.c.

References orconn_event_rcvrs, smartlist_add(), smartlist_contains(), and tor_assert().

Referenced by btrack_orconn_init().