mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Add about 60 more DOCDOC comments to 0.2.3
Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
This commit is contained in:
parent
b353cd7e50
commit
173b18c79b
@ -156,7 +156,7 @@ tor_fopen_cloexec(const char *path, const char *mode)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MMAN_H
|
#if defined(HAVE_SYS_MMAN_H) || defined(RUNNING_DOXYGEN)
|
||||||
/** Try to create a memory mapping for <b>filename</b> and return it. On
|
/** Try to create a memory mapping for <b>filename</b> and return it. On
|
||||||
* failure, return NULL. Sets errno properly, using ERANGE to mean
|
* failure, return NULL. Sets errno properly, using ERANGE to mean
|
||||||
* "empty file". */
|
* "empty file". */
|
||||||
@ -501,10 +501,13 @@ tor_memmem(const void *_haystack, size_t hlen,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tables to implement ctypes-replacement TOR_IS*() functions. Each table
|
/**
|
||||||
|
* Tables to implement ctypes-replacement TOR_IS*() functions. Each table
|
||||||
* has 256 bits to look up whether a character is in some set or not. This
|
* has 256 bits to look up whether a character is in some set or not. This
|
||||||
* fails on non-ASCII platforms, but it is hard to find a platform whose
|
* fails on non-ASCII platforms, but it is hard to find a platform whose
|
||||||
* character set is not a superset of ASCII nowadays. */
|
* character set is not a superset of ASCII nowadays. */
|
||||||
|
|
||||||
|
/**@{*/
|
||||||
const uint32_t TOR_ISALPHA_TABLE[8] =
|
const uint32_t TOR_ISALPHA_TABLE[8] =
|
||||||
{ 0, 0, 0x7fffffe, 0x7fffffe, 0, 0, 0, 0 };
|
{ 0, 0, 0x7fffffe, 0x7fffffe, 0, 0, 0, 0 };
|
||||||
const uint32_t TOR_ISALNUM_TABLE[8] =
|
const uint32_t TOR_ISALNUM_TABLE[8] =
|
||||||
@ -517,8 +520,10 @@ const uint32_t TOR_ISPRINT_TABLE[8] =
|
|||||||
{ 0, 0xffffffff, 0xffffffff, 0x7fffffff, 0, 0, 0, 0x0 };
|
{ 0, 0xffffffff, 0xffffffff, 0x7fffffff, 0, 0, 0, 0x0 };
|
||||||
const uint32_t TOR_ISUPPER_TABLE[8] = { 0, 0, 0x7fffffe, 0, 0, 0, 0, 0 };
|
const uint32_t TOR_ISUPPER_TABLE[8] = { 0, 0, 0x7fffffe, 0, 0, 0, 0, 0 };
|
||||||
const uint32_t TOR_ISLOWER_TABLE[8] = { 0, 0, 0, 0x7fffffe, 0, 0, 0, 0 };
|
const uint32_t TOR_ISLOWER_TABLE[8] = { 0, 0, 0, 0x7fffffe, 0, 0, 0, 0 };
|
||||||
/* Upper-casing and lowercasing tables to map characters to upper/lowercase
|
|
||||||
* equivalents. */
|
/** Upper-casing and lowercasing tables to map characters to upper/lowercase
|
||||||
|
* equivalents. Used by tor_toupper() and tor_tolower(). */
|
||||||
|
/**@{*/
|
||||||
const char TOR_TOUPPER_TABLE[256] = {
|
const char TOR_TOUPPER_TABLE[256] = {
|
||||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
|
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
|
||||||
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
|
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
|
||||||
@ -555,6 +560,7 @@ const char TOR_TOLOWER_TABLE[256] = {
|
|||||||
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
|
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
|
||||||
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
|
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
|
||||||
};
|
};
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
/** Helper for tor_strtok_r_impl: Advances cp past all characters in
|
/** Helper for tor_strtok_r_impl: Advances cp past all characters in
|
||||||
* <b>sep</b>, and returns its new value. */
|
* <b>sep</b>, and returns its new value. */
|
||||||
@ -1779,9 +1785,11 @@ make_path_absolute(char *fname)
|
|||||||
#ifndef HAVE__NSGETENVIRON
|
#ifndef HAVE__NSGETENVIRON
|
||||||
#ifndef HAVE_EXTERN_ENVIRON_DECLARED
|
#ifndef HAVE_EXTERN_ENVIRON_DECLARED
|
||||||
/* Some platforms declare environ under some circumstances, others don't. */
|
/* Some platforms declare environ under some circumstances, others don't. */
|
||||||
|
#ifndef RUNNING_DOXYGEN
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Return the current environment. This is a portable replacement for
|
/** Return the current environment. This is a portable replacement for
|
||||||
* 'environ'. */
|
* 'environ'. */
|
||||||
@ -2356,6 +2364,7 @@ tor_gettimeofday(struct timeval *timeval)
|
|||||||
#define TIME_FNS_NEED_LOCKS
|
#define TIME_FNS_NEED_LOCKS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC correct_tm */
|
||||||
static struct tm *
|
static struct tm *
|
||||||
correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
|
correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
|
||||||
struct tm *r)
|
struct tm *r)
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
* \brief Wrappers to handle porting between different versions of libevent.
|
* \brief Wrappers to handle porting between different versions of libevent.
|
||||||
*
|
*
|
||||||
* In an ideal world, we'd just use Libevent 2.0 from now on. But as of June
|
* In an ideal world, we'd just use Libevent 2.0 from now on. But as of June
|
||||||
* 2009, Libevent 2.0 is still in alpha, and we will have old versions of
|
* 2012, Libevent 1.4 is still all over, and some poor souls are stuck on
|
||||||
* Libevent for the forseeable future.
|
* Libevent 1.3e. */
|
||||||
**/
|
|
||||||
|
|
||||||
#include "orconfig.h"
|
#include "orconfig.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
@ -57,7 +56,7 @@ typedef uint32_t le_version_t;
|
|||||||
|
|
||||||
static le_version_t tor_get_libevent_version(const char **v_out);
|
static le_version_t tor_get_libevent_version(const char **v_out);
|
||||||
|
|
||||||
#ifdef HAVE_EVENT_SET_LOG_CALLBACK
|
#if defined(HAVE_EVENT_SET_LOG_CALLBACK) || defined(RUNNING_DOXYGEN)
|
||||||
/** A string which, if it appears in a libevent log, should be ignored. */
|
/** A string which, if it appears in a libevent log, should be ignored. */
|
||||||
static const char *suppress_msg = NULL;
|
static const char *suppress_msg = NULL;
|
||||||
/** Callback function passed to event_set_log() so we can intercept
|
/** Callback function passed to event_set_log() so we can intercept
|
||||||
|
@ -59,6 +59,7 @@ struct timeval;
|
|||||||
int tor_event_base_loopexit(struct event_base *base, struct timeval *tv);
|
int tor_event_base_loopexit(struct event_base *base, struct timeval *tv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC tor_libevent_cfg */
|
||||||
typedef struct tor_libevent_cfg {
|
typedef struct tor_libevent_cfg {
|
||||||
int disable_iocp;
|
int disable_iocp;
|
||||||
int num_cpus;
|
int num_cpus;
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
/** Longest recognized */
|
/** Longest recognized */
|
||||||
#define MAX_DNS_LABEL_SIZE 63
|
#define MAX_DNS_LABEL_SIZE 63
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(0,9,8)
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(0,9,8) && !defined(RUNNING_DOXYGEN)
|
||||||
/** @{ */
|
/** @{ */
|
||||||
/** On OpenSSL versions before 0.9.8, there is no working SHA256
|
/** On OpenSSL versions before 0.9.8, there is no working SHA256
|
||||||
* implementation, so we use Tom St Denis's nice speedy one, slightly adapted
|
* implementation, so we use Tom St Denis's nice speedy one, slightly adapted
|
||||||
@ -404,6 +404,8 @@ crypto_cipher_new_with_iv(const char *key, const char *iv)
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return a new crypto_cipher_t with the provided <b>key</b> and an IV of all
|
||||||
|
* zero bytes. */
|
||||||
crypto_cipher_t *
|
crypto_cipher_t *
|
||||||
crypto_cipher_new(const char *key)
|
crypto_cipher_new(const char *key)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,7 @@ should_log_function_name(log_domain_mask_t domain, int severity)
|
|||||||
|
|
||||||
/** A mutex to guard changes to logfiles and logging. */
|
/** A mutex to guard changes to logfiles and logging. */
|
||||||
static tor_mutex_t log_mutex;
|
static tor_mutex_t log_mutex;
|
||||||
|
/* DOCDOC log_mutex_initialized */
|
||||||
static int log_mutex_initialized = 0;
|
static int log_mutex_initialized = 0;
|
||||||
|
|
||||||
/** Linked list of logfile_t. */
|
/** Linked list of logfile_t. */
|
||||||
|
@ -41,6 +41,7 @@ static void tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
|
|||||||
/* This struct may contain pointers into the original process
|
/* This struct may contain pointers into the original process
|
||||||
* specifier string, but it should *never* contain anything which
|
* specifier string, but it should *never* contain anything which
|
||||||
* needs to be freed. */
|
* needs to be freed. */
|
||||||
|
/* DOCDOC parsed_process_specifier_t */
|
||||||
struct parsed_process_specifier_t {
|
struct parsed_process_specifier_t {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
};
|
};
|
||||||
@ -81,6 +82,7 @@ parse_process_specifier(const char *process_spec,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_process_monitor_t */
|
||||||
struct tor_process_monitor_t {
|
struct tor_process_monitor_t {
|
||||||
/** Log domain for warning messages. */
|
/** Log domain for warning messages. */
|
||||||
log_domain_mask_t log_domain;
|
log_domain_mask_t log_domain;
|
||||||
@ -152,6 +154,7 @@ tor_validate_process_specifier(const char *process_spec,
|
|||||||
#define PERIODIC_TIMER_FLAGS (0)
|
#define PERIODIC_TIMER_FLAGS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC poll_interval_tv */
|
||||||
static struct timeval poll_interval_tv = {15, 0};
|
static struct timeval poll_interval_tv = {15, 0};
|
||||||
/* Note: If you port this file to plain Libevent 2, you can make
|
/* Note: If you port this file to plain Libevent 2, you can make
|
||||||
* poll_interval_tv const. It has to be non-const here because in
|
* poll_interval_tv const. It has to be non-const here because in
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
typedef struct tor_process_monitor_t tor_process_monitor_t;
|
typedef struct tor_process_monitor_t tor_process_monitor_t;
|
||||||
|
|
||||||
|
/* DOCDOC tor_procmon_callback_t */
|
||||||
typedef void (*tor_procmon_callback_t)(void *);
|
typedef void (*tor_procmon_callback_t)(void *);
|
||||||
|
|
||||||
int tor_validate_process_specifier(const char *process_spec,
|
int tor_validate_process_specifier(const char *process_spec,
|
||||||
|
@ -153,7 +153,7 @@ void tor_log(int severity, log_domain_mask_t domain, const char *format, ...)
|
|||||||
CHECK_PRINTF(3,4);
|
CHECK_PRINTF(3,4);
|
||||||
#define log tor_log /* hack it so we don't conflict with log() as much */
|
#define log tor_log /* hack it so we don't conflict with log() as much */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if defined(__GNUC__) || defined(RUNNING_DOXYGEN)
|
||||||
extern int _log_global_min_severity;
|
extern int _log_global_min_severity;
|
||||||
|
|
||||||
void _log_fn(int severity, log_domain_mask_t domain,
|
void _log_fn(int severity, log_domain_mask_t domain,
|
||||||
|
@ -225,6 +225,7 @@ static int check_cert_lifetime_internal(int severity, const X509 *cert,
|
|||||||
/** Global TLS contexts. We keep them here because nobody else needs
|
/** Global TLS contexts. We keep them here because nobody else needs
|
||||||
* to touch them. */
|
* to touch them. */
|
||||||
static tor_tls_context_t *server_tls_context = NULL;
|
static tor_tls_context_t *server_tls_context = NULL;
|
||||||
|
/* DOCDOC client_tls_context */
|
||||||
static tor_tls_context_t *client_tls_context = NULL;
|
static tor_tls_context_t *client_tls_context = NULL;
|
||||||
|
|
||||||
/** True iff tor_tls_init() has been called. */
|
/** True iff tor_tls_init() has been called. */
|
||||||
@ -268,6 +269,7 @@ tor_tls_get_state_description(tor_tls_t *tls, char *buf, size_t sz)
|
|||||||
tor_snprintf(buf, sz, "%s%s", ssl_state, tortls_state);
|
tor_snprintf(buf, sz, "%s%s", ssl_state, tortls_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_tls_log_one_error */
|
||||||
void
|
void
|
||||||
tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
|
tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
|
||||||
int severity, int domain, const char *doing)
|
int severity, int domain, const char *doing)
|
||||||
@ -1342,6 +1344,7 @@ tor_tls_client_is_using_v2_ciphers(const SSL *ssl, const char *address)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_tls_debug_state_callback */
|
||||||
static void
|
static void
|
||||||
tor_tls_debug_state_callback(const SSL *ssl, int type, int val)
|
tor_tls_debug_state_callback(const SSL *ssl, int type, int val)
|
||||||
{
|
{
|
||||||
@ -1621,6 +1624,7 @@ tor_tls_block_renegotiation(tor_tls_t *tls)
|
|||||||
tls->ssl->s3->flags &= ~SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
|
tls->ssl->s3->flags &= ~SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_tls_assert_renegotiation_unblocked */
|
||||||
void
|
void
|
||||||
tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls)
|
tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls)
|
||||||
{
|
{
|
||||||
|
@ -3303,6 +3303,7 @@ tor_process_get_stdout_pipe(process_handle_t *process_handle)
|
|||||||
return process_handle->stdout_pipe;
|
return process_handle->stdout_pipe;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
/* DOCDOC tor_process_get_stdout_pipe */
|
||||||
FILE *
|
FILE *
|
||||||
tor_process_get_stdout_pipe(process_handle_t *process_handle)
|
tor_process_get_stdout_pipe(process_handle_t *process_handle)
|
||||||
{
|
{
|
||||||
@ -3310,6 +3311,7 @@ tor_process_get_stdout_pipe(process_handle_t *process_handle)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC process_handle_new */
|
||||||
static process_handle_t *
|
static process_handle_t *
|
||||||
process_handle_new(void)
|
process_handle_new(void)
|
||||||
{
|
{
|
||||||
@ -4289,6 +4291,7 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
|
|||||||
return IO_STREAM_TERM;
|
return IO_STREAM_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_check_port_forwarding */
|
||||||
void
|
void
|
||||||
tor_check_port_forwarding(const char *filename, int dir_port, int or_port,
|
tor_check_port_forwarding(const char *filename, int dir_port, int or_port,
|
||||||
time_t now)
|
time_t now)
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
/* Memory management */
|
/* Memory management */
|
||||||
void *_tor_malloc(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
void *_tor_malloc(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
||||||
void *_tor_malloc_zero(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
void *_tor_malloc_zero(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
||||||
|
/* DOCDOC _tor_malloc_roundup */
|
||||||
void *_tor_malloc_roundup(size_t *size DMALLOC_PARAMS) ATTR_MALLOC;
|
void *_tor_malloc_roundup(size_t *size DMALLOC_PARAMS) ATTR_MALLOC;
|
||||||
void *_tor_calloc(size_t nmemb, size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
void *_tor_calloc(size_t nmemb, size_t size DMALLOC_PARAMS) ATTR_MALLOC;
|
||||||
void *_tor_realloc(void *ptr, size_t size DMALLOC_PARAMS);
|
void *_tor_realloc(void *ptr, size_t size DMALLOC_PARAMS);
|
||||||
@ -382,6 +383,7 @@ HANDLE load_windows_system_library(const TCHAR *library_name);
|
|||||||
|
|
||||||
int environment_variable_names_equal(const char *s1, const char *s2);
|
int environment_variable_names_equal(const char *s1, const char *s2);
|
||||||
|
|
||||||
|
/* DOCDOC process_environment_t */
|
||||||
struct process_environment_t {
|
struct process_environment_t {
|
||||||
/** A pointer to a sorted empty-string-terminated sequence of
|
/** A pointer to a sorted empty-string-terminated sequence of
|
||||||
* NUL-terminated strings of the form "NAME=VALUE". */
|
* NUL-terminated strings of the form "NAME=VALUE". */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
/** DOCDOC */
|
||||||
const char *
|
const char *
|
||||||
libor_get_digests(void)
|
libor_get_digests(void)
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ chunk_repack(chunk_t *chunk)
|
|||||||
chunk->data = &chunk->mem[0];
|
chunk->data = &chunk->mem[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_BUF_FREELISTS
|
#if defined(ENABLE_BUF_FREELISTS) || defined(RUNNING_DOXYGEN)
|
||||||
/** A freelist of chunks. */
|
/** A freelist of chunks. */
|
||||||
typedef struct chunk_freelist_t {
|
typedef struct chunk_freelist_t {
|
||||||
size_t alloc_size; /**< What size chunks does this freelist hold? */
|
size_t alloc_size; /**< What size chunks does this freelist hold? */
|
||||||
|
@ -236,6 +236,7 @@ circuit_build_times_quantile_cutoff(void)
|
|||||||
return num/100.0;
|
return num/100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC circuit_build_times_get_bw_scale */
|
||||||
int
|
int
|
||||||
circuit_build_times_get_bw_scale(networkstatus_t *ns)
|
circuit_build_times_get_bw_scale(networkstatus_t *ns)
|
||||||
{
|
{
|
||||||
@ -4972,6 +4973,7 @@ find_bridge_by_digest(const char *digest)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC find_transport_name_by_bridge_addrport */
|
||||||
const char *
|
const char *
|
||||||
find_transport_name_by_bridge_addrport(const tor_addr_t *addr, uint16_t port)
|
find_transport_name_by_bridge_addrport(const tor_addr_t *addr, uint16_t port)
|
||||||
{
|
{
|
||||||
|
@ -147,6 +147,7 @@ void circuit_build_times_network_is_live(circuit_build_times_t *cbt);
|
|||||||
int circuit_build_times_network_check_live(circuit_build_times_t *cbt);
|
int circuit_build_times_network_check_live(circuit_build_times_t *cbt);
|
||||||
void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
|
void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
|
||||||
|
|
||||||
|
/* DOCDOC circuit_build_times_get_bw_scale */
|
||||||
int circuit_build_times_get_bw_scale(networkstatus_t *ns);
|
int circuit_build_times_get_bw_scale(networkstatus_t *ns);
|
||||||
|
|
||||||
void clear_transport_list(void);
|
void clear_transport_list(void);
|
||||||
@ -157,6 +158,7 @@ void transport_free(transport_t *transport);
|
|||||||
transport_t *transport_new(const tor_addr_t *addr, uint16_t port,
|
transport_t *transport_new(const tor_addr_t *addr, uint16_t port,
|
||||||
const char *name, int socks_ver);
|
const char *name, int socks_ver);
|
||||||
|
|
||||||
|
/* DOCDOC find_transport_name_by_bridge_addrport */
|
||||||
const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr,
|
const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr,
|
||||||
uint16_t port);
|
uint16_t port);
|
||||||
|
|
||||||
|
@ -786,6 +786,7 @@ extern const char tor_git_revision[]; /* from tor_main.c */
|
|||||||
|
|
||||||
/** The version of this Tor process, as parsed. */
|
/** The version of this Tor process, as parsed. */
|
||||||
static char *the_tor_version = NULL;
|
static char *the_tor_version = NULL;
|
||||||
|
/* DOCDOC the_short_tor_version */
|
||||||
static char *the_short_tor_version = NULL;
|
static char *the_short_tor_version = NULL;
|
||||||
|
|
||||||
/** Return the current Tor version. */
|
/** Return the current Tor version. */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
const char *tor_get_digests(void);
|
const char *tor_get_digests(void);
|
||||||
|
|
||||||
|
/** DOCDOC */
|
||||||
const char *
|
const char *
|
||||||
tor_get_digests(void)
|
tor_get_digests(void)
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,7 @@ static int get_proxy_type(void);
|
|||||||
* XXX024 We should really use the entire list of interfaces here.
|
* XXX024 We should really use the entire list of interfaces here.
|
||||||
**/
|
**/
|
||||||
static tor_addr_t *last_interface_ipv4 = NULL;
|
static tor_addr_t *last_interface_ipv4 = NULL;
|
||||||
|
/* DOCDOC last_interface_ipv6 */
|
||||||
static tor_addr_t *last_interface_ipv6 = NULL;
|
static tor_addr_t *last_interface_ipv6 = NULL;
|
||||||
/** A list of tor_addr_t for addresses we've used in outgoing connections.
|
/** A list of tor_addr_t for addresses we've used in outgoing connections.
|
||||||
* Used to detect IP address changes. */
|
* Used to detect IP address changes. */
|
||||||
@ -731,7 +732,7 @@ connection_expire_held_open(void)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYS_UN_H
|
#if defined(HAVE_SYS_UN_H) || defined(RUNNING_DOXYGEN)
|
||||||
/** Create an AF_UNIX listenaddr struct.
|
/** Create an AF_UNIX listenaddr struct.
|
||||||
* <b>listenaddress</b> provides the path to the Unix socket.
|
* <b>listenaddress</b> provides the path to the Unix socket.
|
||||||
*
|
*
|
||||||
@ -2730,6 +2731,7 @@ connection_handle_read_impl(connection_t *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC connection_handle_read */
|
||||||
int
|
int
|
||||||
connection_handle_read(connection_t *conn)
|
connection_handle_read(connection_t *conn)
|
||||||
{
|
{
|
||||||
@ -3322,6 +3324,7 @@ connection_handle_write_impl(connection_t *conn, int force)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC connection_handle_write */
|
||||||
int
|
int
|
||||||
connection_handle_write(connection_t *conn, int force)
|
connection_handle_write(connection_t *conn, int force)
|
||||||
{
|
{
|
||||||
|
@ -92,8 +92,10 @@ int connection_flush(connection_t *conn);
|
|||||||
|
|
||||||
void _connection_write_to_buf_impl(const char *string, size_t len,
|
void _connection_write_to_buf_impl(const char *string, size_t len,
|
||||||
connection_t *conn, int zlib);
|
connection_t *conn, int zlib);
|
||||||
|
/* DOCDOC connection_write_to_buf */
|
||||||
static void connection_write_to_buf(const char *string, size_t len,
|
static void connection_write_to_buf(const char *string, size_t len,
|
||||||
connection_t *conn);
|
connection_t *conn);
|
||||||
|
/* DOCDOC connection_write_to_buf_zlib */
|
||||||
static void connection_write_to_buf_zlib(const char *string, size_t len,
|
static void connection_write_to_buf_zlib(const char *string, size_t len,
|
||||||
dir_connection_t *conn, int done);
|
dir_connection_t *conn, int done);
|
||||||
static INLINE void
|
static INLINE void
|
||||||
@ -108,7 +110,9 @@ connection_write_to_buf_zlib(const char *string, size_t len,
|
|||||||
_connection_write_to_buf_impl(string, len, TO_CONN(conn), done ? -1 : 1);
|
_connection_write_to_buf_impl(string, len, TO_CONN(conn), done ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC connection_get_inbuf_len */
|
||||||
static size_t connection_get_inbuf_len(connection_t *conn);
|
static size_t connection_get_inbuf_len(connection_t *conn);
|
||||||
|
/* DOCDOC connection_get_outbuf_len */
|
||||||
static size_t connection_get_outbuf_len(connection_t *conn);
|
static size_t connection_get_outbuf_len(connection_t *conn);
|
||||||
|
|
||||||
static INLINE size_t
|
static INLINE size_t
|
||||||
|
@ -457,7 +457,7 @@ connection_edge_about_to_close(edge_connection_t *edge_conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when we're about to finally unlink and free an AP (client)
|
/** Called when we're about to finally unlink and free an AP (client)
|
||||||
* connection: perform necessary accounting and cleanup */
|
* connection: perform necessary accounting and cleanup */
|
||||||
void
|
void
|
||||||
connection_ap_about_to_close(entry_connection_t *entry_conn)
|
connection_ap_about_to_close(entry_connection_t *entry_conn)
|
||||||
@ -492,7 +492,7 @@ connection_ap_about_to_close(entry_connection_t *entry_conn)
|
|||||||
circuit_detach_stream(circ, edge_conn);
|
circuit_detach_stream(circ, edge_conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when we're about to finally unlink and free an exit
|
/** Called when we're about to finally unlink and free an exit
|
||||||
* connection: perform necessary accounting and cleanup */
|
* connection: perform necessary accounting and cleanup */
|
||||||
void
|
void
|
||||||
connection_exit_about_to_close(edge_connection_t *edge_conn)
|
connection_exit_about_to_close(edge_connection_t *edge_conn)
|
||||||
|
@ -508,7 +508,7 @@ connection_or_finished_connecting(or_connection_t *or_conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when we're about to finally unlink and free an OR connection:
|
/** Called when we're about to finally unlink and free an OR connection:
|
||||||
* perform necessary accounting and cleanup */
|
* perform necessary accounting and cleanup */
|
||||||
void
|
void
|
||||||
connection_or_about_to_close(or_connection_t *or_conn)
|
connection_or_about_to_close(or_connection_t *or_conn)
|
||||||
|
@ -920,10 +920,12 @@ handle_control_loadconf(control_connection_t *conn, uint32_t len,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC control_event_t */
|
||||||
struct control_event_t {
|
struct control_event_t {
|
||||||
uint16_t event_code;
|
uint16_t event_code;
|
||||||
const char *event_name;
|
const char *event_name;
|
||||||
};
|
};
|
||||||
|
/* DOCDOC control_event_table */
|
||||||
static const struct control_event_t control_event_table[] = {
|
static const struct control_event_t control_event_table[] = {
|
||||||
{ EVENT_CIRCUIT_STATUS, "CIRC" },
|
{ EVENT_CIRCUIT_STATUS, "CIRC" },
|
||||||
{ EVENT_CIRCUIT_STATUS_MINOR, "CIRC_MINOR" },
|
{ EVENT_CIRCUIT_STATUS_MINOR, "CIRC_MINOR" },
|
||||||
@ -3215,6 +3217,7 @@ is_valid_initial_command(control_connection_t *conn, const char *cmd)
|
|||||||
* interfaces is broken. */
|
* interfaces is broken. */
|
||||||
#define MAX_COMMAND_LINE_LENGTH (1024*1024)
|
#define MAX_COMMAND_LINE_LENGTH (1024*1024)
|
||||||
|
|
||||||
|
/* DOCDOC peek_connection_has_control0_command */
|
||||||
static int
|
static int
|
||||||
peek_connection_has_control0_command(connection_t *conn)
|
peek_connection_has_control0_command(connection_t *conn)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ int control_event_or_conn_status(or_connection_t *conn,
|
|||||||
int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
|
int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
|
||||||
int control_event_stream_bandwidth(edge_connection_t *edge_conn);
|
int control_event_stream_bandwidth(edge_connection_t *edge_conn);
|
||||||
int control_event_stream_bandwidth_used(void);
|
int control_event_stream_bandwidth_used(void);
|
||||||
void control_event_logmsg(int severity, unsigned int domain, const char *msg);
|
void control_event_logmsg(int severity, uint32_t domain, const char *msg);
|
||||||
int control_event_descriptors_changed(smartlist_t *routers);
|
int control_event_descriptors_changed(smartlist_t *routers);
|
||||||
int control_event_address_mapped(const char *from, const char *to,
|
int control_event_address_mapped(const char *from, const char *to,
|
||||||
time_t expires, const char *error);
|
time_t expires, const char *error);
|
||||||
|
@ -2438,7 +2438,8 @@ write_http_response_header(dir_connection_t *conn, ssize_t length,
|
|||||||
cache_lifetime);
|
cache_lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INSTRUMENT_DOWNLOADS
|
#if defined(INSTRUMENT_DOWNLOADS) || defined(RUNNING_DOXYGEN)
|
||||||
|
/* DOCDOC */
|
||||||
typedef struct request_t {
|
typedef struct request_t {
|
||||||
uint64_t bytes; /**< How many bytes have we transferred? */
|
uint64_t bytes; /**< How many bytes have we transferred? */
|
||||||
uint64_t count; /**< How many requests have we made? */
|
uint64_t count; /**< How many requests have we made? */
|
||||||
@ -2796,7 +2797,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
|||||||
want_fps = url+strlen(CONSENSUS_URL_PREFIX);
|
want_fps = url+strlen(CONSENSUS_URL_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXXX MICRODESC NM NM should check document of correct flavor */
|
/* XXXX023 MICRODESC NM NM should check document of correct flavor */
|
||||||
if (v && want_fps &&
|
if (v && want_fps &&
|
||||||
!client_likes_consensus(v, want_fps)) {
|
!client_likes_consensus(v, want_fps)) {
|
||||||
write_http_status_line(conn, 404, "Consensus not signed by sufficient "
|
write_http_status_line(conn, 404, "Consensus not signed by sufficient "
|
||||||
|
@ -951,6 +951,7 @@ list_single_server_status(const routerinfo_t *desc, int is_live)
|
|||||||
return tor_strdup(buf);
|
return tor_strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC running_long_enough_to_decide_unreachable */
|
||||||
static INLINE int
|
static INLINE int
|
||||||
running_long_enough_to_decide_unreachable(void)
|
running_long_enough_to_decide_unreachable(void)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,7 @@ typedef struct pending_consensus_t {
|
|||||||
networkstatus_t *consensus;
|
networkstatus_t *consensus;
|
||||||
} pending_consensus_t;
|
} pending_consensus_t;
|
||||||
|
|
||||||
|
/* DOCDOC dirvote_add_signatures_to_all_pending_consensuses */
|
||||||
static int dirvote_add_signatures_to_all_pending_consensuses(
|
static int dirvote_add_signatures_to_all_pending_consensuses(
|
||||||
const char *detached_signatures_body,
|
const char *detached_signatures_body,
|
||||||
const char *source,
|
const char *source,
|
||||||
@ -2679,6 +2680,7 @@ static smartlist_t *pending_vote_list = NULL;
|
|||||||
* build a consensus, the votes go here for the next period. */
|
* build a consensus, the votes go here for the next period. */
|
||||||
static smartlist_t *previous_vote_list = NULL;
|
static smartlist_t *previous_vote_list = NULL;
|
||||||
|
|
||||||
|
/* DOCDOC pending_consensuses */
|
||||||
static pending_consensus_t pending_consensuses[N_CONSENSUS_FLAVORS];
|
static pending_consensus_t pending_consensuses[N_CONSENSUS_FLAVORS];
|
||||||
|
|
||||||
/** The detached signatures for the consensus that we're currently
|
/** The detached signatures for the consensus that we're currently
|
||||||
|
@ -66,7 +66,6 @@ void set_routerstatus_from_routerinfo(routerstatus_t *rs,
|
|||||||
routerinfo_t *ri, time_t now,
|
routerinfo_t *ri, time_t now,
|
||||||
int naming, int listbadexits,
|
int naming, int listbadexits,
|
||||||
int listbaddirs, int vote_on_hsdirs);
|
int listbaddirs, int vote_on_hsdirs);
|
||||||
void router_clear_status_flags(routerinfo_t *ri);
|
|
||||||
networkstatus_t *
|
networkstatus_t *
|
||||||
dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
|
dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
|
||||||
authority_cert_t *cert);
|
authority_cert_t *cert);
|
||||||
|
@ -613,6 +613,7 @@ dirreq_map_ent_eq(const dirreq_map_entry_t *a,
|
|||||||
return a->dirreq_id == b->dirreq_id && a->type == b->type;
|
return a->dirreq_id == b->dirreq_id && a->type == b->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC dirreq_map_ent_hash */
|
||||||
static unsigned
|
static unsigned
|
||||||
dirreq_map_ent_hash(const dirreq_map_entry_t *entry)
|
dirreq_map_ent_hash(const dirreq_map_entry_t *entry)
|
||||||
{
|
{
|
||||||
|
@ -102,9 +102,11 @@ static time_unit_t cfg_unit = UNIT_MONTH;
|
|||||||
|
|
||||||
/** How many days,hours,minutes into each unit does our accounting interval
|
/** How many days,hours,minutes into each unit does our accounting interval
|
||||||
* start? */
|
* start? */
|
||||||
|
/** @{ */
|
||||||
static int cfg_start_day = 0,
|
static int cfg_start_day = 0,
|
||||||
cfg_start_hour = 0,
|
cfg_start_hour = 0,
|
||||||
cfg_start_min = 0;
|
cfg_start_min = 0;
|
||||||
|
/** @} */
|
||||||
|
|
||||||
static void reset_accounting(time_t now);
|
static void reset_accounting(time_t now);
|
||||||
static int read_bandwidth_usage(void);
|
static int read_bandwidth_usage(void);
|
||||||
|
@ -94,7 +94,9 @@ static int stats_prev_global_read_bucket;
|
|||||||
static int stats_prev_global_write_bucket;
|
static int stats_prev_global_write_bucket;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DOCDOC stats_prev_n_read */
|
||||||
static uint64_t stats_prev_n_read = 0;
|
static uint64_t stats_prev_n_read = 0;
|
||||||
|
/* DOCDOC stats_prev_n_written */
|
||||||
static uint64_t stats_prev_n_written = 0;
|
static uint64_t stats_prev_n_written = 0;
|
||||||
|
|
||||||
/* XXX we might want to keep stats about global_relayed_*_bucket too. Or not.*/
|
/* XXX we might want to keep stats about global_relayed_*_bucket too. Or not.*/
|
||||||
@ -443,6 +445,7 @@ get_bytes_read(void)
|
|||||||
return stats_n_bytes_read;
|
return stats_n_bytes_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC get_bytes_written */
|
||||||
uint64_t
|
uint64_t
|
||||||
get_bytes_written(void)
|
get_bytes_written(void)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ microdescs_add_to_cache(microdesc_cache_t *cache,
|
|||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As microdescs_add_to_cache, but takes a list of micrdescriptors instead of
|
/** As microdescs_add_to_cache, but takes a list of micrdescriptors instead of
|
||||||
* a string to decode. Frees any members of <b>descriptors</b> that it does
|
* a string to decode. Frees any members of <b>descriptors</b> that it does
|
||||||
* not add. */
|
* not add. */
|
||||||
smartlist_t *
|
smartlist_t *
|
||||||
|
@ -78,6 +78,7 @@ typedef struct consensus_waiting_for_certs_t {
|
|||||||
int dl_failed;
|
int dl_failed;
|
||||||
} consensus_waiting_for_certs_t;
|
} consensus_waiting_for_certs_t;
|
||||||
|
|
||||||
|
/* DOCDOC consensus_waiting_for_certs */
|
||||||
static consensus_waiting_for_certs_t
|
static consensus_waiting_for_certs_t
|
||||||
consensus_waiting_for_certs[N_CONSENSUS_FLAVORS];
|
consensus_waiting_for_certs[N_CONSENSUS_FLAVORS];
|
||||||
|
|
||||||
@ -1006,8 +1007,8 @@ networkstatus_get_v2_list(void)
|
|||||||
return networkstatus_v2_list;
|
return networkstatus_v2_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As router_get_consensus_status_by_descriptor_digest, but does not return
|
/** As router_get_consensus_status_by_descriptor_digest, but does not return
|
||||||
* a const pointer */
|
* a const pointer. */
|
||||||
routerstatus_t *
|
routerstatus_t *
|
||||||
router_get_mutable_consensus_status_by_descriptor_digest(
|
router_get_mutable_consensus_status_by_descriptor_digest(
|
||||||
networkstatus_t *consensus,
|
networkstatus_t *consensus,
|
||||||
@ -2194,6 +2195,7 @@ networkstatus_dump_bridge_status_to_file(time_t now)
|
|||||||
tor_free(status);
|
tor_free(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC get_net_param_from_list */
|
||||||
static int32_t
|
static int32_t
|
||||||
get_net_param_from_list(smartlist_t *net_params, const char *param_name,
|
get_net_param_from_list(smartlist_t *net_params, const char *param_name,
|
||||||
int32_t default_val, int32_t min_val, int32_t max_val)
|
int32_t default_val, int32_t min_val, int32_t max_val)
|
||||||
|
@ -29,9 +29,11 @@ typedef struct onion_queue_t {
|
|||||||
#define ONIONQUEUE_WAIT_CUTOFF 5
|
#define ONIONQUEUE_WAIT_CUTOFF 5
|
||||||
|
|
||||||
/** First and last elements in the linked list of circuits waiting for CPU
|
/** First and last elements in the linked list of circuits waiting for CPU
|
||||||
* workers, or NULL if the list is empty. */
|
* workers, or NULL if the list is empty.
|
||||||
|
* @{ */
|
||||||
static onion_queue_t *ol_list=NULL;
|
static onion_queue_t *ol_list=NULL;
|
||||||
static onion_queue_t *ol_tail=NULL;
|
static onion_queue_t *ol_tail=NULL;
|
||||||
|
/**@}*/
|
||||||
/** Length of ol_list */
|
/** Length of ol_list */
|
||||||
static int ol_length=0;
|
static int ol_length=0;
|
||||||
|
|
||||||
|
@ -1065,6 +1065,7 @@ typedef struct connection_t {
|
|||||||
uint64_t dirreq_id;
|
uint64_t dirreq_id;
|
||||||
} connection_t;
|
} connection_t;
|
||||||
|
|
||||||
|
/* DOCDOC listener_connection_t */
|
||||||
typedef struct listener_connection_t {
|
typedef struct listener_connection_t {
|
||||||
connection_t _base;
|
connection_t _base;
|
||||||
|
|
||||||
|
@ -535,6 +535,7 @@ typedef struct policy_map_ent_t {
|
|||||||
addr_policy_t *policy;
|
addr_policy_t *policy;
|
||||||
} policy_map_ent_t;
|
} policy_map_ent_t;
|
||||||
|
|
||||||
|
/* DOCDOC policy_root */
|
||||||
static HT_HEAD(policy_map, policy_map_ent_t) policy_root = HT_INITIALIZER();
|
static HT_HEAD(policy_map, policy_map_ent_t) policy_root = HT_INITIALIZER();
|
||||||
|
|
||||||
/** Return true iff a and b are equal. */
|
/** Return true iff a and b are equal. */
|
||||||
|
@ -64,6 +64,7 @@ static struct timeval cached_time_hires = {0, 0};
|
|||||||
* cells. */
|
* cells. */
|
||||||
#define CELL_QUEUE_LOWWATER_SIZE 64
|
#define CELL_QUEUE_LOWWATER_SIZE 64
|
||||||
|
|
||||||
|
/* DOCDOC tor_gettimeofday_cached */
|
||||||
static void
|
static void
|
||||||
tor_gettimeofday_cached(struct timeval *tv)
|
tor_gettimeofday_cached(struct timeval *tv)
|
||||||
{
|
{
|
||||||
@ -73,6 +74,7 @@ tor_gettimeofday_cached(struct timeval *tv)
|
|||||||
*tv = cached_time_hires;
|
*tv = cached_time_hires;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC tor_gettimeofday_cache_clear */
|
||||||
void
|
void
|
||||||
tor_gettimeofday_cache_clear(void)
|
tor_gettimeofday_cache_clear(void)
|
||||||
{
|
{
|
||||||
@ -2090,6 +2092,7 @@ cell_ewma_get_tick(void)
|
|||||||
* has value ewma_scale_factor ** N.)
|
* has value ewma_scale_factor ** N.)
|
||||||
*/
|
*/
|
||||||
static double ewma_scale_factor = 0.1;
|
static double ewma_scale_factor = 0.1;
|
||||||
|
/* DOCDOC ewma_enabled */
|
||||||
static int ewma_enabled = 0;
|
static int ewma_enabled = 0;
|
||||||
|
|
||||||
#define EPSILON 0.00001
|
#define EPSILON 0.00001
|
||||||
|
@ -797,6 +797,7 @@ rend_cache_entry_free(rend_cache_entry_t *e)
|
|||||||
tor_free(e);
|
tor_free(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC _rend_cache_entry_free */
|
||||||
static void
|
static void
|
||||||
_rend_cache_entry_free(void *p)
|
_rend_cache_entry_free(void *p)
|
||||||
{
|
{
|
||||||
|
@ -1772,6 +1772,7 @@ rep_hist_load_state(or_state_t *state, char **err)
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
/* DOCDOC predicted_port_t */
|
||||||
typedef struct predicted_port_t {
|
typedef struct predicted_port_t {
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
time_t time;
|
time_t time;
|
||||||
@ -2745,6 +2746,7 @@ rep_hist_desc_stats_write(time_t now)
|
|||||||
return start_of_served_descs_stats_interval + WRITE_STATS_INTERVAL;
|
return start_of_served_descs_stats_interval + WRITE_STATS_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC rep_hist_note_desc_served */
|
||||||
void
|
void
|
||||||
rep_hist_note_desc_served(const char * desc)
|
rep_hist_note_desc_served(const char * desc)
|
||||||
{
|
{
|
||||||
@ -2786,27 +2788,27 @@ rep_hist_conn_stats_init(time_t now)
|
|||||||
* connection stats. */
|
* connection stats. */
|
||||||
#define BIDI_INTERVAL 10
|
#define BIDI_INTERVAL 10
|
||||||
|
|
||||||
/* Start of next BIDI_INTERVAL second interval. */
|
/** Start of next BIDI_INTERVAL second interval. */
|
||||||
static time_t bidi_next_interval = 0;
|
static time_t bidi_next_interval = 0;
|
||||||
|
|
||||||
/* Number of connections that we read and wrote less than BIDI_THRESHOLD
|
/** Number of connections that we read and wrote less than BIDI_THRESHOLD
|
||||||
* bytes from/to in BIDI_INTERVAL seconds. */
|
* bytes from/to in BIDI_INTERVAL seconds. */
|
||||||
static uint32_t below_threshold = 0;
|
static uint32_t below_threshold = 0;
|
||||||
|
|
||||||
/* Number of connections that we read at least BIDI_FACTOR times more
|
/** Number of connections that we read at least BIDI_FACTOR times more
|
||||||
* bytes from than we wrote to in BIDI_INTERVAL seconds. */
|
* bytes from than we wrote to in BIDI_INTERVAL seconds. */
|
||||||
static uint32_t mostly_read = 0;
|
static uint32_t mostly_read = 0;
|
||||||
|
|
||||||
/* Number of connections that we wrote at least BIDI_FACTOR times more
|
/** Number of connections that we wrote at least BIDI_FACTOR times more
|
||||||
* bytes to than we read from in BIDI_INTERVAL seconds. */
|
* bytes to than we read from in BIDI_INTERVAL seconds. */
|
||||||
static uint32_t mostly_written = 0;
|
static uint32_t mostly_written = 0;
|
||||||
|
|
||||||
/* Number of connections that we read and wrote at least BIDI_THRESHOLD
|
/** Number of connections that we read and wrote at least BIDI_THRESHOLD
|
||||||
* bytes from/to, but not BIDI_FACTOR times more in either direction in
|
* bytes from/to, but not BIDI_FACTOR times more in either direction in
|
||||||
* BIDI_INTERVAL seconds. */
|
* BIDI_INTERVAL seconds. */
|
||||||
static uint32_t both_read_and_written = 0;
|
static uint32_t both_read_and_written = 0;
|
||||||
|
|
||||||
/* Entry in a map from connection ID to the number of read and written
|
/** Entry in a map from connection ID to the number of read and written
|
||||||
* bytes on this connection in a BIDI_INTERVAL second interval. */
|
* bytes on this connection in a BIDI_INTERVAL second interval. */
|
||||||
typedef struct bidi_map_entry_t {
|
typedef struct bidi_map_entry_t {
|
||||||
HT_ENTRY(bidi_map_entry_t) node;
|
HT_ENTRY(bidi_map_entry_t) node;
|
||||||
@ -2826,6 +2828,7 @@ bidi_map_ent_eq(const bidi_map_entry_t *a, const bidi_map_entry_t *b)
|
|||||||
return a->conn_id == b->conn_id;
|
return a->conn_id == b->conn_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC bidi_map_ent_hash */
|
||||||
static unsigned
|
static unsigned
|
||||||
bidi_map_ent_hash(const bidi_map_entry_t *entry)
|
bidi_map_ent_hash(const bidi_map_entry_t *entry)
|
||||||
{
|
{
|
||||||
@ -2837,6 +2840,7 @@ HT_PROTOTYPE(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
|
|||||||
HT_GENERATE(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
|
HT_GENERATE(bidimap, bidi_map_entry_t, node, bidi_map_ent_hash,
|
||||||
bidi_map_ent_eq, 0.6, malloc, realloc, free);
|
bidi_map_ent_eq, 0.6, malloc, realloc, free);
|
||||||
|
|
||||||
|
/* DOCDOC bidi_map_free */
|
||||||
static void
|
static void
|
||||||
bidi_map_free(void)
|
bidi_map_free(void)
|
||||||
{
|
{
|
||||||
|
@ -484,6 +484,7 @@ v3_authority_check_key_expiry(void)
|
|||||||
last_warned = now;
|
last_warned = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC router_initialize_tls_context */
|
||||||
int
|
int
|
||||||
router_initialize_tls_context(void)
|
router_initialize_tls_context(void)
|
||||||
{
|
{
|
||||||
|
@ -104,9 +104,12 @@ static time_t last_descriptor_download_attempted = 0;
|
|||||||
/** When we last computed the weights to use for bandwidths on directory
|
/** When we last computed the weights to use for bandwidths on directory
|
||||||
* requests, what were the total weighted bandwidth, and our share of that
|
* requests, what were the total weighted bandwidth, and our share of that
|
||||||
* bandwidth? Used to determine what fraction of directory requests we should
|
* bandwidth? Used to determine what fraction of directory requests we should
|
||||||
* expect to see. */
|
* expect to see.
|
||||||
|
*
|
||||||
|
* @{ */
|
||||||
static uint64_t sl_last_total_weighted_bw = 0,
|
static uint64_t sl_last_total_weighted_bw = 0,
|
||||||
sl_last_weighted_bw_of_me = 0;
|
sl_last_weighted_bw_of_me = 0;
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
/** Return the number of directory authorities whose type matches some bit set
|
/** Return the number of directory authorities whose type matches some bit set
|
||||||
* in <b>type</b> */
|
* in <b>type</b> */
|
||||||
@ -2294,7 +2297,7 @@ hex_digest_nickname_matches(const char *hexdigest, const char *identity_digest,
|
|||||||
return tor_memeq(digest, identity_digest, DIGEST_LEN);
|
return tor_memeq(digest, identity_digest, DIGEST_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true iff <b>router</b> is listed as named in the current
|
/** Return true iff <b>router</b> is listed as named in the current
|
||||||
* consensus. */
|
* consensus. */
|
||||||
int
|
int
|
||||||
router_is_named(const routerinfo_t *router)
|
router_is_named(const routerinfo_t *router)
|
||||||
|
@ -103,6 +103,7 @@ static INLINE int WRA_WAS_OUTDATED(was_router_added_t s)
|
|||||||
s == ROUTER_NOT_IN_CONSENSUS ||
|
s == ROUTER_NOT_IN_CONSENSUS ||
|
||||||
s == ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS);
|
s == ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS);
|
||||||
}
|
}
|
||||||
|
/* DOCDOC WRA_WAS_REJECTED */
|
||||||
static INLINE int WRA_WAS_REJECTED(was_router_added_t s)
|
static INLINE int WRA_WAS_REJECTED(was_router_added_t s)
|
||||||
{
|
{
|
||||||
return (s == ROUTER_AUTHDIR_REJECTS);
|
return (s == ROUTER_AUTHDIR_REJECTS);
|
||||||
|
@ -519,6 +519,7 @@ static token_rule_t networkstatus_detached_signature_token_table[] = {
|
|||||||
END_OF_TABLE
|
END_OF_TABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* DOCDOC microdesc_token_table */
|
||||||
static token_rule_t microdesc_token_table[] = {
|
static token_rule_t microdesc_token_table[] = {
|
||||||
T1_START("onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024),
|
T1_START("onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024),
|
||||||
T01("family", K_FAMILY, ARGS, NO_OBJ ),
|
T01("family", K_FAMILY, ARGS, NO_OBJ ),
|
||||||
@ -4200,6 +4201,7 @@ find_all_exitpolicy(smartlist_t *s)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DOCDOC router_get_hash_impl_helper */
|
||||||
static int
|
static int
|
||||||
router_get_hash_impl_helper(const char *s, size_t s_len,
|
router_get_hash_impl_helper(const char *s, size_t s_len,
|
||||||
const char *start_str,
|
const char *start_str,
|
||||||
|
Loading…
Reference in New Issue
Block a user