summaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-06-11 18:52:12 +0000
committerNick Mathewson <nickm@torproject.org>2005-06-11 18:52:12 +0000
commit232861ba42c176a98fdaa2792ae2930a759723f1 (patch)
tree89a578abc3840bd24b5535b75b655e17b13bfd41 /src/or/rendcommon.c
parentdf029fc9df2e58f7bc225f0a61217bcc9c60e91b (diff)
downloadtor-232861ba42c176a98fdaa2792ae2930a759723f1.tar.gz
tor-232861ba42c176a98fdaa2792ae2930a759723f1.zip
Docment or add DOCDOC comments to undocumented functions in src/or. Make function definition format uniform.
svn:r4411
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 3020663311..ff9bdc9cef 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -85,8 +85,8 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc,
* success, return a newly alloced service_descriptor_t. On failure,
* return NULL.
*/
-rend_service_descriptor_t *rend_parse_service_descriptor(
- const char *str, size_t len)
+rend_service_descriptor_t *
+rend_parse_service_descriptor(const char *str, size_t len)
{
rend_service_descriptor_t *result = NULL;
int i;
@@ -144,7 +144,8 @@ rend_service_descriptor_t *rend_parse_service_descriptor(
* base32 encoded. NUL-terminates out. (We use this string to
* identify services in directory requests and .onion URLs.)
*/
-int rend_get_service_id(crypto_pk_env_t *pk, char *out)
+int
+rend_get_service_id(crypto_pk_env_t *pk, char *out)
{
char buf[DIGEST_LEN];
tor_assert(pk);
@@ -165,11 +166,13 @@ static strmap_t *rend_cache = NULL;
/** Initializes the service descriptor cache.
*/
-void rend_cache_init(void)
+void
+rend_cache_init(void)
{
rend_cache = strmap_new();
}
+/** Helper: free storage held by a single service descriptor cache entry. */
static void
_rend_cache_entry_free(void *p)
{
@@ -179,6 +182,7 @@ _rend_cache_entry_free(void *p)
tor_free(e);
}
+/** Free all storage held by the service descriptor cache. */
void
rend_cache_free_all(void)
{
@@ -188,7 +192,8 @@ rend_cache_free_all(void)
/** Removes all old entries from the service descriptor cache.
*/
-void rend_cache_clean(void)
+void
+rend_cache_clean(void)
{
strmap_iter_t *iter;
const char *key;
@@ -210,7 +215,9 @@ void rend_cache_clean(void)
/** Return true iff <b>query</b> is a syntactically valid service ID (as
* generated by rend_get_service_id). */
-int rend_valid_service_id(const char *query) {
+int
+rend_valid_service_id(const char *query)
+{
if (strlen(query) != REND_SERVICE_ID_LEN)
return 0;
@@ -223,7 +230,8 @@ int rend_valid_service_id(const char *query) {
/** If we have a cached rend_cache_entry_t for the service ID <b>query</b>, set
* *<b>e</b> to that entry and return 1. Else return 0.
*/
-int rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e)
+int
+rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e)
{
tor_assert(rend_cache);
if (!rend_valid_service_id(query))
@@ -242,7 +250,8 @@ int rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e)
* Note: calls to rend_cache_clean or rend_cache_store may invalidate
* *desc.
*/
-int rend_cache_lookup_desc(const char *query, const char **desc, size_t *desc_len)
+int
+rend_cache_lookup_desc(const char *query, const char **desc, size_t *desc_len)
{
rend_cache_entry_t *e;
int r;
@@ -260,7 +269,8 @@ int rend_cache_lookup_desc(const char *query, const char **desc, size_t *desc_le
* it's the same or older than one we've already got; return 1 if
* it's novel.
*/
-int rend_cache_store(const char *desc, size_t desc_len)
+int
+rend_cache_store(const char *desc, size_t desc_len)
{
rend_cache_entry_t *e;
rend_service_descriptor_t *parsed;
@@ -322,8 +332,9 @@ int rend_cache_store(const char *desc, size_t desc_len)
/** Called when we get a rendezvous-related relay cell on circuit
* <b>circ</b>. Dispatch on rendezvous relay command. */
-void rend_process_relay_cell(circuit_t *circ, int command, size_t length,
- const char *payload)
+void
+rend_process_relay_cell(circuit_t *circ, int command, size_t length,
+ const char *payload)
{
int r;
switch (command) {