mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Add DOCDOC comments for all undocumented functions. Add missing *s to other comments so that they will get recognized as doxygen.
svn:r17729
This commit is contained in:
parent
ef1be06de6
commit
1725c0c8a5
@ -17,6 +17,7 @@
|
|||||||
#include "torint.h"
|
#include "torint.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
/* DOCDOC maskbits_t */
|
||||||
typedef uint8_t maskbits_t;
|
typedef uint8_t maskbits_t;
|
||||||
struct in_addr;
|
struct in_addr;
|
||||||
/** Holds an IPv4 or IPv6 address. (Uses less memory than struct
|
/** Holds an IPv4 or IPv6 address. (Uses less memory than struct
|
||||||
@ -32,11 +33,17 @@ typedef struct tor_addr_t
|
|||||||
|
|
||||||
/* DOCDOC*/
|
/* DOCDOC*/
|
||||||
static INLINE uint32_t tor_addr_to_ipv4n(const tor_addr_t *a);
|
static INLINE uint32_t tor_addr_to_ipv4n(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_to_ipv4h */
|
||||||
static INLINE uint32_t tor_addr_to_ipv4h(const tor_addr_t *a);
|
static INLINE uint32_t tor_addr_to_ipv4h(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_to_mapped_ipv4h */
|
||||||
static INLINE uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a);
|
static INLINE uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_family */
|
||||||
static INLINE sa_family_t tor_addr_family(const tor_addr_t *a);
|
static INLINE sa_family_t tor_addr_family(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_to_in */
|
||||||
static INLINE const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
|
static INLINE const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_to_in6 */
|
||||||
static INLINE const struct in6_addr *tor_addr_to_in6(const tor_addr_t *a);
|
static INLINE const struct in6_addr *tor_addr_to_in6(const tor_addr_t *a);
|
||||||
|
/* DOCDOC tor_addr_eq_ipv4h */
|
||||||
static INLINE int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
|
static INLINE int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
|
||||||
socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
|
socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
|
||||||
struct sockaddr *sa_out, socklen_t len);
|
struct sockaddr *sa_out, socklen_t len);
|
||||||
@ -153,7 +160,8 @@ int parse_addr_and_port_range(const char *s, uint32_t *addr_out,
|
|||||||
uint16_t *port_max_out);
|
uint16_t *port_max_out);
|
||||||
int addr_mask_get_bits(uint32_t mask);
|
int addr_mask_get_bits(uint32_t mask);
|
||||||
int addr_mask_cmp_bits(uint32_t a1, uint32_t a2, maskbits_t bits);
|
int addr_mask_cmp_bits(uint32_t a1, uint32_t a2, maskbits_t bits);
|
||||||
#define INET_NTOA_BUF_LEN 16 /* 255.255.255.255 */
|
/** Length of a buffer to allocate to hold the results of tor_inet_ntoa.*/
|
||||||
|
#define INET_NTOA_BUF_LEN 16
|
||||||
int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len);
|
int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len);
|
||||||
char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
|
char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
|
||||||
int get_interface_address(int severity, uint32_t *addr);
|
int get_interface_address(int severity, uint32_t *addr);
|
||||||
|
@ -1831,6 +1831,7 @@ tor_get_thread_id(void)
|
|||||||
#elif defined(USE_PTHREADS)
|
#elif defined(USE_PTHREADS)
|
||||||
static pthread_mutexattr_t attr_reentrant;
|
static pthread_mutexattr_t attr_reentrant;
|
||||||
static int threads_initialized = 0;
|
static int threads_initialized = 0;
|
||||||
|
/* DOCDOC tor_mutex_init */
|
||||||
void
|
void
|
||||||
tor_mutex_init(tor_mutex_t *mutex)
|
tor_mutex_init(tor_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
@ -1867,6 +1868,7 @@ tor_mutex_release(tor_mutex_t *m)
|
|||||||
tor_fragile_assert();
|
tor_fragile_assert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* DOCDOC tor_mutex_uninit */
|
||||||
void
|
void
|
||||||
tor_mutex_uninit(tor_mutex_t *m)
|
tor_mutex_uninit(tor_mutex_t *m)
|
||||||
{
|
{
|
||||||
@ -1892,6 +1894,7 @@ tor_get_thread_id(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TOR_IS_MULTITHREADED
|
#ifdef TOR_IS_MULTITHREADED
|
||||||
|
/* DOCDOC tor_mutex_new */
|
||||||
tor_mutex_t *
|
tor_mutex_t *
|
||||||
tor_mutex_new(void)
|
tor_mutex_new(void)
|
||||||
{
|
{
|
||||||
@ -1899,6 +1902,7 @@ tor_mutex_new(void)
|
|||||||
tor_mutex_init(m);
|
tor_mutex_init(m);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC tor_mutex_free */
|
||||||
void
|
void
|
||||||
tor_mutex_free(tor_mutex_t *m)
|
tor_mutex_free(tor_mutex_t *m)
|
||||||
{
|
{
|
||||||
|
@ -687,6 +687,7 @@ smartlist_uniq_digests(smartlist_t *sl)
|
|||||||
smartlist_uniq(sl, _compare_digests, _tor_free);
|
smartlist_uniq(sl, _compare_digests, _tor_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC DEFINE_MAP_STRUCTS */
|
||||||
#define DEFINE_MAP_STRUCTS(maptype, keydecl, prefix) \
|
#define DEFINE_MAP_STRUCTS(maptype, keydecl, prefix) \
|
||||||
typedef struct prefix ## entry_t { \
|
typedef struct prefix ## entry_t { \
|
||||||
HT_ENTRY(prefix ## entry_t) node; \
|
HT_ENTRY(prefix ## entry_t) node; \
|
||||||
@ -697,7 +698,9 @@ smartlist_uniq_digests(smartlist_t *sl)
|
|||||||
HT_HEAD(prefix ## impl, prefix ## entry_t) head; \
|
HT_HEAD(prefix ## impl, prefix ## entry_t) head; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC DEFINE_MAP_STRUCTS */
|
||||||
DEFINE_MAP_STRUCTS(strmap_t, char *key, strmap_);
|
DEFINE_MAP_STRUCTS(strmap_t, char *key, strmap_);
|
||||||
|
/* DOCDOC DEFINE_MAP_STRUCTS */
|
||||||
DEFINE_MAP_STRUCTS(digestmap_t, char key[DIGEST_LEN], digestmap_);
|
DEFINE_MAP_STRUCTS(digestmap_t, char key[DIGEST_LEN], digestmap_);
|
||||||
|
|
||||||
/** Helper: compare strmap_entry_t objects by key value. */
|
/** Helper: compare strmap_entry_t objects by key value. */
|
||||||
@ -1004,6 +1007,7 @@ strmap_iter_init(strmap_t *map)
|
|||||||
return HT_START(strmap_impl, &map->head);
|
return HT_START(strmap_impl, &map->head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_iter_init */
|
||||||
digestmap_iter_t *
|
digestmap_iter_t *
|
||||||
digestmap_iter_init(digestmap_t *map)
|
digestmap_iter_init(digestmap_t *map)
|
||||||
{
|
{
|
||||||
@ -1021,6 +1025,7 @@ strmap_iter_next(strmap_t *map, strmap_iter_t *iter)
|
|||||||
return HT_NEXT(strmap_impl, &map->head, iter);
|
return HT_NEXT(strmap_impl, &map->head, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_iter_next */
|
||||||
digestmap_iter_t *
|
digestmap_iter_t *
|
||||||
digestmap_iter_next(digestmap_t *map, digestmap_iter_t *iter)
|
digestmap_iter_next(digestmap_t *map, digestmap_iter_t *iter)
|
||||||
{
|
{
|
||||||
@ -1046,6 +1051,7 @@ strmap_iter_next_rmv(strmap_t *map, strmap_iter_t *iter)
|
|||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_iter_next_rmv */
|
||||||
digestmap_iter_t *
|
digestmap_iter_t *
|
||||||
digestmap_iter_next_rmv(digestmap_t *map, digestmap_iter_t *iter)
|
digestmap_iter_next_rmv(digestmap_t *map, digestmap_iter_t *iter)
|
||||||
{
|
{
|
||||||
@ -1072,6 +1078,7 @@ strmap_iter_get(strmap_iter_t *iter, const char **keyp, void **valp)
|
|||||||
*valp = (*iter)->val;
|
*valp = (*iter)->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_iter_get */
|
||||||
void
|
void
|
||||||
digestmap_iter_get(digestmap_iter_t *iter, const char **keyp, void **valp)
|
digestmap_iter_get(digestmap_iter_t *iter, const char **keyp, void **valp)
|
||||||
{
|
{
|
||||||
@ -1090,6 +1097,7 @@ strmap_iter_done(strmap_iter_t *iter)
|
|||||||
{
|
{
|
||||||
return iter == NULL;
|
return iter == NULL;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC digestmap_iter_done */
|
||||||
int
|
int
|
||||||
digestmap_iter_done(digestmap_iter_t *iter)
|
digestmap_iter_done(digestmap_iter_t *iter)
|
||||||
{
|
{
|
||||||
@ -1116,6 +1124,7 @@ strmap_free(strmap_t *map, void (*free_val)(void*))
|
|||||||
HT_CLEAR(strmap_impl, &map->head);
|
HT_CLEAR(strmap_impl, &map->head);
|
||||||
tor_free(map);
|
tor_free(map);
|
||||||
}
|
}
|
||||||
|
/* DOCDOC digestmap_free */
|
||||||
void
|
void
|
||||||
digestmap_free(digestmap_t *map, void (*free_val)(void*))
|
digestmap_free(digestmap_t *map, void (*free_val)(void*))
|
||||||
{
|
{
|
||||||
@ -1132,11 +1141,13 @@ digestmap_free(digestmap_t *map, void (*free_val)(void*))
|
|||||||
tor_free(map);
|
tor_free(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC strmap_assert_ok */
|
||||||
void
|
void
|
||||||
strmap_assert_ok(const strmap_t *map)
|
strmap_assert_ok(const strmap_t *map)
|
||||||
{
|
{
|
||||||
tor_assert(!_strmap_impl_HT_REP_IS_BAD(&map->head));
|
tor_assert(!_strmap_impl_HT_REP_IS_BAD(&map->head));
|
||||||
}
|
}
|
||||||
|
/* DOCDOC digestmap_assert_ok */
|
||||||
void
|
void
|
||||||
digestmap_assert_ok(const digestmap_t *map)
|
digestmap_assert_ok(const digestmap_t *map)
|
||||||
{
|
{
|
||||||
@ -1150,6 +1161,7 @@ strmap_isempty(const strmap_t *map)
|
|||||||
return HT_EMPTY(&map->head);
|
return HT_EMPTY(&map->head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_isempty */
|
||||||
int
|
int
|
||||||
digestmap_isempty(const digestmap_t *map)
|
digestmap_isempty(const digestmap_t *map)
|
||||||
{
|
{
|
||||||
@ -1163,6 +1175,7 @@ strmap_size(const strmap_t *map)
|
|||||||
return HT_SIZE(&map->head);
|
return HT_SIZE(&map->head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC digestmap_size */
|
||||||
int
|
int
|
||||||
digestmap_size(const digestmap_t *map)
|
digestmap_size(const digestmap_t *map)
|
||||||
{
|
{
|
||||||
|
@ -261,6 +261,7 @@ _crypto_new_pk_env_evp_pkey(EVP_PKEY *pkey)
|
|||||||
return _crypto_new_pk_env_rsa(rsa);
|
return _crypto_new_pk_env_rsa(rsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _crypto_pk_env_get_rsa */
|
||||||
RSA *
|
RSA *
|
||||||
_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
|
_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
|
||||||
{
|
{
|
||||||
@ -2273,10 +2274,12 @@ _openssl_locking_cb(int mode, int n, const char *file, int line)
|
|||||||
tor_mutex_release(_openssl_mutexes[n]);
|
tor_mutex_release(_openssl_mutexes[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC CRYPTO_dynlock_value */
|
||||||
struct CRYPTO_dynlock_value {
|
struct CRYPTO_dynlock_value {
|
||||||
tor_mutex_t *lock;
|
tor_mutex_t *lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* DOCDOC _openssl_dynlock_create_cb */
|
||||||
static struct CRYPTO_dynlock_value *
|
static struct CRYPTO_dynlock_value *
|
||||||
_openssl_dynlock_create_cb(const char *file, int line)
|
_openssl_dynlock_create_cb(const char *file, int line)
|
||||||
{
|
{
|
||||||
@ -2288,6 +2291,7 @@ _openssl_dynlock_create_cb(const char *file, int line)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _openssl_dynlock_lock_cb */
|
||||||
static void
|
static void
|
||||||
_openssl_dynlock_lock_cb(int mode, struct CRYPTO_dynlock_value *v,
|
_openssl_dynlock_lock_cb(int mode, struct CRYPTO_dynlock_value *v,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
@ -2300,6 +2304,7 @@ _openssl_dynlock_lock_cb(int mode, struct CRYPTO_dynlock_value *v,
|
|||||||
tor_mutex_release(v->lock);
|
tor_mutex_release(v->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _openssl_dynlock_destroy_cb */
|
||||||
static void
|
static void
|
||||||
_openssl_dynlock_destroy_cb(struct CRYPTO_dynlock_value *v,
|
_openssl_dynlock_destroy_cb(struct CRYPTO_dynlock_value *v,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
|
@ -51,9 +51,13 @@
|
|||||||
/** Length of hex encoding of SHA1 digest, not including final NUL. */
|
/** Length of hex encoding of SHA1 digest, not including final NUL. */
|
||||||
#define HEX_DIGEST_LEN 40
|
#define HEX_DIGEST_LEN 40
|
||||||
|
|
||||||
|
/* DOCDOC crypto_pk_env_t */
|
||||||
typedef struct crypto_pk_env_t crypto_pk_env_t;
|
typedef struct crypto_pk_env_t crypto_pk_env_t;
|
||||||
|
/* DOCDOC crypto_cipher_env_t */
|
||||||
typedef struct crypto_cipher_env_t crypto_cipher_env_t;
|
typedef struct crypto_cipher_env_t crypto_cipher_env_t;
|
||||||
|
/* DOCDOC crypto_digest_env_t */
|
||||||
typedef struct crypto_digest_env_t crypto_digest_env_t;
|
typedef struct crypto_digest_env_t crypto_digest_env_t;
|
||||||
|
/* DOCDOC crypto_dh_env_t */
|
||||||
typedef struct crypto_dh_env_t crypto_dh_env_t;
|
typedef struct crypto_dh_env_t crypto_dh_env_t;
|
||||||
|
|
||||||
/* global state */
|
/* global state */
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#error "void* is neither 4 nor 8 bytes long. I don't know how to align stuff."
|
#error "void* is neither 4 nor 8 bytes long. I don't know how to align stuff."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Increment <b>ptr</b> until it is aligned to MEMAREA_ALIGN. */
|
/** Increment <b>ptr</b> until it is aligned to MEMAREA_ALIGN. */
|
||||||
static INLINE void *
|
static INLINE void *
|
||||||
realign_pointer(void *ptr)
|
realign_pointer(void *ptr)
|
||||||
{
|
{
|
||||||
@ -85,6 +85,7 @@ alloc_chunk(size_t sz, int freelist_ok)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC chunk_free */
|
||||||
static void
|
static void
|
||||||
chunk_free(memarea_chunk_t *chunk)
|
chunk_free(memarea_chunk_t *chunk)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,7 @@ compress_method_t detect_compression_method(const char *in, size_t in_len);
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR
|
TOR_ZLIB_OK, TOR_ZLIB_DONE, TOR_ZLIB_BUF_FULL, TOR_ZLIB_ERR
|
||||||
} tor_zlib_output_t;
|
} tor_zlib_output_t;
|
||||||
|
/** Internal state for an incremental zlib compression/decompression. */
|
||||||
typedef struct tor_zlib_state_t tor_zlib_state_t;
|
typedef struct tor_zlib_state_t tor_zlib_state_t;
|
||||||
tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method);
|
tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method);
|
||||||
|
|
||||||
|
@ -1341,12 +1341,14 @@ update_approx_time(time_t now)
|
|||||||
*/
|
*/
|
||||||
static int ftime_skew = 0;
|
static int ftime_skew = 0;
|
||||||
static int ftime_slop = 60;
|
static int ftime_slop = 60;
|
||||||
|
/* DOCDOC ftime_set_maximum_sloppiness */
|
||||||
void
|
void
|
||||||
ftime_set_maximum_sloppiness(int seconds)
|
ftime_set_maximum_sloppiness(int seconds)
|
||||||
{
|
{
|
||||||
tor_assert(seconds >= 0);
|
tor_assert(seconds >= 0);
|
||||||
ftime_slop = seconds;
|
ftime_slop = seconds;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC ftime_set_estimated_skew */
|
||||||
void
|
void
|
||||||
ftime_set_estimated_skew(int seconds)
|
ftime_set_estimated_skew(int seconds)
|
||||||
{
|
{
|
||||||
@ -1360,18 +1362,21 @@ ftime_get_window(time_t now, ftime_t *ft_out)
|
|||||||
ft_out->latest = now + ftime_skew + ftime_slop;
|
ft_out->latest = now + ftime_skew + ftime_slop;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/* DOCDOC ftime_maybe_after */
|
||||||
int
|
int
|
||||||
ftime_maybe_after(time_t now, time_t when)
|
ftime_maybe_after(time_t now, time_t when)
|
||||||
{
|
{
|
||||||
/* It may be after when iff the latest possible current time is after when */
|
/* It may be after when iff the latest possible current time is after when */
|
||||||
return (now + ftime_skew + ftime_slop) >= when;
|
return (now + ftime_skew + ftime_slop) >= when;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC ftime_maybe_before */
|
||||||
int
|
int
|
||||||
ftime_maybe_before(time_t now, time_t when)
|
ftime_maybe_before(time_t now, time_t when)
|
||||||
{
|
{
|
||||||
/* It may be before when iff the earliest possible current time is before */
|
/* It may be before when iff the earliest possible current time is before */
|
||||||
return (now + ftime_skew - ftime_slop) < when;
|
return (now + ftime_skew - ftime_slop) < when;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC ftime_definitely_after */
|
||||||
int
|
int
|
||||||
ftime_definitely_after(time_t now, time_t when)
|
ftime_definitely_after(time_t now, time_t when)
|
||||||
{
|
{
|
||||||
@ -1379,6 +1384,7 @@ ftime_definitely_after(time_t now, time_t when)
|
|||||||
* after when. */
|
* after when. */
|
||||||
return (now + ftime_skew - ftime_slop) >= when;
|
return (now + ftime_skew - ftime_slop) >= when;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC ftime_definitely_before */
|
||||||
int
|
int
|
||||||
ftime_definitely_before(time_t now, time_t when)
|
ftime_definitely_before(time_t now, time_t when)
|
||||||
{
|
{
|
||||||
@ -1941,7 +1947,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
|
|||||||
|
|
||||||
#define TOR_ISODIGIT(c) ('0' <= (c) && (c) <= '7')
|
#define TOR_ISODIGIT(c) ('0' <= (c) && (c) <= '7')
|
||||||
|
|
||||||
/* Given a c-style double-quoted escaped string in <b>s</b>, extract and
|
/** Given a c-style double-quoted escaped string in <b>s</b>, extract and
|
||||||
* decode its contents into a newly allocated string. On success, assign this
|
* decode its contents into a newly allocated string. On success, assign this
|
||||||
* string to *<b>result</b>, assign its length to <b>size_out</b> (if
|
* string to *<b>result</b>, assign its length to <b>size_out</b> (if
|
||||||
* provided), and return a pointer to the position in <b>s</b> immediately
|
* provided), and return a pointer to the position in <b>s</b> immediately
|
||||||
|
@ -153,6 +153,7 @@ conn_state_to_string(int type, int state)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC dir_connection_new */
|
||||||
dir_connection_t *
|
dir_connection_t *
|
||||||
dir_connection_new(int socket_family)
|
dir_connection_new(int socket_family)
|
||||||
{
|
{
|
||||||
@ -160,6 +161,7 @@ dir_connection_new(int socket_family)
|
|||||||
connection_init(time(NULL), TO_CONN(dir_conn), CONN_TYPE_DIR, socket_family);
|
connection_init(time(NULL), TO_CONN(dir_conn), CONN_TYPE_DIR, socket_family);
|
||||||
return dir_conn;
|
return dir_conn;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC or_connection_new */
|
||||||
or_connection_t *
|
or_connection_t *
|
||||||
or_connection_new(int socket_family)
|
or_connection_new(int socket_family)
|
||||||
{
|
{
|
||||||
@ -172,6 +174,7 @@ or_connection_new(int socket_family)
|
|||||||
|
|
||||||
return or_conn;
|
return or_conn;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC edge_connection_new */
|
||||||
edge_connection_t *
|
edge_connection_t *
|
||||||
edge_connection_new(int type, int socket_family)
|
edge_connection_new(int type, int socket_family)
|
||||||
{
|
{
|
||||||
@ -182,6 +185,7 @@ edge_connection_new(int type, int socket_family)
|
|||||||
edge_conn->socks_request = tor_malloc_zero(sizeof(socks_request_t));
|
edge_conn->socks_request = tor_malloc_zero(sizeof(socks_request_t));
|
||||||
return edge_conn;
|
return edge_conn;
|
||||||
}
|
}
|
||||||
|
/* DOCDOC control_connection_new */
|
||||||
control_connection_t *
|
control_connection_t *
|
||||||
control_connection_new(int socket_family)
|
control_connection_new(int socket_family)
|
||||||
{
|
{
|
||||||
@ -192,6 +196,7 @@ control_connection_new(int socket_family)
|
|||||||
return control_conn;
|
return control_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC connection_new */
|
||||||
connection_t *
|
connection_t *
|
||||||
connection_new(int type, int socket_family)
|
connection_new(int type, int socket_family)
|
||||||
{
|
{
|
||||||
@ -806,6 +811,7 @@ create_unix_sockaddr(const char *listenaddress, char **readable_address)
|
|||||||
};
|
};
|
||||||
#endif /* HAVE_SYS_UN_H */
|
#endif /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
|
/* DOCDOC warn_too_many_conns */
|
||||||
static void
|
static void
|
||||||
warn_too_many_conns(void)
|
warn_too_many_conns(void)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,7 @@ static char last_sent_bootstrap_message[BOOTSTRAP_MSG_LEN];
|
|||||||
#define EXTENDED_FORMAT 4
|
#define EXTENDED_FORMAT 4
|
||||||
#define NONEXTENDED_FORMAT 8
|
#define NONEXTENDED_FORMAT 8
|
||||||
#define ALL_FORMATS (EXTENDED_FORMAT|NONEXTENDED_FORMAT)
|
#define ALL_FORMATS (EXTENDED_FORMAT|NONEXTENDED_FORMAT)
|
||||||
|
/* DOCDOC event_format_t */
|
||||||
typedef int event_format_t;
|
typedef int event_format_t;
|
||||||
|
|
||||||
static void connection_printf_to_buf(control_connection_t *conn,
|
static void connection_printf_to_buf(control_connection_t *conn,
|
||||||
@ -502,7 +503,7 @@ send_control_done(control_connection_t *conn)
|
|||||||
connection_write_str_to_buf("250 OK\r\n", conn);
|
connection_write_str_to_buf("250 OK\r\n", conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send an event to all v1 controllers that are listening for code
|
/** Send an event to all v1 controllers that are listening for code
|
||||||
* <b>event</b>. The event's body is given by <b>msg</b>.
|
* <b>event</b>. The event's body is given by <b>msg</b>.
|
||||||
*
|
*
|
||||||
* If <b>which</b> & SHORT_NAMES, the event contains short-format names: send
|
* If <b>which</b> & SHORT_NAMES, the event contains short-format names: send
|
||||||
@ -604,7 +605,7 @@ send_control_event_impl(uint16_t event, event_format_t which, int extended,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send an event to all v1 controllers that are listening for code
|
/** Send an event to all v1 controllers that are listening for code
|
||||||
* <b>event</b>. The event's body is created by the printf-style format in
|
* <b>event</b>. The event's body is created by the printf-style format in
|
||||||
* <b>format</b>, and other arguments as provided.
|
* <b>format</b>, and other arguments as provided.
|
||||||
*
|
*
|
||||||
@ -620,7 +621,7 @@ send_control_event(uint16_t event, event_format_t which,
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send an event to all v1 controllers that are listening for code
|
/** Send an event to all v1 controllers that are listening for code
|
||||||
* <b>event</b>. The event's body is created by the printf-style format in
|
* <b>event</b>. The event's body is created by the printf-style format in
|
||||||
* <b>format</b>, and other arguments as provided.
|
* <b>format</b>, and other arguments as provided.
|
||||||
*
|
*
|
||||||
@ -3872,7 +3873,7 @@ control_event_bootstrap(bootstrap_status_t status, int progress)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when Tor has failed to make bootstrapping progress in a way
|
/** Called when Tor has failed to make bootstrapping progress in a way
|
||||||
* that indicates a problem. <b>warn</b> gives a hint as to why, and
|
* that indicates a problem. <b>warn</b> gives a hint as to why, and
|
||||||
* <b>reason</b> provides an "or_conn_end_reason" tag.
|
* <b>reason</b> provides an "or_conn_end_reason" tag.
|
||||||
*/
|
*/
|
||||||
|
@ -872,6 +872,8 @@ _compare_strs(const void **a, const void **b)
|
|||||||
#if (CONDITIONAL_CONSENSUS_FPR_LEN > DIGEST_LEN)
|
#if (CONDITIONAL_CONSENSUS_FPR_LEN > DIGEST_LEN)
|
||||||
#error "conditional consensus fingerprint length is larger than digest length"
|
#error "conditional consensus fingerprint length is larger than digest length"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC directory_get_consensus_url */
|
||||||
static char *
|
static char *
|
||||||
directory_get_consensus_url(int supports_conditional_consensus)
|
directory_get_consensus_url(int supports_conditional_consensus)
|
||||||
{
|
{
|
||||||
@ -2193,6 +2195,7 @@ typedef struct request_t {
|
|||||||
* of request. Maps from request type to pointer to request_t. */
|
* of request. Maps from request type to pointer to request_t. */
|
||||||
static strmap_t *request_map = NULL;
|
static strmap_t *request_map = NULL;
|
||||||
|
|
||||||
|
/* DOCDOC note_client_request */
|
||||||
static void
|
static void
|
||||||
note_client_request(int purpose, int compressed, size_t bytes)
|
note_client_request(int purpose, int compressed, size_t bytes)
|
||||||
{
|
{
|
||||||
|
@ -1156,7 +1156,7 @@ directory_fetches_from_authorities(or_options_t *options)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if we should fetch new networkstatuses, descriptors, etc
|
/** Return 1 if we should fetch new networkstatuses, descriptors, etc
|
||||||
* on the "mirror" schedule rather than the "client" schedule.
|
* on the "mirror" schedule rather than the "client" schedule.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@ -1165,7 +1165,7 @@ directory_fetches_dir_info_early(or_options_t *options)
|
|||||||
return directory_fetches_from_authorities(options);
|
return directory_fetches_from_authorities(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if we should fetch new networkstatuses, descriptors, etc
|
/** Return 1 if we should fetch new networkstatuses, descriptors, etc
|
||||||
* on a very passive schedule -- waiting long enough for ordinary clients
|
* on a very passive schedule -- waiting long enough for ordinary clients
|
||||||
* to probably have the info we want. These would include bridge users,
|
* to probably have the info we want. These would include bridge users,
|
||||||
* and maybe others in the future e.g. if a Tor client uses another Tor
|
* and maybe others in the future e.g. if a Tor client uses another Tor
|
||||||
@ -1592,6 +1592,7 @@ dirserv_get_runningrouters(void)
|
|||||||
"v1 network status list", V1_AUTHORITY);
|
"v1 network status list", V1_AUTHORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC */
|
||||||
cached_dir_t *
|
cached_dir_t *
|
||||||
dirserv_get_consensus(void)
|
dirserv_get_consensus(void)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,8 @@ get_voter(const networkstatus_t *vote)
|
|||||||
return smartlist_get(vote->voters, 0);
|
return smartlist_get(vote->voters, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
/* DOCDOC dir_src_ent_t */
|
||||||
|
typedef struct dir_src_ent_t {
|
||||||
networkstatus_t *v;
|
networkstatus_t *v;
|
||||||
const char *digest;
|
const char *digest;
|
||||||
int is_legacy;
|
int is_legacy;
|
||||||
@ -235,6 +236,7 @@ _compare_votes_by_authority_id(const void **_a, const void **_b)
|
|||||||
get_voter(b)->identity_digest, DIGEST_LEN);
|
get_voter(b)->identity_digest, DIGEST_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _compare_dir_src_ents_by_authority_id */
|
||||||
static int
|
static int
|
||||||
_compare_dir_src_ents_by_authority_id(const void **_a, const void **_b)
|
_compare_dir_src_ents_by_authority_id(const void **_a, const void **_b)
|
||||||
{
|
{
|
||||||
|
@ -186,6 +186,7 @@ evdns_log_cb(int warn, const char *msg)
|
|||||||
log(severity, LD_EXIT, "eventdns: %s", msg);
|
log(severity, LD_EXIT, "eventdns: %s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC randfn */
|
||||||
static void
|
static void
|
||||||
randfn(char *b, size_t n)
|
randfn(char *b, size_t n)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ const char dnsserv_c_id[] =
|
|||||||
#include "or.h"
|
#include "or.h"
|
||||||
#include "eventdns.h"
|
#include "eventdns.h"
|
||||||
|
|
||||||
/* Helper function: called by evdns whenever the client sends a request to our
|
/** Helper function: called by evdns whenever the client sends a request to our
|
||||||
* DNSPort. We need to eventually answer the request <b>req</b>.
|
* DNSPort. We need to eventually answer the request <b>req</b>.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -149,7 +149,7 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
|
|||||||
tor_free(q_name);
|
tor_free(q_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function: called whenever the client sends a resolve request to our
|
/** Helper function: called whenever the client sends a resolve request to our
|
||||||
* controller. We need to eventually answer the request <b>req</b>.
|
* controller. We need to eventually answer the request <b>req</b>.
|
||||||
* Returns 0 if the controller will be getting (or has gotten) an event in
|
* Returns 0 if the controller will be getting (or has gotten) an event in
|
||||||
* response; -1 if we couldn't launch the request.
|
* response; -1 if we couldn't launch the request.
|
||||||
@ -291,7 +291,7 @@ dnsserv_resolved(edge_connection_t *conn,
|
|||||||
conn->dns_server_request = NULL;
|
conn->dns_server_request = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the evdns server port for the UDP socket on <b>conn</b>, which
|
/** Set up the evdns server port for the UDP socket on <b>conn</b>, which
|
||||||
* must be an AP_DNS_LISTENER */
|
* must be an AP_DNS_LISTENER */
|
||||||
void
|
void
|
||||||
dnsserv_configure_listener(connection_t *conn)
|
dnsserv_configure_listener(connection_t *conn)
|
||||||
|
@ -438,6 +438,7 @@ _c_hist_compare(const void **_a, const void **_b)
|
|||||||
* are willing to talk about it? */
|
* are willing to talk about it? */
|
||||||
#define GEOIP_MIN_OBSERVATION_TIME (12*60*60)
|
#define GEOIP_MIN_OBSERVATION_TIME (12*60*60)
|
||||||
|
|
||||||
|
/* DOCDOC round_to_next_multiple_of */
|
||||||
static INLINE unsigned
|
static INLINE unsigned
|
||||||
round_to_next_multiple_of(unsigned number, unsigned divisor)
|
round_to_next_multiple_of(unsigned number, unsigned divisor)
|
||||||
{
|
{
|
||||||
@ -588,6 +589,7 @@ geoip_get_request_history(time_t now, geoip_client_action_t action)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC dump_geoip_stats */
|
||||||
void
|
void
|
||||||
dump_geoip_stats(void)
|
dump_geoip_stats(void)
|
||||||
{
|
{
|
||||||
|
@ -1902,12 +1902,14 @@ try_locking(or_options_t *options, int err_if_locked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC have_lockfile */
|
||||||
int
|
int
|
||||||
have_lockfile(void)
|
have_lockfile(void)
|
||||||
{
|
{
|
||||||
return lockfile != NULL;
|
return lockfile != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC release_lockfile */
|
||||||
void
|
void
|
||||||
release_lockfile(void)
|
release_lockfile(void)
|
||||||
{
|
{
|
||||||
|
@ -234,6 +234,7 @@ router_reload_consensus_networkstatus(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Free all storage held by the vote_routerstatus object <b>rs</b>. */
|
||||||
static void
|
static void
|
||||||
vote_routerstatus_free(vote_routerstatus_t *rs)
|
vote_routerstatus_free(vote_routerstatus_t *rs)
|
||||||
{
|
{
|
||||||
|
@ -981,7 +981,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
|
|||||||
#define AT(x) ((policy_summary_item_t*)smartlist_get(summary, x))
|
#define AT(x) ((policy_summary_item_t*)smartlist_get(summary, x))
|
||||||
|
|
||||||
#define REJECT_CUTOFF_COUNT (1<<25)
|
#define REJECT_CUTOFF_COUNT (1<<25)
|
||||||
/* Split an exit policy summary so that prt_min and prt_max
|
/** Split an exit policy summary so that prt_min and prt_max
|
||||||
* fall at exactly the start and end of an item respectively.
|
* fall at exactly the start and end of an item respectively.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
|
@ -1470,6 +1470,7 @@ packed_cell_alloc(void)
|
|||||||
++total_cells_allocated;
|
++total_cells_allocated;
|
||||||
return mp_pool_get(cell_pool);
|
return mp_pool_get(cell_pool);
|
||||||
}
|
}
|
||||||
|
/* DOCDOC dump_cell_pool_usage */
|
||||||
void
|
void
|
||||||
dump_cell_pool_usage(int severity)
|
dump_cell_pool_usage(int severity)
|
||||||
{
|
{
|
||||||
|
@ -149,12 +149,14 @@ get_my_v3_authority_signing_key(void)
|
|||||||
return authority_signing_key;
|
return authority_signing_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC get_my_v3_legacy_cert */
|
||||||
authority_cert_t *
|
authority_cert_t *
|
||||||
get_my_v3_legacy_cert(void)
|
get_my_v3_legacy_cert(void)
|
||||||
{
|
{
|
||||||
return legacy_key_certificate;
|
return legacy_key_certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC get_my_v3_legacy_signing_key */
|
||||||
crypto_pk_env_t *
|
crypto_pk_env_t *
|
||||||
get_my_v3_legacy_signing_key(void)
|
get_my_v3_legacy_signing_key(void)
|
||||||
{
|
{
|
||||||
@ -283,6 +285,7 @@ init_key_from_file(const char *fname, int generate, int severity)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC load_authority_keyset */
|
||||||
static int
|
static int
|
||||||
load_authority_keyset(int legacy, crypto_pk_env_t **key_out,
|
load_authority_keyset(int legacy, crypto_pk_env_t **key_out,
|
||||||
authority_cert_t **cert_out)
|
authority_cert_t **cert_out)
|
||||||
@ -1200,7 +1203,7 @@ router_get_my_descriptor(void)
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the extrainfo document for this OR, or NULL if we have none.
|
/** Return the extrainfo document for this OR, or NULL if we have none.
|
||||||
* Rebuilt it (and the server descriptor) if necessary. */
|
* Rebuilt it (and the server descriptor) if necessary. */
|
||||||
extrainfo_t *
|
extrainfo_t *
|
||||||
router_get_my_extrainfo(void)
|
router_get_my_extrainfo(void)
|
||||||
|
@ -549,6 +549,7 @@ router_should_rebuild_store(desc_store_t *store)
|
|||||||
return store->journal_len > (1<<15);
|
return store->journal_len > (1<<15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC desc_get_store */
|
||||||
static INLINE desc_store_t *
|
static INLINE desc_store_t *
|
||||||
desc_get_store(routerlist_t *rl, signed_descriptor_t *sd)
|
desc_get_store(routerlist_t *rl, signed_descriptor_t *sd)
|
||||||
{
|
{
|
||||||
@ -2465,6 +2466,7 @@ dump_routerlist_mem_usage(int severity)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _routerlist_find_elt */
|
||||||
static INLINE int
|
static INLINE int
|
||||||
_routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
|
_routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
|
||||||
{
|
{
|
||||||
@ -4368,6 +4370,7 @@ get_dir_info_status_string(void)
|
|||||||
return dir_info_status;
|
return dir_info_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC count_usable_descriptors */
|
||||||
static void
|
static void
|
||||||
count_usable_descriptors(int *num_present, int *num_usable,
|
count_usable_descriptors(int *num_present, int *num_usable,
|
||||||
const networkstatus_t *consensus,
|
const networkstatus_t *consensus,
|
||||||
|
@ -2847,6 +2847,7 @@ token_free(directory_token_t *tok)
|
|||||||
goto done_tokenizing; \
|
goto done_tokenizing; \
|
||||||
STMT_END
|
STMT_END
|
||||||
|
|
||||||
|
/* DOCDOC token_check_object */
|
||||||
static INLINE directory_token_t *
|
static INLINE directory_token_t *
|
||||||
token_check_object(memarea_t *area, const char *kwd,
|
token_check_object(memarea_t *area, const char *kwd,
|
||||||
directory_token_t *tok, obj_syntax o_syn)
|
directory_token_t *tok, obj_syntax o_syn)
|
||||||
|
@ -54,6 +54,7 @@ int have_failed = 0;
|
|||||||
|
|
||||||
static char temp_dir[256];
|
static char temp_dir[256];
|
||||||
|
|
||||||
|
/* DOCDOC setup_directory */
|
||||||
static void
|
static void
|
||||||
setup_directory(void)
|
setup_directory(void)
|
||||||
{
|
{
|
||||||
@ -78,6 +79,7 @@ setup_directory(void)
|
|||||||
is_setup = 1;
|
is_setup = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC get_fname */
|
||||||
static const char *
|
static const char *
|
||||||
get_fname(const char *name)
|
get_fname(const char *name)
|
||||||
{
|
{
|
||||||
@ -87,6 +89,7 @@ get_fname(const char *name)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC remove_directory */
|
||||||
static void
|
static void
|
||||||
remove_directory(void)
|
remove_directory(void)
|
||||||
{
|
{
|
||||||
@ -110,6 +113,7 @@ remove_directory(void)
|
|||||||
#undef CACHE_GENERATED_KEYS
|
#undef CACHE_GENERATED_KEYS
|
||||||
|
|
||||||
static crypto_pk_env_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL};
|
static crypto_pk_env_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL};
|
||||||
|
/* DOCDOC pk_generate */
|
||||||
static crypto_pk_env_t *
|
static crypto_pk_env_t *
|
||||||
pk_generate(int idx)
|
pk_generate(int idx)
|
||||||
{
|
{
|
||||||
@ -129,6 +133,7 @@ pk_generate(int idx)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC free_pregenerated_keys */
|
||||||
static void
|
static void
|
||||||
free_pregenerated_keys(void)
|
free_pregenerated_keys(void)
|
||||||
{
|
{
|
||||||
@ -141,6 +146,7 @@ free_pregenerated_keys(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_buffers */
|
||||||
static void
|
static void
|
||||||
test_buffers(void)
|
test_buffers(void)
|
||||||
{
|
{
|
||||||
@ -383,6 +389,7 @@ test_buffers(void)
|
|||||||
buf_free(buf2);
|
buf_free(buf2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_dh */
|
||||||
static void
|
static void
|
||||||
test_crypto_dh(void)
|
test_crypto_dh(void)
|
||||||
{
|
{
|
||||||
@ -424,6 +431,7 @@ test_crypto_dh(void)
|
|||||||
crypto_dh_free(dh2);
|
crypto_dh_free(dh2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_rng */
|
||||||
static void
|
static void
|
||||||
test_crypto_rng(void)
|
test_crypto_rng(void)
|
||||||
{
|
{
|
||||||
@ -461,6 +469,7 @@ test_crypto_rng(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_aes */
|
||||||
static void
|
static void
|
||||||
test_crypto_aes(void)
|
test_crypto_aes(void)
|
||||||
{
|
{
|
||||||
@ -590,6 +599,7 @@ test_crypto_aes(void)
|
|||||||
tor_free(data3);
|
tor_free(data3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_sha */
|
||||||
static void
|
static void
|
||||||
test_crypto_sha(void)
|
test_crypto_sha(void)
|
||||||
{
|
{
|
||||||
@ -658,6 +668,7 @@ test_crypto_sha(void)
|
|||||||
crypto_free_digest_env(d2);
|
crypto_free_digest_env(d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_pk */
|
||||||
static void
|
static void
|
||||||
test_crypto_pk(void)
|
test_crypto_pk(void)
|
||||||
{
|
{
|
||||||
@ -767,6 +778,7 @@ test_crypto_pk(void)
|
|||||||
tor_free(encoded);
|
tor_free(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto */
|
||||||
static void
|
static void
|
||||||
test_crypto(void)
|
test_crypto(void)
|
||||||
{
|
{
|
||||||
@ -875,6 +887,7 @@ test_crypto(void)
|
|||||||
tor_free(data3);
|
tor_free(data3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_crypto_s2k */
|
||||||
static void
|
static void
|
||||||
test_crypto_s2k(void)
|
test_crypto_s2k(void)
|
||||||
{
|
{
|
||||||
@ -907,6 +920,7 @@ test_crypto_s2k(void)
|
|||||||
tor_free(buf3);
|
tor_free(buf3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _compare_strs */
|
||||||
static int
|
static int
|
||||||
_compare_strs(const void **a, const void **b)
|
_compare_strs(const void **a, const void **b)
|
||||||
{
|
{
|
||||||
@ -914,6 +928,7 @@ _compare_strs(const void **a, const void **b)
|
|||||||
return strcmp(s1, s2);
|
return strcmp(s1, s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _compare_without_first_ch */
|
||||||
static int
|
static int
|
||||||
_compare_without_first_ch(const void *a, const void **b)
|
_compare_without_first_ch(const void *a, const void **b)
|
||||||
{
|
{
|
||||||
@ -921,6 +936,7 @@ _compare_without_first_ch(const void *a, const void **b)
|
|||||||
return strcasecmp(s1+1, s2);
|
return strcasecmp(s1+1, s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util */
|
||||||
static void
|
static void
|
||||||
test_util(void)
|
test_util(void)
|
||||||
{
|
{
|
||||||
@ -1413,6 +1429,7 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1,
|
|||||||
test_eq(port2, pt2); \
|
test_eq(port2, pt2); \
|
||||||
STMT_END
|
STMT_END
|
||||||
|
|
||||||
|
/* DOCDOC test_util_ip6_helpers */
|
||||||
static void
|
static void
|
||||||
test_util_ip6_helpers(void)
|
test_util_ip6_helpers(void)
|
||||||
{
|
{
|
||||||
@ -1738,6 +1755,7 @@ test_util_ip6_helpers(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_smartlist_basic */
|
||||||
static void
|
static void
|
||||||
test_util_smartlist_basic(void)
|
test_util_smartlist_basic(void)
|
||||||
{
|
{
|
||||||
@ -1776,6 +1794,7 @@ test_util_smartlist_basic(void)
|
|||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_smartlist_strings */
|
||||||
static void
|
static void
|
||||||
test_util_smartlist_strings(void)
|
test_util_smartlist_strings(void)
|
||||||
{
|
{
|
||||||
@ -2005,6 +2024,7 @@ test_util_smartlist_strings(void)
|
|||||||
tor_free(cp_alloc);
|
tor_free(cp_alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_smartlist_overlap */
|
||||||
static void
|
static void
|
||||||
test_util_smartlist_overlap(void)
|
test_util_smartlist_overlap(void)
|
||||||
{
|
{
|
||||||
@ -2057,6 +2077,7 @@ test_util_smartlist_overlap(void)
|
|||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_smartlist_digests */
|
||||||
static void
|
static void
|
||||||
test_util_smartlist_digests(void)
|
test_util_smartlist_digests(void)
|
||||||
{
|
{
|
||||||
@ -2089,6 +2110,7 @@ test_util_smartlist_digests(void)
|
|||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_smartlist_join */
|
||||||
static void
|
static void
|
||||||
test_util_smartlist_join(void)
|
test_util_smartlist_join(void)
|
||||||
{
|
{
|
||||||
@ -2140,6 +2162,7 @@ test_util_smartlist_join(void)
|
|||||||
tor_free(joined);
|
tor_free(joined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_bitarray */
|
||||||
static void
|
static void
|
||||||
test_util_bitarray(void)
|
test_util_bitarray(void)
|
||||||
{
|
{
|
||||||
@ -2181,6 +2204,7 @@ test_util_bitarray(void)
|
|||||||
bitarray_free(ba);
|
bitarray_free(ba);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_digestset */
|
||||||
static void
|
static void
|
||||||
test_util_digestset(void)
|
test_util_digestset(void)
|
||||||
{
|
{
|
||||||
@ -2229,6 +2253,7 @@ static strmap_t *_thread_test_strmap = NULL;
|
|||||||
static char *_thread1_name = NULL;
|
static char *_thread1_name = NULL;
|
||||||
static char *_thread2_name = NULL;
|
static char *_thread2_name = NULL;
|
||||||
|
|
||||||
|
/* DOCDOC _thread_test_func */
|
||||||
static void _thread_test_func(void* _s) ATTR_NORETURN;
|
static void _thread_test_func(void* _s) ATTR_NORETURN;
|
||||||
|
|
||||||
static int t1_count = 0;
|
static int t1_count = 0;
|
||||||
@ -2274,6 +2299,7 @@ _thread_test_func(void* _s)
|
|||||||
spawn_exit();
|
spawn_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_threads */
|
||||||
static void
|
static void
|
||||||
test_util_threads(void)
|
test_util_threads(void)
|
||||||
{
|
{
|
||||||
@ -2345,12 +2371,14 @@ test_util_threads(void)
|
|||||||
tor_mutex_free(_thread_test_start2);
|
tor_mutex_free(_thread_test_start2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _compare_strings_for_pqueue */
|
||||||
static int
|
static int
|
||||||
_compare_strings_for_pqueue(const void *s1, const void *s2)
|
_compare_strings_for_pqueue(const void *s1, const void *s2)
|
||||||
{
|
{
|
||||||
return strcmp((const char*)s1, (const char*)s2);
|
return strcmp((const char*)s1, (const char*)s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_pqueue */
|
||||||
static void
|
static void
|
||||||
test_util_pqueue(void)
|
test_util_pqueue(void)
|
||||||
{
|
{
|
||||||
@ -2408,6 +2436,7 @@ test_util_pqueue(void)
|
|||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_gzip */
|
||||||
static void
|
static void
|
||||||
test_util_gzip(void)
|
test_util_gzip(void)
|
||||||
{
|
{
|
||||||
@ -2514,6 +2543,7 @@ test_util_gzip(void)
|
|||||||
tor_free(buf1);
|
tor_free(buf1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_strmap */
|
||||||
static void
|
static void
|
||||||
test_util_strmap(void)
|
test_util_strmap(void)
|
||||||
{
|
{
|
||||||
@ -2604,6 +2634,7 @@ test_util_strmap(void)
|
|||||||
tor_free(visited);
|
tor_free(visited);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_mmap */
|
||||||
static void
|
static void
|
||||||
test_util_mmap(void)
|
test_util_mmap(void)
|
||||||
{
|
{
|
||||||
@ -2680,6 +2711,7 @@ test_util_mmap(void)
|
|||||||
tor_munmap_file(mapping);
|
tor_munmap_file(mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_control_formats */
|
||||||
static void
|
static void
|
||||||
test_util_control_formats(void)
|
test_util_control_formats(void)
|
||||||
{
|
{
|
||||||
@ -2697,6 +2729,7 @@ test_util_control_formats(void)
|
|||||||
tor_free(out);
|
tor_free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_onion_handshake */
|
||||||
static void
|
static void
|
||||||
test_onion_handshake(void)
|
test_onion_handshake(void)
|
||||||
{
|
{
|
||||||
@ -2745,6 +2778,7 @@ test_onion_handshake(void)
|
|||||||
|
|
||||||
extern smartlist_t *fingerprint_list;
|
extern smartlist_t *fingerprint_list;
|
||||||
|
|
||||||
|
/* DOCDOC test_dir_format */
|
||||||
static void
|
static void
|
||||||
test_dir_format(void)
|
test_dir_format(void)
|
||||||
{
|
{
|
||||||
@ -3065,6 +3099,7 @@ test_dir_format(void)
|
|||||||
tor_free(dir2); /* And more !*/
|
tor_free(dir2); /* And more !*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_dirutil */
|
||||||
static void
|
static void
|
||||||
test_dirutil(void)
|
test_dirutil(void)
|
||||||
{
|
{
|
||||||
@ -3100,6 +3135,7 @@ extern const char AUTHORITY_SIGNKEY_2[];
|
|||||||
extern const char AUTHORITY_CERT_3[];
|
extern const char AUTHORITY_CERT_3[];
|
||||||
extern const char AUTHORITY_SIGNKEY_3[];
|
extern const char AUTHORITY_SIGNKEY_3[];
|
||||||
|
|
||||||
|
/* DOCDOC test_same_voter */
|
||||||
static void
|
static void
|
||||||
test_same_voter(networkstatus_voter_info_t *v1,
|
test_same_voter(networkstatus_voter_info_t *v1,
|
||||||
networkstatus_voter_info_t *v2)
|
networkstatus_voter_info_t *v2)
|
||||||
@ -3116,6 +3152,7 @@ test_same_voter(networkstatus_voter_info_t *v1,
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_order_functions */
|
||||||
static void
|
static void
|
||||||
test_util_order_functions(void)
|
test_util_order_functions(void)
|
||||||
{
|
{
|
||||||
@ -3145,6 +3182,7 @@ test_util_order_functions(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC generate_ri_from_rs */
|
||||||
static routerinfo_t *
|
static routerinfo_t *
|
||||||
generate_ri_from_rs(const vote_routerstatus_t *vrs)
|
generate_ri_from_rs(const vote_routerstatus_t *vrs)
|
||||||
{
|
{
|
||||||
@ -3167,6 +3205,7 @@ generate_ri_from_rs(const vote_routerstatus_t *vrs)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_v3_networkstatus */
|
||||||
static void
|
static void
|
||||||
test_v3_networkstatus(void)
|
test_v3_networkstatus(void)
|
||||||
{
|
{
|
||||||
@ -3665,6 +3704,7 @@ test_v3_networkstatus(void)
|
|||||||
ns_detached_signatures_free(dsig2);
|
ns_detached_signatures_free(dsig2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_policy_summary_helper */
|
||||||
static void
|
static void
|
||||||
test_policy_summary_helper(const char *policy_str,
|
test_policy_summary_helper(const char *policy_str,
|
||||||
const char *expected_summary)
|
const char *expected_summary)
|
||||||
@ -3691,6 +3731,7 @@ test_policy_summary_helper(const char *policy_str,
|
|||||||
addr_policy_list_free(policy);
|
addr_policy_list_free(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_policies */
|
||||||
static void
|
static void
|
||||||
test_policies(void)
|
test_policies(void)
|
||||||
{
|
{
|
||||||
@ -3849,6 +3890,7 @@ test_policies(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_rend_fns */
|
||||||
static void
|
static void
|
||||||
test_rend_fns(void)
|
test_rend_fns(void)
|
||||||
{
|
{
|
||||||
@ -3914,6 +3956,7 @@ test_rend_fns(void)
|
|||||||
tor_free(encoded);
|
tor_free(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC bench_aes */
|
||||||
static void
|
static void
|
||||||
bench_aes(void)
|
bench_aes(void)
|
||||||
{
|
{
|
||||||
@ -3945,6 +3988,7 @@ bench_aes(void)
|
|||||||
crypto_free_cipher_env(c);
|
crypto_free_cipher_env(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC bench_dmap */
|
||||||
static void
|
static void
|
||||||
bench_dmap(void)
|
bench_dmap(void)
|
||||||
{
|
{
|
||||||
@ -4008,6 +4052,7 @@ bench_dmap(void)
|
|||||||
smartlist_free(sl2);
|
smartlist_free(sl2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_mempool */
|
||||||
static void
|
static void
|
||||||
test_util_mempool(void)
|
test_util_mempool(void)
|
||||||
{
|
{
|
||||||
@ -4065,6 +4110,7 @@ test_util_mempool(void)
|
|||||||
mp_pool_destroy(pool);
|
mp_pool_destroy(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_memarea */
|
||||||
static void
|
static void
|
||||||
test_util_memarea(void)
|
test_util_memarea(void)
|
||||||
{
|
{
|
||||||
@ -4160,6 +4206,7 @@ test_util_memarea(void)
|
|||||||
tor_free(malloced_ptr);
|
tor_free(malloced_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_util_datadir */
|
||||||
static void
|
static void
|
||||||
test_util_datadir(void)
|
test_util_datadir(void)
|
||||||
{
|
{
|
||||||
@ -4193,6 +4240,7 @@ test_util_datadir(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test AES-CTR encryption and decryption with IV. */
|
/* Test AES-CTR encryption and decryption with IV. */
|
||||||
|
/* DOCDOC test_crypto_aes_iv */
|
||||||
static void
|
static void
|
||||||
test_crypto_aes_iv(void)
|
test_crypto_aes_iv(void)
|
||||||
{
|
{
|
||||||
@ -4329,6 +4377,7 @@ test_crypto_aes_iv(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test base32 decoding. */
|
/* Test base32 decoding. */
|
||||||
|
/* DOCDOC test_crypto_base32_decode */
|
||||||
static void
|
static void
|
||||||
test_crypto_base32_decode(void)
|
test_crypto_base32_decode(void)
|
||||||
{
|
{
|
||||||
@ -4364,6 +4413,7 @@ test_crypto_base32_decode(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test encoding and parsing of v2 rendezvous service descriptors. */
|
/* Test encoding and parsing of v2 rendezvous service descriptors. */
|
||||||
|
/* DOCDOC test_rend_fns_v2 */
|
||||||
static void
|
static void
|
||||||
test_rend_fns_v2(void)
|
test_rend_fns_v2(void)
|
||||||
{
|
{
|
||||||
@ -4464,6 +4514,7 @@ test_rend_fns_v2(void)
|
|||||||
tor_free(intro_points_encrypted);
|
tor_free(intro_points_encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC test_geoip */
|
||||||
static void
|
static void
|
||||||
test_geoip(void)
|
test_geoip(void)
|
||||||
{
|
{
|
||||||
@ -4571,6 +4622,7 @@ static struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void syntax(void) ATTR_NORETURN;
|
static void syntax(void) ATTR_NORETURN;
|
||||||
|
/* DOCDOC syntax */
|
||||||
static void
|
static void
|
||||||
syntax(void)
|
syntax(void)
|
||||||
{
|
{
|
||||||
@ -4586,6 +4638,7 @@ syntax(void)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC main */
|
||||||
int
|
int
|
||||||
main(int c, char**v)
|
main(int c, char**v)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user