diff options
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r-- | src/or/rendcommon.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 26801af874..a2dda01ae8 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -2,14 +2,15 @@ /* See LICENSE for licensing information */ /* $Id$ */ -/***** - * rendcommon.c: Rendezvous implementation: shared code between +/** + * \file rendcommon.c + * \brief Rendezvous implementation: shared code between * introducers, services, clients, and rendezvous points. - *****/ + **/ #include "or.h" -/* Free the storage held by the service descriptor 'desc'. +/** Free the storage held by the service descriptor 'desc'. */ void rend_service_descriptor_free(rend_service_descriptor_t *desc) { @@ -25,7 +26,7 @@ void rend_service_descriptor_free(rend_service_descriptor_t *desc) tor_free(desc); } -/* Encode a service descriptor for 'desc', and sign it with 'key'. Store +/** Encode a service descriptor for 'desc', and sign it with 'key'. Store * the descriptor in *str_out, and set *len_out to its length. */ int @@ -71,7 +72,7 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc, return 0; } -/* Parse a service descriptor at 'str' (len bytes). On success, +/** Parse a service descriptor at 'str' (len bytes). On success, * return a newly alloced service_descriptor_t. On failure, return * NULL. */ @@ -128,7 +129,7 @@ rend_service_descriptor_t *rend_parse_service_descriptor( return NULL; } -/* Sets out to the first 10 bytes of the digest of 'pk', base32 +/** Sets out to the first 10 bytes of the digest of 'pk', base32 * encoded. NUL-terminates out. (We use this string to identify * services in directory requests and .onion URLs.) */ @@ -144,21 +145,22 @@ int rend_get_service_id(crypto_pk_env_t *pk, char *out) } /* ==== Rendezvous service descriptor cache. */ + #define REND_CACHE_MAX_AGE (24*60*60) #define REND_CACHE_MAX_SKEW (90*60) -/* Map from service id (as generated by rend_get_service_id) to +/** Map from service id (as generated by rend_get_service_id) to * rend_cache_entry_t. */ static strmap_t *rend_cache = NULL; -/* Initializes the service descriptor cache. +/** Initializes the service descriptor cache. */ void rend_cache_init(void) { rend_cache = strmap_new(); } -/* Removes all old entries from the service descriptor cache. +/** Removes all old entries from the service descriptor cache. */ void rend_cache_clean(void) { @@ -182,7 +184,7 @@ void rend_cache_clean(void) } } -/* Return true iff 'query' is a syntactically valid service ID (as +/** Return true iff 'query' is a syntactically valid service ID (as * generated by rend_get_service_id). */ int rend_valid_service_id(const char *query) { if(strlen(query) != REND_SERVICE_ID_LEN) @@ -194,7 +196,7 @@ int rend_valid_service_id(const char *query) { return 1; } -/* If we have a cached rend_cache_entry_t for the service ID 'query', set +/** If we have a cached rend_cache_entry_t for the service ID 'query', set * *e to that entry and return 1. Else return 0. */ int rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e) @@ -208,7 +210,7 @@ int rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e) return 1; } -/* 'query' is a base-32'ed service id. If it's malformed, return -1. +/** 'query' is a base-32'ed service id. If it's malformed, return -1. * Else look it up. * If it is found, point *desc to it, and write its length into * *desc_len, and return 1. @@ -227,7 +229,7 @@ int rend_cache_lookup_desc(const char *query, const char **desc, int *desc_len) return 1; } -/* Parse *desc, calculate its service id, and store it in the cache. +/** Parse *desc, calculate its service id, and store it in the cache. * If we have a newer descriptor with the same ID, ignore this one. * If we have an older descriptor with the same ID, replace it. * Returns -1 if it's malformed or otherwise rejected, else return 0. @@ -289,7 +291,7 @@ int rend_cache_store(const char *desc, int desc_len) return 0; } -/* Called when we get a rendezvous-related relay cell on circuit +/** Called when we get a rendezvous-related relay cell on circuit * *circ. Dispatch on rendezvous relay command. */ void rend_process_relay_cell(circuit_t *circ, int command, int length, const char *payload) |