Merge branch 'maint-0.4.8'
[tor.git] / src / feature / control / btrack_orconn.h
blob6f9c391e6f2db9b8034c815cb00d6ae3ef68fccf
1 /* Copyright (c) 2007-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file btrack_orconn.h
6 * \brief Header file for btrack_orconn.c
7 **/
9 #ifndef TOR_BTRACK_ORCONN_H
10 #define TOR_BTRACK_ORCONN_H
12 #include "lib/pubsub/pubsub.h"
14 #ifdef BTRACK_ORCONN_PRIVATE
16 #include "ht.h"
18 /**
19 * Structure for tracking OR connection states
21 * This gets linked into two hash maps: one with connection IDs, and
22 * another with channel IDs.
23 **/
24 typedef struct bt_orconn_t {
25 HT_ENTRY(bt_orconn_t) node; /**< Hash map entry indexed by gid */
26 HT_ENTRY(bt_orconn_t) chan_node; /**< Hash map entry indexed by channel ID */
27 uint64_t gid; /**< Global ID of this ORCONN */
28 uint64_t chan; /**< Channel ID, if known */
29 int proxy_type; /**< Proxy type */
30 uint8_t state; /**< State of this ORCONN */
31 bool is_orig; /**< Does this carry an origin circuit? */
32 bool is_onehop; /**< Is this for a one-hop circuit? */
33 } bt_orconn_t;
35 #endif /* defined(BTRACK_ORCONN_PRIVATE) */
37 int btrack_orconn_init(void);
38 int btrack_orconn_add_pubsub(pubsub_connector_t *);
39 void btrack_orconn_fini(void);
41 #endif /* !defined(TOR_BTRACK_ORCONN_H) */