tor  0.4.1.0-alpha-dev
orconn_event.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
16 #ifndef TOR_ORCONN_EVENT_H
17 #define TOR_ORCONN_EVENT_H
18 
27 #define OR_CONN_STATE_MIN_ 1
28 
29 #define OR_CONN_STATE_CONNECTING 1
30 
31 #define OR_CONN_STATE_PROXY_HANDSHAKING 2
32 
34 #define OR_CONN_STATE_TLS_HANDSHAKING 3
35 
37 #define OR_CONN_STATE_TLS_CLIENT_RENEGOTIATING 4
38 
41 #define OR_CONN_STATE_TLS_SERVER_RENEGOTIATING 5
42 
45 #define OR_CONN_STATE_OR_HANDSHAKING_V2 6
46 
49 #define OR_CONN_STATE_OR_HANDSHAKING_V3 7
50 
51 #define OR_CONN_STATE_OPEN 8
52 #define OR_CONN_STATE_MAX_ 8
53 
57 typedef enum or_conn_status_event_t {
58  OR_CONN_EVENT_LAUNCHED = 0,
59  OR_CONN_EVENT_CONNECTED = 1,
60  OR_CONN_EVENT_FAILED = 2,
61  OR_CONN_EVENT_CLOSED = 3,
62  OR_CONN_EVENT_NEW = 4,
64 
66 typedef enum orconn_msgtype_t {
67  ORCONN_MSGTYPE_STATE,
68  ORCONN_MSGTYPE_STATUS,
70 
79 typedef struct orconn_state_msg_t {
80  uint64_t gid;
81  uint64_t chan;
82  int proxy_type;
83  uint8_t state;
85 
92 typedef struct orconn_status_msg_t {
93  uint64_t gid;
94  int status;
95  int reason;
97 
99 typedef struct orconn_event_msg_t {
100  int type;
101  union {
102  orconn_state_msg_t state;
103  orconn_status_msg_t status;
104  } u;
106 
112 typedef void (*orconn_event_rcvr_t)(const orconn_event_msg_t *);
113 
115 
116 #ifdef ORCONN_EVENT_PRIVATE
118 #endif
119 
120 #endif /* defined(TOR_ORCONN_EVENT_H) */
struct orconn_event_msg_t orconn_event_msg_t
struct orconn_state_msg_t orconn_state_msg_t
orconn_msgtype_t
Definition: orconn_event.h:66
void orconn_event_subscribe(orconn_event_rcvr_t)
Definition: orconn_event.c:51
void(* orconn_event_rcvr_t)(const orconn_event_msg_t *)
Definition: orconn_event.h:112
struct orconn_status_msg_t orconn_status_msg_t
or_conn_status_event_t
Definition: orconn_event.h:57
void orconn_event_publish(const orconn_event_msg_t *msg)
Definition: orconn_event.c:67