Tor
0.4.7.0-alpha-dev
|
Hash map implementation for btrack_orconn.c. More...
#include <stdbool.h>
#include "core/or/or.h"
#include "ht.h"
#include "siphash.h"
#include "feature/control/btrack_orconn.h"
#include "feature/control/btrack_orconn_maps.h"
#include "lib/log/log.h"
Go to the source code of this file.
Functions | |
static unsigned int | bto_gid_hash_ (bt_orconn_t *elm) |
static int | bto_gid_eq_ (bt_orconn_t *a, bt_orconn_t *b) |
static unsigned int | bto_chan_hash_ (bt_orconn_t *elm) |
static int | bto_chan_eq_ (bt_orconn_t *a, bt_orconn_t *b) |
HT_HEAD (bto_gid_ht, bt_orconn_t) | |
HT_PROTOTYPE (bto_gid_ht, bt_orconn_t, node, bto_gid_hash_, bto_gid_eq_) | |
HT_GENERATE2 (bto_gid_ht, bt_orconn_t, node, bto_gid_hash_, bto_gid_eq_, 0.6, tor_reallocarray_, tor_free_) | |
HT_HEAD (bto_chan_ht, bt_orconn_t) | |
HT_PROTOTYPE (bto_chan_ht, bt_orconn_t, chan_node, bto_chan_hash_, bto_chan_eq_) | |
HT_GENERATE2 (bto_chan_ht, bt_orconn_t, chan_node, bto_chan_hash_, bto_chan_eq_, 0.6, tor_reallocarray_, tor_free_) | |
static void | bto_gid_clear_map (void) |
static void | bto_chan_clear_map (void) |
void | bto_delete (uint64_t gid) |
static bt_orconn_t * | bto_update (bt_orconn_t *bto, const bt_orconn_t *key) |
static bt_orconn_t * | bto_new (const bt_orconn_t *key) |
bt_orconn_t * | bto_find_or_new (uint64_t gid, uint64_t chan) |
void | bto_init_maps (void) |
void | bto_clear_maps (void) |
Variables | |
static struct bto_gid_ht * | bto_gid_map |
static struct bto_chan_ht * | bto_chan_map |
Hash map implementation for btrack_orconn.c.
These functions manipulate the hash maps that contain bt_orconn objects.
Definition in file btrack_orconn_maps.c.
|
static |
Clear the chan ID hash map, freeing any bt_orconn_t objects that become unreferenced
Definition at line 89 of file btrack_orconn_maps.c.
Referenced by bto_clear_maps().
void bto_clear_maps | ( | void | ) |
Clear the hash maps, freeing all associated storage
Definition at line 220 of file btrack_orconn_maps.c.
Referenced by btrack_orconn_fini().
void bto_delete | ( | uint64_t | gid | ) |
Delete a bt_orconn from the hash maps by GID
Definition at line 110 of file btrack_orconn_maps.c.
bt_orconn_t* bto_find_or_new | ( | uint64_t | gid, |
uint64_t | chan | ||
) |
Insert a new bt_orconn with the given GID and chan ID, or update the GID and chan ID if one already exists.
Return the found or allocated bt_orconn.
Definition at line 189 of file btrack_orconn_maps.c.
Referenced by bto_chan_rcvr(), and bto_state_rcvr().
|
static |
Clear the GID hash map, freeing any bt_orconn_t objects that become unreferenced
Definition at line 67 of file btrack_orconn_maps.c.
Referenced by bto_clear_maps().
void bto_init_maps | ( | void | ) |
Initialize the hash maps
Definition at line 210 of file btrack_orconn_maps.c.
Referenced by btrack_orconn_init().
|
static |
Helper for bto_find_or_new()
Definition at line 163 of file btrack_orconn_maps.c.
|
static |
Helper for bto_find_or_new().
Update GID and chan ID of an existing bt_orconn object if needed, given a search key previously used within bto_find_or_new().
Definition at line 138 of file btrack_orconn_maps.c.