diff options
author | David Goulet <dgoulet@ev0ke.net> | 2015-06-18 11:23:08 -0400 |
---|---|---|
committer | David Goulet <dgoulet@ev0ke.net> | 2015-06-18 12:56:46 -0400 |
commit | a7624de1aac959ed273199d4cded5095502cdd8a (patch) | |
tree | 28e64d560189c881c52fab5b00ca89b26b61f966 /src/or/rendcache.h | |
parent | 33b1a33c338d3eb882e1053a1c965f1c6fc6a564 (diff) | |
download | tor-a7624de1aac959ed273199d4cded5095502cdd8a.tar.gz tor-a7624de1aac959ed273199d4cded5095502cdd8a.zip |
Move cache objects and functions to rendcache.{c|h}
Every functions and objects that are used for hidden service descriptor
caches are moved to rendcache.{c|h}.
This commit does NOT change anything, just moving code around.
Fixes #16399
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/rendcache.h')
-rw-r--r-- | src/or/rendcache.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/or/rendcache.h b/src/or/rendcache.h index 1b78436c94..f34f599e63 100644 --- a/src/or/rendcache.h +++ b/src/or/rendcache.h @@ -11,6 +11,17 @@ #include "or.h" +/** How old do we let hidden service descriptors get before discarding + * them as too old? */ +#define REND_CACHE_MAX_AGE (2*24*60*60) +/** How wrong do we assume our clock may be when checking whether hidden + * services are too old or too new? */ +#define REND_CACHE_MAX_SKEW (24*60*60) + +/* Do not allow more than this many introduction points in a hidden service + * descriptor */ +#define MAX_INTRO_POINTS 10 + /** A cached rendezvous descriptor. */ typedef struct rend_cache_entry_t { size_t len; /**< Length of <b>desc</b> */ @@ -20,4 +31,26 @@ typedef struct rend_cache_entry_t { rend_service_descriptor_t *parsed; /**< Parsed value of 'desc' */ } rend_cache_entry_t; +void rend_cache_init(void); +void rend_cache_clean(time_t now); +void rend_cache_clean_v2_descs_as_dir(time_t now, size_t min_to_remove); +void rend_cache_purge(void); +void rend_cache_free_all(void); +int rend_cache_lookup_entry(const char *query, int version, + rend_cache_entry_t **entry_out); +int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc); +/** Return value from rend_cache_store_v2_desc_as_{dir,client}. */ +typedef enum { + RCS_NOTDIR = -2, /**< We're not a directory */ + RCS_BADDESC = -1, /**< This descriptor is no good. */ + RCS_OKAY = 0 /**< All worked as expected */ +} rend_cache_store_status_t; + +rend_cache_store_status_t rend_cache_store_v2_desc_as_dir(const char *desc); +rend_cache_store_status_t rend_cache_store_v2_desc_as_client(const char *desc, + const char *desc_id_base32, + const rend_data_t *rend_query, + rend_cache_entry_t **entry); +size_t rend_cache_get_total_allocation(void); + #endif /* TOR_RENDCACHE_H */ |