diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-06-01 13:37:11 +0300 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-08-24 13:03:27 -0400 |
commit | 7aef3ec0fde0b320343ecb3aa7080b6e1d9a2e62 (patch) | |
tree | 11ef8499ffe2aaee79a52839738416444b1ea584 /src/or/hs_cache.h | |
parent | 5d89ea1e6c148ce584dc2059c4d353d12d01e8d1 (diff) | |
download | tor-7aef3ec0fde0b320343ecb3aa7080b6e1d9a2e62.tar.gz tor-7aef3ec0fde0b320343ecb3aa7080b6e1d9a2e62.zip |
prop224: Add client-side HS descriptor cache.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_cache.h')
-rw-r--r-- | src/or/hs_cache.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/hs_cache.h b/src/or/hs_cache.h index ed00424234..79456f69c8 100644 --- a/src/or/hs_cache.h +++ b/src/or/hs_cache.h @@ -53,10 +53,35 @@ int hs_cache_store_as_dir(const char *desc); int hs_cache_lookup_as_dir(uint32_t version, const char *query, const char **desc_out); +const hs_descriptor_t * +hs_cache_lookup_as_client(const ed25519_public_key_t *key); +int hs_cache_store_as_client(const char *desc_str, + const ed25519_public_key_t *identity_pk); +void hs_cache_clean_as_client(time_t now); + #ifdef HS_CACHE_PRIVATE +/** Represents a locally cached HS descriptor on a hidden service client. */ +typedef struct hs_cache_client_descriptor_t { + /* This object is indexed using the service identity public key */ + ed25519_public_key_t key; + + /* When was this entry created. Used to expire entries. */ + time_t created_ts; + + /* The cached descriptor, this object is the owner. It can't be NULL. A + * cache object without a valid descriptor is not possible. */ + hs_descriptor_t *desc; + + /* Encoded descriptor in string form. Can't be NULL. */ + char *encoded_desc; +} hs_cache_client_descriptor_t; + STATIC size_t cache_clean_v3_as_dir(time_t now, time_t global_cutoff); +STATIC hs_cache_client_descriptor_t * +lookup_v3_desc_as_client(const uint8_t *key); + #endif /* HS_CACHE_PRIVATE */ #endif /* TOR_HS_CACHE_H */ |