Commit 3cdf2d67 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

it's amazing what a bit of punctuation can do for appearances


svn:r1843
parent 07871a8a
...@@ -172,7 +172,7 @@ crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa) ...@@ -172,7 +172,7 @@ crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa)
return env; return env;
} }
/** used by tortls.c: return the RSA* from a crypto_pk_env_t */ /** used by tortls.c: return the RSA* from a crypto_pk_env_t. */
RSA *_crypto_pk_env_get_rsa(crypto_pk_env_t *env) RSA *_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
{ {
return env->key; return env->key;
...@@ -1062,9 +1062,9 @@ crypto_digest_assign(crypto_digest_env_t *into, ...@@ -1062,9 +1062,9 @@ crypto_digest_assign(crypto_digest_env_t *into,
/* DH */ /* DH */
/** Shared P parameter for our DH key exchanged */ /** Shared P parameter for our DH key exchanged. */
static BIGNUM *dh_param_p = NULL; static BIGNUM *dh_param_p = NULL;
/** Shared G parameter for our DH key exchanges */ /** Shared G parameter for our DH key exchanges. */
static BIGNUM *dh_param_g = NULL; static BIGNUM *dh_param_g = NULL;
/** Initialize dh_param_p and dh_param_g if they are not already /** Initialize dh_param_p and dh_param_g if they are not already
...@@ -1332,7 +1332,7 @@ void crypto_pseudo_rand(unsigned int n, unsigned char *to) ...@@ -1332,7 +1332,7 @@ void crypto_pseudo_rand(unsigned int n, unsigned char *to)
} }
/** Return a pseudorandom integer, choosen uniformly from the values /** Return a pseudorandom integer, choosen uniformly from the values
* between 0 and max-1 */ * between 0 and max-1. */
int crypto_pseudo_rand_int(unsigned int max) { int crypto_pseudo_rand_int(unsigned int max) {
unsigned int val; unsigned int val;
unsigned int cutoff; unsigned int cutoff;
......
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
/** Information for a single logfile; only used in log.c */ /** Information for a single logfile; only used in log.c */
typedef struct logfile_t { typedef struct logfile_t {
struct logfile_t *next; /**< Next logfile_t in the linked list */ struct logfile_t *next; /**< Next logfile_t in the linked list. */
const char *filename; /**< Filename to open */ const char *filename; /**< Filename to open. */
FILE *file; /**< Stream to receive log messages */ FILE *file; /**< Stream to receive log messages. */
int needs_close; /**< Boolean: true if the stream gets closed on shutdown. */ int needs_close; /**< Boolean: true if the stream gets closed on shutdown. */
int loglevel; /**< Lowest severity level to send to this stream. */ int loglevel; /**< Lowest severity level to send to this stream. */
int max_loglevel; /**< Highest severity level to send to this stream. */ int max_loglevel; /**< Highest severity level to send to this stream. */
} logfile_t; } logfile_t;
/** Helper: map a log severity to descriptive string */ /** Helper: map a log severity to descriptive string. */
static INLINE const char *sev_to_string(int severity) { static INLINE const char *sev_to_string(int severity) {
switch(severity) { switch(severity) {
case LOG_DEBUG: return "debug"; case LOG_DEBUG: return "debug";
...@@ -43,7 +43,7 @@ static INLINE const char *sev_to_string(int severity) { ...@@ -43,7 +43,7 @@ static INLINE const char *sev_to_string(int severity) {
} }
} }
/** Linked list of logfile_t */ /** Linked list of logfile_t. */
static logfile_t *logfiles = NULL; static logfile_t *logfiles = NULL;
/** Helper: Format a log message into a fixed-sized buffer. (This is /** Helper: Format a log message into a fixed-sized buffer. (This is
...@@ -126,7 +126,7 @@ void _log(int severity, const char *format, ...) ...@@ -126,7 +126,7 @@ void _log(int severity, const char *format, ...)
va_end(ap); va_end(ap);
} }
/** Output a message to the log, prefixed with a function name <b>fn</b> */ /** Output a message to the log, prefixed with a function name <b>fn</b>. */
void _log_fn(int severity, const char *fn, const char *format, ...) void _log_fn(int severity, const char *fn, const char *format, ...)
{ {
va_list ap; va_list ap;
...@@ -135,7 +135,7 @@ void _log_fn(int severity, const char *fn, const char *format, ...) ...@@ -135,7 +135,7 @@ void _log_fn(int severity, const char *fn, const char *format, ...)
va_end(ap); va_end(ap);
} }
/** Close all open log files */ /** Close all open log files. */
void close_logs() void close_logs()
{ {
logfile_t *victim; logfile_t *victim;
...@@ -178,7 +178,7 @@ void add_stream_log(int loglevel, const char *name, FILE *stream) ...@@ -178,7 +178,7 @@ void add_stream_log(int loglevel, const char *name, FILE *stream)
/** /**
* Add a log handler to send messages to <b>filename</b>. If opening * Add a log handler to send messages to <b>filename</b>. If opening
* the logfile fails, -1 is returned and errno is set appropriately * the logfile fails, -1 is returned and errno is set appropriately
* (by fopen) * (by fopen).
*/ */
int add_file_log(int loglevel, const char *filename) int add_file_log(int loglevel, const char *filename)
{ {
......
...@@ -38,18 +38,18 @@ typedef struct tor_tls_context_st { ...@@ -38,18 +38,18 @@ typedef struct tor_tls_context_st {
} tor_tls_context; } tor_tls_context;
/** Holds a SSL object and its associated data. Members are only /** Holds a SSL object and its associated data. Members are only
* accessed from within tortls.c * accessed from within tortls.c.
*/ */
struct tor_tls_st { struct tor_tls_st {
SSL *ssl; /**< An OpenSSL SSL object */ SSL *ssl; /**< An OpenSSL SSL object. */
int socket; /**< The underlying file descriptor for this TLS connection */ int socket; /**< The underlying file descriptor for this TLS connection. */
enum { enum {
TOR_TLS_ST_HANDSHAKE, TOR_TLS_ST_OPEN, TOR_TLS_ST_GOTCLOSE, TOR_TLS_ST_HANDSHAKE, TOR_TLS_ST_OPEN, TOR_TLS_ST_GOTCLOSE,
TOR_TLS_ST_SENTCLOSE, TOR_TLS_ST_CLOSED TOR_TLS_ST_SENTCLOSE, TOR_TLS_ST_CLOSED
} state; /**< The current SSL state, depending on which operations have } state; /**< The current SSL state, depending on which operations have
* completed successfully. */ * completed successfully. */
int isServer; int isServer;
int wantwrite_n; /**< 0 normally, >0 if we returned wantwrite last time */ int wantwrite_n; /**< 0 normally, >0 if we returned wantwrite last time. */
}; };
static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa, static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa,
...@@ -59,7 +59,7 @@ static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa, ...@@ -59,7 +59,7 @@ static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa,
unsigned int lifetime); unsigned int lifetime);
/** Global tls context. We keep it here because nobody else needs to /** Global tls context. We keep it here because nobody else needs to
* touch it */ * touch it. */
static tor_tls_context *global_tls_context = NULL; static tor_tls_context *global_tls_context = NULL;
/** True iff tor_tls_init() has been called. */ /** True iff tor_tls_init() has been called. */
static int tls_library_is_initialized = 0; static int tls_library_is_initialized = 0;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "or.h" #include "or.h"
extern or_options_t options; /**< command-line and config-file options */ extern or_options_t options; /* command-line and config-file options */
/** keep statistics about how many of each type of cell we've received */ /** Keep statistics about how many of each type of cell we've received. */
unsigned long stats_n_padding_cells_processed = 0; unsigned long stats_n_padding_cells_processed = 0;
unsigned long stats_n_create_cells_processed = 0; unsigned long stats_n_create_cells_processed = 0;
unsigned long stats_n_created_cells_processed = 0; unsigned long stats_n_created_cells_processed = 0;
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
/********* START VARIABLES **********/ /********* START VARIABLES **********/
extern or_options_t options; /**< command-line and config-file options */ extern or_options_t options; /* command-line and config-file options */
/** Array of strings to make conn-\>type human-readable */ /** Array of strings to make conn-\>type human-readable. */
char *conn_type_to_string[] = { char *conn_type_to_string[] = {
"", /* 0 */ "", /* 0 */
"OP listener", /* 1 */ "OP listener", /* 1 */
...@@ -30,7 +30,7 @@ char *conn_type_to_string[] = { ...@@ -30,7 +30,7 @@ char *conn_type_to_string[] = {
"CPU worker", /* 11 */ "CPU worker", /* 11 */
}; };
/** Array of string arrays to make {conn-\>type,conn-\>state} human-readable */ /** Array of string arrays to make {conn-\>type,conn-\>state} human-readable. */
char *conn_state_to_string[][_CONN_TYPE_MAX+1] = { char *conn_state_to_string[][_CONN_TYPE_MAX+1] = {
{ NULL }, /* no type associated with 0 */ { NULL }, /* no type associated with 0 */
{ NULL }, /* op listener, obsolete */ { NULL }, /* op listener, obsolete */
......
...@@ -1487,7 +1487,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit) ...@@ -1487,7 +1487,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
* below as its root. * below as its root.
*/ */
struct client_dns_entry { struct client_dns_entry {
uint32_t addr; /**< The resolved IP of this entry */ uint32_t addr; /**< The resolved IP of this entry. */
time_t expires; /**< At what second does addr expire? */ time_t expires; /**< At what second does addr expire? */
int n_failures; /**< How many times has this entry failed to resolve so far? */ int n_failures; /**< How many times has this entry failed to resolve so far? */
}; };
......
/* Copyright 2003 Roger Dingledine. */ /* Copyright 2003-2004 Roger Dingledine. */
/* See LICENSE for licensing information */ /* See LICENSE for licensing information */
/* $Id$ */ /* $Id$ */
...@@ -11,27 +11,27 @@ ...@@ -11,27 +11,27 @@
**/ **/
#include "or.h" #include "or.h"
extern or_options_t options; /**< command-line and config-file options */ extern or_options_t options; /* command-line and config-file options */
/** The maximum number of cpuworker processes we will keep around */ /** The maximum number of cpuworker processes we will keep around. */
#define MAX_CPUWORKERS 16 #define MAX_CPUWORKERS 16
/** The minimum number of cpuworker processes we will keep around */ /** The minimum number of cpuworker processes we will keep around. */
#define MIN_CPUWORKERS 1 #define MIN_CPUWORKERS 1
/** The tag specifies which circuit this onionskin was from */ /** The tag specifies which circuit this onionskin was from. */
#define TAG_LEN 8 #define TAG_LEN 8
/** How many bytes are sent from tor to the cpuworker? */ /** How many bytes are sent from tor to the cpuworker? */
#define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN) #define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN)
/** How many bytes are sent from the cpuworker back to tor? */ /** How many bytes are sent from the cpuworker back to tor? */
#define LEN_ONION_RESPONSE (1+TAG_LEN+ONIONSKIN_REPLY_LEN+40+32) #define LEN_ONION_RESPONSE (1+TAG_LEN+ONIONSKIN_REPLY_LEN+40+32)
/** How many cpuworkers we have running right now */ /** How many cpuworkers we have running right now. */
static int num_cpuworkers=0; static int num_cpuworkers=0;
/** How many of the running cpuworkers have an assigned task right now */ /** How many of the running cpuworkers have an assigned task right now. */
static int num_cpuworkers_busy=0; static int num_cpuworkers_busy=0;
/** We need to spawn new cpuworkers whenever we rotate the onion keys /** We need to spawn new cpuworkers whenever we rotate the onion keys
* on platforms where execution contexts==processes. This variable stores * on platforms where execution contexts==processes. This variable stores
* the last time we got a key rotation event.*/ * the last time we got a key rotation event. */
static time_t last_rotation_time=0; static time_t last_rotation_time=0;
int cpuworker_main(void *data); int cpuworker_main(void *data);
...@@ -312,7 +312,7 @@ static void spawn_enough_cpuworkers(void) { ...@@ -312,7 +312,7 @@ static void spawn_enough_cpuworkers(void) {
} }
} }
/** Take a pending task from the queue and assign it to 'cpuworker' */ /** Take a pending task from the queue and assign it to 'cpuworker'. */
static void process_pending_task(connection_t *cpuworker) { static void process_pending_task(connection_t *cpuworker) {
circuit_t *circ; circuit_t *circ;
......
...@@ -29,14 +29,14 @@ extern or_options_t options; /* command-line and config-file options */ ...@@ -29,14 +29,14 @@ extern or_options_t options; /* command-line and config-file options */
#define MAX_IDLE_DNSWORKERS 10 #define MAX_IDLE_DNSWORKERS 10
/** Possible outcomes from hostname lookup: permanent failure, /** Possible outcomes from hostname lookup: permanent failure,
* transient (retryable) failure, and success */ * transient (retryable) failure, and success. */
#define DNS_RESOLVE_FAILED_TRANSIENT 1 #define DNS_RESOLVE_FAILED_TRANSIENT 1
#define DNS_RESOLVE_FAILED_PERMANENT 2 #define DNS_RESOLVE_FAILED_PERMANENT 2
#define DNS_RESOLVE_SUCCEEDED 3 #define DNS_RESOLVE_SUCCEEDED 3
/** How many dnsworkers we have running right now */ /** How many dnsworkers we have running right now. */
int num_dnsworkers=0; int num_dnsworkers=0;
/** How many of the running dnsworkers have an assigned task right now */ /** How many of the running dnsworkers have an assigned task right now. */
int num_dnsworkers_busy=0; int num_dnsworkers_busy=0;
/** Linked list of connections waiting for a DNS answer. */ /** Linked list of connections waiting for a DNS answer. */
...@@ -51,13 +51,13 @@ struct pending_connection_t { ...@@ -51,13 +51,13 @@ struct pending_connection_t {
*/ */
struct cached_resolve { struct cached_resolve {
SPLAY_ENTRY(cached_resolve) node; SPLAY_ENTRY(cached_resolve) node;
char address[MAX_ADDRESSLEN]; /**< The hostname to be resolved */ char address[MAX_ADDRESSLEN]; /**< The hostname to be resolved. */
uint32_t addr; /**< IPv4 addr for <b>address</b>. */ uint32_t addr; /**< IPv4 addr for <b>address</b>. */
char state; /**< 0 is pending; 1 means answer is valid; 2 means resolve failed */ char state; /**< 0 is pending; 1 means answer is valid; 2 means resolve failed. */
#define CACHE_STATE_PENDING 0 #define CACHE_STATE_PENDING 0
#define CACHE_STATE_VALID 1 #define CACHE_STATE_VALID 1
#define CACHE_STATE_FAILED 2 #define CACHE_STATE_FAILED 2
uint32_t expire; /**< Remove items from cache after this time */ uint32_t expire; /**< Remove items from cache after this time. */
struct pending_connection_t *pending_connections; struct pending_connection_t *pending_connections;
struct cached_resolve *next; struct cached_resolve *next;
}; };
...@@ -70,7 +70,7 @@ int dnsworker_main(void *data); ...@@ -70,7 +70,7 @@ int dnsworker_main(void *data);
static int spawn_dnsworker(void); static int spawn_dnsworker(void);
static void spawn_enough_dnsworkers(void); static void spawn_enough_dnsworkers(void);
/** Splay tree of cached_resolve objects */ /** Splay tree of cached_resolve objects. */
static SPLAY_HEAD(cache_tree, cached_resolve) cache_root; static SPLAY_HEAD(cache_tree, cached_resolve) cache_root;
/** Function to compare hashed resolves on their addresses; used to /** Function to compare hashed resolves on their addresses; used to
...@@ -84,7 +84,7 @@ static int compare_cached_resolves(struct cached_resolve *a, ...@@ -84,7 +84,7 @@ static int compare_cached_resolves(struct cached_resolve *a,
SPLAY_PROTOTYPE(cache_tree, cached_resolve, node, compare_cached_resolves); SPLAY_PROTOTYPE(cache_tree, cached_resolve, node, compare_cached_resolves);
SPLAY_GENERATE(cache_tree, cached_resolve, node, compare_cached_resolves); SPLAY_GENERATE(cache_tree, cached_resolve, node, compare_cached_resolves);
/** Initialize the DNS cache */ /** Initialize the DNS cache. */
static void init_cache_tree(void) { static void init_cache_tree(void) {
SPLAY_INIT(&cache_root); SPLAY_INIT(&cache_root);
} }
...@@ -95,7 +95,7 @@ void dns_init(void) { ...@@ -95,7 +95,7 @@ void dns_init(void) {
spawn_enough_dnsworkers(); spawn_enough_dnsworkers();
} }
/** Linked list of resolved addresses, oldest to newest */ /** Linked list of resolved addresses, oldest to newest. */
static struct cached_resolve *oldest_cached_resolve = NULL; static struct cached_resolve *oldest_cached_resolve = NULL;
static struct cached_resolve *newest_cached_resolve = NULL; static struct cached_resolve *newest_cached_resolve = NULL;
......
...@@ -19,8 +19,8 @@ static int init_from_config(int argc, char **argv); ...@@ -19,8 +19,8 @@ static int init_from_config(int argc, char **argv);
/* declared in connection.c */ /* declared in connection.c */
extern char *conn_state_to_string[][_CONN_TYPE_MAX+1]; extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
or_options_t options; /**< command-line and config-file options */ or_options_t options; /**< Command-line and config-file options. */
int global_read_bucket; /**< max number of bytes I can read this second */ int global_read_bucket; /**< Max number of bytes I can read this second. */
/** What was the read bucket before the last call to prepare_for_pool? /** What was the read bucket before the last call to prepare_for_pool?
* (used to determine how many bytes we've read). */ * (used to determine how many bytes we've read). */
...@@ -38,12 +38,12 @@ static connection_t *connection_array[MAXCONNECTIONS] = ...@@ -38,12 +38,12 @@ static connection_t *connection_array[MAXCONNECTIONS] =
/** Array of pollfd objects for calls to poll(). */ /** Array of pollfd objects for calls to poll(). */
static struct pollfd poll_array[MAXCONNECTIONS]; static struct pollfd poll_array[MAXCONNECTIONS];
static int nfds=0; /**< number of connections currently active */ static int nfds=0; /**< Number of connections currently active. */
#ifndef MS_WINDOWS /* do signal stuff only on unix */ #ifndef MS_WINDOWS /* do signal stuff only on unix */
static int please_dumpstats=0; /**< whether we should dump stats during the loop */ static int please_dumpstats=0; /**< Whether we should dump stats during the loop. */
static int please_reset=0; /**< whether we just got a sighup */ static int please_reset=0; /**< Whether we just got a sighup. */
static int please_reap_children=0; /**< whether we should waitpid for exited children */ static int please_reap_children=0; /**< Whether we should waitpid for exited children. */
#endif /* signal stuff */ #endif /* signal stuff */
/** We set this to 1 when we've fetched a dir, to know whether to complain /** We set this to 1 when we've fetched a dir, to know whether to complain
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
#include "../common/util.h" #include "../common/util.h"
/** Upper bound on maximum simultaneous connections; can be lowered by /** Upper bound on maximum simultaneous connections; can be lowered by
* config file */ * config file. */
#define MAXCONNECTIONS 1000 #define MAXCONNECTIONS 1000
#define DEFAULT_BANDWIDTH_OP (1024 * 1000) #define DEFAULT_BANDWIDTH_OP (1024 * 1000)
...@@ -134,61 +134,61 @@ ...@@ -134,61 +134,61 @@
#define _CONN_TYPE_MIN 3 #define _CONN_TYPE_MIN 3
/** Type for sockets listening for OR connections. */ /** Type for sockets listening for OR connections. */
#define CONN_TYPE_OR_LISTENER 3 #define CONN_TYPE_OR_LISTENER 3
/** Type for OR-to-OR or OP-to-OR connections */ /** Type for OR-to-OR or OP-to-OR connections. */
#define CONN_TYPE_OR 4 #define CONN_TYPE_OR 4
/** Type for connections from final OR to chosen destination. */ /** Type for connections from final OR to chosen destination. */
#define CONN_TYPE_EXIT 5 #define CONN_TYPE_EXIT 5
/** Type for sockets listening for SOCKS connections */ /** Type for sockets listening for SOCKS connections. */
#define CONN_TYPE_AP_LISTENER 6 #define CONN_TYPE_AP_LISTENER 6
/** Type for SOCKS connections to OP */ /** Type for SOCKS connections to OP. */
#define CONN_TYPE_AP 7 #define CONN_TYPE_AP 7
/** Type for sockets listening for HTTP connections to the directory server */ /** Type for sockets listening for HTTP connections to the directory server. */
#define CONN_TYPE_DIR_LISTENER 8 #define CONN_TYPE_DIR_LISTENER 8
/** Type for HTTP connections to the directory server */ /** Type for HTTP connections to the directory server. */
#define CONN_TYPE_DIR 9 #define CONN_TYPE_DIR 9
/** Type for connections to local dnsworker processes */ /** Type for connections to local dnsworker processes. */
#define CONN_TYPE_DNSWORKER 10 #define CONN_TYPE_DNSWORKER 10
/** Type for connections to local cpuworker processes */ /** Type for connections to local cpuworker processes. */
#define CONN_TYPE_CPUWORKER 11 #define CONN_TYPE_CPUWORKER 11
#define _CONN_TYPE_MAX 11 #define _CONN_TYPE_MAX 11
/** State for any listener connection */ /** State for any listener connection. */
#define LISTENER_STATE_READY 0 #define LISTENER_STATE_READY 0
#define _DNSWORKER_STATE_MIN 1 #define _DNSWORKER_STATE_MIN 1
/** State for a connection to a dnsworker process that's idle */ /** State for a connection to a dnsworker process that's idle. */
#define DNSWORKER_STATE_IDLE 1 #define DNSWORKER_STATE_IDLE 1
/** State for a connection to a dnsworker process that's resolving a hostname*/ /** State for a connection to a dnsworker process that's resolving a hostname. */
#define DNSWORKER_STATE_BUSY 2 #define DNSWORKER_STATE_BUSY 2
#define _DNSWORKER_STATE_MAX 2 #define _DNSWORKER_STATE_MAX 2
#define _CPUWORKER_STATE_MIN 1 #define _CPUWORKER_STATE_MIN 1
/** State for a connection to a cpuworker process that's idle */ /** State for a connection to a cpuworker process that's idle. */
#define CPUWORKER_STATE_IDLE 1 #define CPUWORKER_STATE_IDLE 1
/** State for a connection to a cpuworker process that's processing a /** State for a connection to a cpuworker process that's processing a
* handshake */ * handshake. */
#define CPUWORKER_STATE_BUSY_ONION 2 #define CPUWORKER_STATE_BUSY_ONION 2
#define _CPUWORKER_STATE_MAX 2 #define _CPUWORKER_STATE_MAX 2
#define CPUWORKER_TASK_ONION CPUWORKER_STATE_BUSY_ONION #define CPUWORKER_TASK_ONION CPUWORKER_STATE_BUSY_ONION
#define _OR_CONN_STATE_MIN 1 #define _OR_CONN_STATE_MIN 1
/** State for a connection to an OR: waiting for connect() to finish */ /** State for a connection to an OR: waiting for connect() to finish. */
#define OR_CONN_STATE_CONNECTING 1 #define OR_CONN_STATE_CONNECTING 1
/** State for a connection to an OR: SSL is handshaking, not done yet */ /** State for a connection to an OR: SSL is handshaking, not done yet. */
#define OR_CONN_STATE_HANDSHAKING 2 #define OR_CONN_STATE_HANDSHAKING 2
/** State for a connection to an OR: Ready to send/receive cells. */ /** State for a connection to an OR: Ready to send/receive cells. */
#define OR_CONN_STATE_OPEN 3 #define OR_CONN_STATE_OPEN 3
#define _OR_CONN_STATE_MAX 3 #define _OR_CONN_STATE_MAX 3
#define _EXIT_CONN_STATE_MIN 1 #define _EXIT_CONN_STATE_MIN 1
/** State for an exit connection: waiting for response from dns farm */ /** State for an exit connection: waiting for response from dns farm. */
#define EXIT_CONN_STATE_RESOLVING 1 #define EXIT_CONN_STATE_RESOLVING 1
/** State for an exit connection: waiting for connect() to finish */ /** State for an exit connection: waiting for connect() to finish. */
#define EXIT_CONN_STATE_CONNECTING 2 #define EXIT_CONN_STATE_CONNECTING 2
/** State for an exit connection: open and ready to transmit data */ /** State for an exit connection: open and ready to transmit data. */
#define EXIT_CONN_STATE_OPEN 3 #define EXIT_CONN_STATE_OPEN 3
/** State for an exit connection: waiting to be removed */ /** State for an exit connection: waiting to be removed. */
#define EXIT_CONN_STATE_RESOLVEFAILED 4 #define EXIT_CONN_STATE_RESOLVEFAILED 4
#define _EXIT_CONN_STATE_MAX 4 #define _EXIT_CONN_STATE_MAX 4
#if 0 #if 0
...@@ -198,34 +198,34 @@ ...@@ -198,34 +198,34 @@
/* the AP state values must be disjoint from the EXIT state values */ /* the AP state values must be disjoint from the EXIT state values */
#define _AP_CONN_STATE_MIN 5 #define _AP_CONN_STATE_MIN 5
/** State for a SOCKS connection: waiting for SOCKS request */ /** State for a SOCKS connection: waiting for SOCKS request. */
#define AP_CONN_STATE_SOCKS_WAIT 5 #define AP_CONN_STATE_SOCKS_WAIT 5
/** State for a SOCKS connection: got a y.onion URL; waiting to receive /** State for a SOCKS connection: got a y.onion URL; waiting to receive
* rendezvous rescriptor. */ * rendezvous rescriptor. */
#define AP_CONN_STATE_RENDDESC_WAIT 6 #define AP_CONN_STATE_RENDDESC_WAIT 6
/** State for a SOCKS connection: waiting for a completed circuit */ /** State for a SOCKS connection: waiting for a completed circuit. */
#define AP_CONN_STATE_CIRCUIT_WAIT 7 #define AP_CONN_STATE_CIRCUIT_WAIT 7
/** State for a SOCKS connection: sent BEGIN, waiting for CONNECTED */ /** State for a SOCKS connection: sent BEGIN, waiting for CONNECTED. */
#define AP_CONN_STATE_CONNECT_WAIT 8 #define AP_CONN_STATE_CONNECT_WAIT 8
/** State for a SOCKS connection: ready to send and receive */ /** State for a SOCKS connection: ready to send and receive. */
#define AP_CONN_STATE_OPEN 9 #define AP_CONN_STATE_OPEN 9
#define _AP_CONN_STATE_MAX 9 #define _AP_CONN_STATE_MAX 9
#define _DIR_CONN_STATE_MIN 1 #define _DIR_CONN_STATE_MIN 1
/** State for connection to directory server: waiting for connect() */ /** State for connection to directory server: waiting for connect(). */
#define DIR_CONN_STATE_CONNECTING 1 #define DIR_CONN_STATE_CONNECTING 1
/** State for connection to directory server: sending HTTP request */ /** State for connection to directory server: sending HTTP request. */
#define DIR_CONN_STATE_CLIENT_SENDING 2 #define DIR_CONN_STATE_CLIENT_SENDING 2
/** State for connection to directory server: reading HTTP response */ /** State for connection to directory server: reading HTTP response. */
#define DIR_CONN_STATE_CLIENT_READING 3 #define DIR_CONN_STATE_CLIENT_READING 3
/** State for connection at directory server: waiting for HTTP request */ /** State for connection at directory server: waiting for HTTP request. */
#define DIR_CONN_STATE_SERVER_COMMAND_WAIT 4 #define DIR_CONN_STATE_SERVER_COMMAND_WAIT 4
/** State for connection at directory server: sending HTTP response */ /** State for connection at directory server: sending HTTP response. */
#define DIR_CONN_STATE_SERVER_WRITING 5 #define DIR_CONN_STATE_SERVER_WRITING 5
#define _DIR_CONN_STATE_MAX 5 #define _DIR_CONN_STATE_MAX 5
#define _DIR_PURPOSE_MIN 1 #define _DIR_PURPOSE_MIN 1
/** Purpose for connection to directory server: download a directory */ /** Purpose for connection to directory server: download a directory. */
#define DIR_PURPOSE_FETCH_DIR 1 #define DIR_PURPOSE_FETCH_DIR 1
/** Purpose for connection to directory server: download a rendezvous /** Purpose for connection to directory server: download a rendezvous
* descriptor. */ * descriptor. */
...@@ -233,22 +233,22 @@ ...@@ -233,22 +233,22 @@
/** Purpose for connection to directory server: set after a rendezvous /** Purpose for connection to directory server: set after a rendezvous
* descriptor is downloaded. */ * descriptor is downloaded. */
#define DIR_PURPOSE_HAS_FETCHED_RENDDESC 3 #define DIR_PURPOSE_HAS_FETCHED_RENDDESC 3
/** Purpose for connection to directory server: upload a server descriptor */ /** Purpose for connection to directory server: upload a server descriptor. */
#define DIR_PURPOSE_UPLOAD_DIR 4 #define DIR_PURPOSE_UPLOAD_DIR 4
/** Purpose for connection to directory server: upload a rendezvous /** Purpose for connection to directory server: upload a rendezvous
* descriptor */ * descriptor. */
#define DIR_PURPOSE_UPLOAD_RENDDESC 5 #define DIR_PURPOSE_UPLOAD_RENDDESC 5
/** Purpose for connection at a directory server. */ /** Purpose for connection at a directory server. */
#define DIR_PURPOSE_SERVER 6 #define DIR_PURPOSE_SERVER 6
#define _DIR_PURPOSE_MAX 6 #define _DIR_PURPOSE_MAX 6