From a18ceb81ca78a7f37adc436f35e6eeb8683bb984 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 29 Sep 2016 04:36:14 +0200 Subject: Rework headers and includes --- src/hashtables.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/hashtables.h') 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 #include -#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); -- cgit v1.2.3-59-g8ed1b