aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/hashtables.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hashtables.h')
-rw-r--r--src/hashtables.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/hashtables.h b/src/hashtables.h
index 89845f6..b833e44 100644
--- a/src/hashtables.h
+++ b/src/hashtables.h
@@ -3,9 +3,13 @@
#ifndef HASHTABLES_H
#define HASHTABLES_H
+#include "messages.h"
+#include "crypto/siphash24.h"
+
#include <linux/hashtable.h>
#include <linux/mutex.h>
-#include "crypto/siphash24.h"
+
+struct wireguard_peer;
struct pubkey_hashtable {
DECLARE_HASHTABLE(hashtable, 8);
@@ -23,8 +27,18 @@ struct index_hashtable {
uint8_t key[SIPHASH24_KEY_LEN];
spinlock_t lock;
};
-struct index_hashtable_entry;
+enum index_hashtable_type {
+ INDEX_HASHTABLE_HANDSHAKE = (1 << 0),
+ INDEX_HASHTABLE_KEYPAIR = (1 << 1)
+};
+
+struct index_hashtable_entry {
+ struct wireguard_peer *peer;
+ struct hlist_node index_hash;
+ enum index_hashtable_type type;
+ __le32 index;
+};
void index_hashtable_init(struct index_hashtable *table);
__le32 index_hashtable_insert(struct index_hashtable *table, struct index_hashtable_entry *entry);
void index_hashtable_replace(struct index_hashtable *table, struct index_hashtable_entry *old, struct index_hashtable_entry *new);