aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control/btrack_orconn.h
blob: 8b3d8be37d6efc33fb56a3a8c32c5e9347b47c7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file btrack_orconn.h
 * \brief Header file for btrack_orconn.c
 **/

#ifndef TOR_BTRACK_ORCONN_H
#define TOR_BTRACK_ORCONN_H

#include "lib/pubsub/pubsub.h"

#ifdef BTRACK_ORCONN_PRIVATE

#include "ht.h"

/**
 * Structure for tracking OR connection states
 *
 * This gets linked into two hash maps: one with connection IDs, and
 * another with channel IDs.
 **/
typedef struct bt_orconn_t {
  HT_ENTRY(bt_orconn_t) node;   /**< Hash map entry indexed by gid */
  HT_ENTRY(bt_orconn_t) chan_node; /**< Hash map entry indexed by channel ID */
  uint64_t gid;                    /**< Global ID of this ORCONN */
  uint64_t chan;                   /**< Channel ID, if known */
  int proxy_type;                  /**< Proxy type */
  uint8_t state;                   /**< State of this ORCONN */
  bool is_orig;             /**< Does this carry an origin circuit? */
  bool is_onehop;           /**< Is this for a one-hop circuit? */
} bt_orconn_t;

#endif /* defined(BTRACK_ORCONN_PRIVATE) */

int btrack_orconn_init(void);
int btrack_orconn_add_pubsub(pubsub_connector_t *);
void btrack_orconn_fini(void);

#endif /* !defined(TOR_BTRACK_ORCONN_H) */