diff options
author | David Goulet <dgoulet@torproject.org> | 2017-02-02 15:26:04 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-07-13 16:50:09 -0400 |
commit | 09b12c40947ea496c0bfaeeafba7540925c17a32 (patch) | |
tree | 09c14cfb32abe77ae3e0b2dad7b9a28cf93571e7 /src/or/hs_service.h | |
parent | 418059dd96f5f427eceffff1daeb2a2f6c4adbeb (diff) | |
download | tor-09b12c40947ea496c0bfaeeafba7540925c17a32.tar.gz tor-09b12c40947ea496c0bfaeeafba7540925c17a32.zip |
test: Add v3 service load keys and accessors
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_service.h')
-rw-r--r-- | src/or/hs_service.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/hs_service.h b/src/or/hs_service.h index cd154d3fe9..a98884f6bc 100644 --- a/src/or/hs_service.h +++ b/src/or/hs_service.h @@ -200,6 +200,11 @@ typedef struct hs_service_t { } hs_service_t; +/* For the service global hash map, we define a specific type for it which + * will make it safe to use and specific to some controlled parameters such as + * the hashing function and how to compare services. */ +typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht; + /* API */ /* Global initializer and cleanup function. */ @@ -228,8 +233,17 @@ get_establish_intro_payload(uint8_t *buf, size_t buf_len, #ifdef TOR_UNIT_TESTS +/* Useful getters for unit tests. */ STATIC unsigned int get_hs_service_map_size(void); STATIC int get_hs_service_staging_list_size(void); +STATIC hs_service_ht *get_hs_service_map(void); +STATIC hs_service_t *get_first_service(void); + +/* Service accessors. */ +STATIC hs_service_t *find_service(hs_service_ht *map, + const ed25519_public_key_t *pk); +STATIC void remove_service(hs_service_ht *map, hs_service_t *service); +STATIC int register_service(hs_service_ht *map, hs_service_t *service); #endif /* TOR_UNIT_TESTS */ |