[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r13440: doxygen and other cleanups (in tor/trunk/src: common or)
Author: arma
Date: 2008-02-08 22:11:10 -0500 (Fri, 08 Feb 2008)
New Revision: 13440
Modified:
tor/trunk/src/common/aes.c
tor/trunk/src/common/crypto.c
tor/trunk/src/common/mempool.c
tor/trunk/src/common/mempool.h
tor/trunk/src/common/tortls.c
tor/trunk/src/common/util.c
tor/trunk/src/or/circuitbuild.c
tor/trunk/src/or/connection_or.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/networkstatus.c
tor/trunk/src/or/rephist.c
tor/trunk/src/or/test.c
Log:
doxygen and other cleanups
Modified: tor/trunk/src/common/aes.c
===================================================================
--- tor/trunk/src/common/aes.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/aes.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -286,7 +286,7 @@
/* XXXX This function is up to 5% of our runtime in some profiles;
* we should look into unrolling some of the loops; taking advantage
- * of alignmement, using a bigger buffer, and so on. Not till after 0.1.2.x,
+ * of alignment, using a bigger buffer, and so on. Not till after 0.1.2.x,
* though. */
int c = cipher->pos;
if (PREDICT_UNLIKELY(!len)) return;
@@ -322,7 +322,7 @@
/* XXXX This function is up to 5% of our runtime in some profiles;
* we should look into unrolling some of the loops; taking advantage
- * of alignmement, using a bigger buffer, and so on. Not till after 0.1.2.x,
+ * of alignment, using a bigger buffer, and so on. Not till after 0.1.2.x,
* though. */
int c = cipher->pos;
if (PREDICT_UNLIKELY(!len)) return;
Modified: tor/trunk/src/common/crypto.c
===================================================================
--- tor/trunk/src/common/crypto.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/crypto.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -1550,12 +1550,12 @@
goto error;
}
secret_len = result;
- /* sometimes secret_len might be less than 128, e.g., 127. that's ok. */
+ /* sometimes secret_len might be less than 128, e.g., 127. that's ok. -RD */
/* Actually, http://www.faqs.org/rfcs/rfc2631.html says:
* Leading zeros MUST be preserved, so that ZZ occupies as many
* octets as p. For instance, if p is 1024 bits, ZZ should be 128
* bytes long.
- * What are the security implications here?
+ * XXX021 What are the security implications here? -NM
*/
if (crypto_expand_key_material(secret_tmp, secret_len,
secret_out, secret_bytes_out)<0)
@@ -1578,7 +1578,7 @@
/** Given <b>key_in_len</b> bytes of negotiated randomness in <b>key_in</b>
* ("K"), expand it into <b>key_out_len</b> bytes of negotiated key material in
- * <b>key_out</b> by taking the first key_out_len bytes of
+ * <b>key_out</b> by taking the first <b>key_out_len</b> bytes of
* H(K | [00]) | H(K | [01]) | ....
*
* Return 0 on success, -1 on failure.
@@ -1710,7 +1710,7 @@
#endif
}
-/** Write n bytes of strong random data to <b>to</b>. Return 0 on
+/** Write <b>n</b> bytes of strong random data to <b>to</b>. Return 0 on
* success, -1 on failure.
*/
int
@@ -1725,7 +1725,7 @@
}
/** Return a pseudorandom integer, chosen uniformly from the values
- * between 0 and max-1. */
+ * between 0 and <b>max</b>-1. */
int
crypto_rand_int(unsigned int max)
{
@@ -1746,8 +1746,8 @@
}
}
-/** Return a pseudorandom integer, chosen uniformly from the values
- * between 0 and max-1. */
+/** Return a pseudorandom 64-bit integer, chosen uniformly from the values
+ * between 0 and <b>max</b>-1. */
uint64_t
crypto_rand_uint64(uint64_t max)
{
@@ -1768,9 +1768,10 @@
}
}
-/** Generate and return a new random hostname starting with prefix, ending
- * with suffix, and containing between min_rand_len and max_rand_len random
- * base32 characters between. */
+/** Generate and return a new random hostname starting with <b>prefix</b>,
+ * ending with <b>suffix</b>, and containing no less than
+ * <b>min_rand_len</b> and no more than <b>max_rand_len</b> random base32
+ * characters between. */
char *
crypto_random_hostname(int min_rand_len, int max_rand_len, const char *prefix,
const char *suffix)
@@ -1799,8 +1800,8 @@
return result;
}
-/** Return a randomly chosen element of sl; or NULL if sl is empty.
- */
+/** Return a randomly chosen element of <b>sl</b>; or NULL if <b>sl</b>
+ * is empty. */
void *
smartlist_choose(const smartlist_t *sl)
{
@@ -1811,7 +1812,7 @@
return NULL; /* no elements to choose from */
}
-/** Scramble the elements of sl into a random order. */
+/** Scramble the elements of <b>sl</b> into a random order. */
void
smartlist_shuffle(smartlist_t *sl)
{
@@ -1834,7 +1835,7 @@
int
base64_encode(char *dest, size_t destlen, const char *src, size_t srclen)
{
- /* XXXX we might want to rewrite this along the lines of base64_decode, if
+ /* FFFF we might want to rewrite this along the lines of base64_decode, if
* it ever shows up in the profile. */
EVP_ENCODE_CTX ctx;
int len, ret;
Modified: tor/trunk/src/common/mempool.c
===================================================================
--- tor/trunk/src/common/mempool.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/mempool.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -204,7 +204,7 @@
ASSERT(!chunk->prev);
}
-/** Return an newly allocated item from <b>pool</b>. */
+/** Return a newly allocated item from <b>pool</b>. */
void *
mp_pool_get(mp_pool_t *pool)
{
Modified: tor/trunk/src/common/mempool.h
===================================================================
--- tor/trunk/src/common/mempool.h 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/mempool.h 2008-02-09 03:11:10 UTC (rev 13440)
@@ -50,11 +50,11 @@
* padding. */
size_t item_alloc_size;
#ifdef MEMPOOL_STATS
- /** Total number of items allocated ever */
+ /** Total number of items allocated ever. */
uint64_t total_items_allocated;
- /** Total number of chunks allocated ever */
+ /** Total number of chunks allocated ever. */
uint64_t total_chunks_allocated;
- /** Total number of chunks freed ever */
+ /** Total number of chunks freed ever. */
uint64_t total_chunks_freed;
#endif
};
Modified: tor/trunk/src/common/tortls.c
===================================================================
--- tor/trunk/src/common/tortls.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/tortls.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -322,7 +322,7 @@
return 1;
}
-/** Return a newly allocated X509 name with commonName <b>cname</b> */
+/** Return a newly allocated X509 name with commonName <b>cname</b>. */
static X509_NAME *
tor_x509_name_new(const char *cname)
{
Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/common/util.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -707,7 +707,7 @@
CHECK_STRTOX_RESULT();
}
-/** As tor_parse_long, but return an unsigned long. */
+/** As tor_parse_long(), but return an unsigned long. */
unsigned long
tor_parse_ulong(const char *s, int base, unsigned long min,
unsigned long max, int *ok, char **next)
Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/circuitbuild.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -2822,15 +2822,23 @@
return 0;
}
-/** DOCDOC arma */
+/** Information about a configured bridge. Currently this just matches the
+ * ones in the torrc file, but one day we may be able to learn about new
+ * bridges on our own, and remember them in the state file. */
typedef struct {
+ /** IPv4 address of the bridge. */
uint32_t addr;
+ /** TLS port for the bridge. */
uint16_t port;
+ /** Expected identity digest, or all \0's if we don't know what the
+ * digest should be. */
char identity[DIGEST_LEN];
+ /** When should we next try to fetch a descriptor for this bridge? */
download_status_t fetch_status;
} bridge_info_t;
-/** A list of known bridges. */
+/** A list of configured bridges. Whenever we actually get a descriptor
+ * for one, we add it as an entry guard. */
static smartlist_t *bridge_list = NULL;
/** Initialize the bridge list to empty, creating it if needed. */
Modified: tor/trunk/src/or/connection_or.c
===================================================================
--- tor/trunk/src/or/connection_or.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/connection_or.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -174,13 +174,14 @@
return cell;
}
-/** Release all space held by <b>cell</b> */
+/** Release all space held by <b>cell</b>. */
void
var_cell_free(var_cell_t *cell)
{
tor_free(cell);
}
+/** We've received an EOF from <b>conn</b>. Mark it for close and return. */
int
connection_or_reached_eof(or_connection_t *conn)
{
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/directory.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -1876,7 +1876,7 @@
return 0;
}
-/** Called when a directory connection reaches EOF */
+/** Called when a directory connection reaches EOF. */
int
connection_dir_reached_eof(dir_connection_t *conn)
{
Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/networkstatus.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -786,7 +786,7 @@
/*XXXX make this static once functions are moved into this file. */
/** Search the routerstatuses in <b>ns</b> for one whose identity digest is
* <b>digest</b>. Return value and set *<b>found_out</b> as for
- * smartlist_besearch_idx(). */
+ * smartlist_bsearch_idx(). */
int
networkstatus_vote_find_entry_idx(networkstatus_t *ns,
const char *digest, int *found_out)
Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/rephist.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -19,9 +19,9 @@
static void predicted_ports_init(void);
static void hs_usage_init(void);
-/** Total number of bytes currently allocated in fields used by rephist.c */
+/** Total number of bytes currently allocated in fields used by rephist.c. */
uint64_t rephist_total_alloc=0;
-/** Number of or_history_t obects currently allocated */
+/** Number of or_history_t objects currently allocated. */
uint32_t rephist_total_num=0;
/** If the total weighted run count of all runs for a router ever falls
Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c 2008-02-09 02:51:20 UTC (rev 13439)
+++ tor/trunk/src/or/test.c 2008-02-09 03:11:10 UTC (rev 13440)
@@ -1081,20 +1081,20 @@
#define test_eq_ip6(a,b) _test_eq_ip6((a),(b),#a,#b,__LINE__)
/** Helper: Assert that two strings both decode as IPv6 addresses with
- * tor_inet_pton, and both decode to the same address. */
+ * tor_inet_pton(), and both decode to the same address. */
#define test_pton6_same(a,b) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &a1), 1); \
test_eq(tor_inet_pton(AF_INET6, b, &a2), 1); \
_test_eq_ip6(&a1,&a2,#a,#b,__LINE__); \
STMT_END
-/** Helper: Assert that <b>a</b> is recognized as a bed IPv6 address by
- * tor_inet_pton. */
+/** Helper: Assert that <b>a</b> is recognized as a bad IPv6 address by
+ * tor_inet_pton(). */
#define test_pton6_bad(a) \
test_eq(0, tor_inet_pton(AF_INET6, a, &a1))
-/** Helper: assert that <b>a</b> when parsed by tor_inet_pton and displayed
- * with tor_inet_ntop, yields <b>b</b>. Also assert that <b>b</b> parses to
+/** Helper: assert that <b>a</b>, when parsed by tor_inet_pton() and displayed
+ * with tor_inet_ntop(), yields <b>b</b>. Also assert that <b>b</b> parses to
* the same value as <b>a</b>. */
#define test_ntop6_reduces(a,b) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &a1), 1); \
@@ -1103,8 +1103,8 @@
_test_eq_ip6(&a1, &a2, a, b, __LINE__); \
STMT_END
-/** Helper: assert that <b>a</a> parses by tor_inet_pton into a address that
- * passes tor_addr_is_internal with for_listening */
+/** Helper: assert that <b>a</a> parses by tor_inet_pton() into a address that
+ * passes tor_addr_is_internal() with <b>for_listening</b> */
#define test_internal_ip(a,for_listening) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \
t1.family = AF_INET6; \
@@ -1112,8 +1112,8 @@
test_fail_msg( a "was not internal."); \
STMT_END
-/** Helper: assert that <b>a</a> parses by tor_inet_pton into a address that
- * does not pass tor_addr_is_internal with for_listening. */
+/** Helper: assert that <b>a</a> parses by tor_inet_pton() into a address that
+ * does not pass tor_addr_is_internal() with <b>for_listening</b>. */
#define test_external_ip(a,for_listening) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \
t1.family = AF_INET6; \
@@ -1121,8 +1121,9 @@
test_fail_msg(a "was not external."); \
STMT_END
-/** Helper: Assert that a and b, when parsed by tor_inet_pton, give addresses
- * that compare in the order defined by op with tor_addr_compare(). */
+/** Helper: Assert that <b>a</b> and <b>b</b>, when parsed by
+ * tor_inet_pton(), give addresses that compare in the order defined by
+ * <b>op</b> with tor_addr_compare(). */
#define test_addr_compare(a, op, b) STMT_BEGIN \
test_eq(tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr), 1); \
test_eq(tor_inet_pton(AF_INET6, b, &t2.addr.in6_addr), 1); \