diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-06 03:44:36 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-06 03:44:36 +0000 |
commit | 257d509b91f12dc3f4f380a1238a05264ecb50a8 (patch) | |
tree | f68d88e98498d406442396daf5d2c447fbc9d840 /src/or/rendcommon.c | |
parent | 1dca309769f94777d210ba3dddf4ba8781191456 (diff) | |
download | tor-257d509b91f12dc3f4f380a1238a05264ecb50a8.tar.gz tor-257d509b91f12dc3f4f380a1238a05264ecb50a8.zip |
Document stuff, reduce magic numbers, add emacs magic
svn:r1502
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r-- | src/or/rendcommon.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 4fb333af9c..d0bc78d9d6 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -4,6 +4,8 @@ #include "or.h" +/* Free the storage held by held by 'desc'. + */ void rend_service_descriptor_free(rend_service_descriptor_t *desc) { int i; @@ -18,6 +20,9 @@ void rend_service_descriptor_free(rend_service_descriptor_t *desc) tor_free(desc); } +/* Encode a service descriptor for 'desc', and sign it with 'key'. Stores + * the descriptor in *str_out, and sets *len_out to its length. + */ int rend_encode_service_descriptor(rend_service_descriptor_t *desc, crypto_pk_env_t *key, @@ -120,6 +125,9 @@ rend_service_descriptor_t *rend_parse_service_descriptor( return NULL; } +/* Sets out to the first 10 bytes of the digest of 'pk', base32 encoded. + * NUL-terminates out. + */ int rend_get_service_id(crypto_pk_env_t *pk, char *out) { char buf[DIGEST_LEN]; @@ -136,18 +144,22 @@ int rend_get_service_id(crypto_pk_env_t *pk, char *out) #define REND_CACHE_MAX_SKEW 60*60 typedef struct rend_cache_entry_t { - int len; - char *desc; - rend_service_descriptor_t *parsed; + int len; /* Length of desc */ + char *desc; /* Service descriptor */ + rend_service_descriptor_t *parsed; /* Parsed vvalue of 'desc' */ } rend_cache_entry_t; static strmap_t *rend_cache = NULL; +/* Initializes the service descriptor cache. + */ void rend_cache_init(void) { rend_cache = strmap_new(); } +/* Removes all old entries from the service descriptor cache. + */ void rend_cache_clean(void) { strmap_iter_t *iter; |