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)
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)
{
return env->key;
......@@ -1062,9 +1062,9 @@ crypto_digest_assign(crypto_digest_env_t *into,
/* DH */
/** Shared P parameter for our DH key exchanged */
/** Shared P parameter for our DH key exchanged. */
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;
/** 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)
}
/** 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) {
unsigned int val;
unsigned int cutoff;
......
......@@ -23,15 +23,15 @@
/** Information for a single logfile; only used in log.c */
typedef struct logfile_t {
struct logfile_t *next; /**< Next logfile_t in the linked list */
const char *filename; /**< Filename to open */
FILE *file; /**< Stream to receive log messages */
struct logfile_t *next; /**< Next logfile_t in the linked list. */
const char *filename; /**< Filename to open. */
FILE *file; /**< Stream to receive log messages. */
int needs_close; /**< Boolean: true if the stream gets closed on shutdown. */
int loglevel; /**< Lowest severity level to send to this stream. */
int max_loglevel; /**< Highest severity level to send to this stream. */
} 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) {
switch(severity) {
case LOG_DEBUG: return "debug";
......@@ -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;
/** Helper: Format a log message into a fixed-sized buffer. (This is
......@@ -126,7 +126,7 @@ void _log(int severity, const char *format, ...)
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, ...)
{
va_list ap;
......@@ -135,7 +135,7 @@ void _log_fn(int severity, const char *fn, const char *format, ...)
va_end(ap);
}
/** Close all open log files */
/** Close all open log files. */
void close_logs()
{
logfile_t *victim;
......@@ -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
* the logfile fails, -1 is returned and errno is set appropriately
* (by fopen)
* (by fopen).
*/
int add_file_log(int loglevel, const char *filename)
{
......
......@@ -38,18 +38,18 @@ typedef struct tor_tls_context_st {
} tor_tls_context;
/** 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 {
SSL *ssl; /**< An OpenSSL SSL object */
int socket; /**< The underlying file descriptor for this TLS connection */
SSL *ssl; /**< An OpenSSL SSL object. */
int socket; /**< The underlying file descriptor for this TLS connection. */
enum {
TOR_TLS_ST_HANDSHAKE, TOR_TLS_ST_OPEN, TOR_TLS_ST_GOTCLOSE,
TOR_TLS_ST_SENTCLOSE, TOR_TLS_ST_CLOSED
} state; /**< The current SSL state, depending on which operations have
* completed successfully. */
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,
......@@ -59,7 +59,7 @@ static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa,
unsigned int lifetime);
/** Global tls context. We keep it here because nobody else needs to
* touch it */
* touch it. */
static tor_tls_context *global_tls_context = NULL;
/** True iff tor_tls_init() has been called. */
static int tls_library_is_initialized = 0;
......
......@@ -9,9 +9,9 @@
#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_create_cells_processed = 0;
unsigned long stats_n_created_cells_processed = 0;
......
......@@ -12,9 +12,9 @@
/********* 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[] = {
"", /* 0 */
"OP listener", /* 1 */
......@@ -30,7 +30,7 @@ char *conn_type_to_string[] = {
"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] = {
{ NULL }, /* no type associated with 0 */
{ NULL }, /* op listener, obsolete */
......
......@@ -1487,7 +1487,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
* below as its root.
*/
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? */
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 */
/* $Id$ */
......@@ -11,27 +11,27 @@
**/
#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
/** The minimum number of cpuworker processes we will keep around */
/** The minimum number of cpuworker processes we will keep around. */
#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
/** How many bytes are sent from tor to the cpuworker? */
#define LEN_ONION_QUESTION (1+TAG_LEN+ONIONSKIN_CHALLENGE_LEN)
/** How many bytes are sent from the cpuworker back to tor? */
#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;
/** 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;
/** We need to spawn new cpuworkers whenever we rotate the onion keys
* 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;
int cpuworker_main(void *data);
......@@ -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) {
circuit_t *circ;
......
......@@ -29,14 +29,14 @@ extern or_options_t options; /* command-line and config-file options */
#define MAX_IDLE_DNSWORKERS 10
/** 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_PERMANENT 2
#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;
/** 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;
/** Linked list of connections waiting for a DNS answer. */
......@@ -51,13 +51,13 @@ struct pending_connection_t {
*/
struct cached_resolve {
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>. */
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_VALID 1
#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 cached_resolve *next;
};
......@@ -70,7 +70,7 @@ int dnsworker_main(void *data);
static int spawn_dnsworker(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;
/** Function to compare hashed resolves on their addresses; used to
......@@ -84,7 +84,7 @@ static int compare_cached_resolves(struct cached_resolve *a,
SPLAY_PROTOTYPE(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) {
SPLAY_INIT(&cache_root);
}
......@@ -95,7 +95,7 @@ void dns_init(void) {
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 *newest_cached_resolve = NULL;
......
......@@ -19,8 +19,8 @@ static int init_from_config(int argc, char **argv);
/* declared in connection.c */
extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
or_options_t options; /**< command-line and config-file options */
int global_read_bucket; /**< max number of bytes I can read this second */
or_options_t options; /**< Command-line and config-file options. */
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?
* (used to determine how many bytes we've read). */
......@@ -38,12 +38,12 @@ static connection_t *connection_array[MAXCONNECTIONS] =
/** Array of pollfd objects for calls to poll(). */
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 */
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_reap_children=0; /**< whether we should waitpid for exited children */
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_reap_children=0; /**< Whether we should waitpid for exited children. */
#endif /* signal stuff */
/** We set this to 1 when we've fetched a dir, to know whether to complain
......
......@@ -109,7 +109,7 @@
#include "../common/util.h"
/** Upper bound on maximum simultaneous connections; can be lowered by
* config file */
* config file. */
#define MAXCONNECTIONS 1000
#define DEFAULT_BANDWIDTH_OP (1024 * 1000)
......@@ -134,61 +134,61 @@
#define _CONN_TYPE_MIN 3
/** Type for sockets listening for OR connections. */
#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
/** Type for connections from final OR to chosen destination. */
#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
/** Type for SOCKS connections to OP */
/** Type for SOCKS connections to OP. */
#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
/** Type for HTTP connections to the directory server */
/** Type for HTTP connections to the directory server. */
#define CONN_TYPE_DIR 9
/** Type for connections to local dnsworker processes */
/** Type for connections to local dnsworker processes. */
#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_MAX 11
/** State for any listener connection */
/** State for any listener connection. */
#define LISTENER_STATE_READY 0
#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
/** 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_MAX 2
#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
/** State for a connection to a cpuworker process that's processing a
* handshake */
* handshake. */
#define CPUWORKER_STATE_BUSY_ONION 2
#define _CPUWORKER_STATE_MAX 2
#define CPUWORKER_TASK_ONION CPUWORKER_STATE_BUSY_ONION
#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
/** 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
/** State for a connection to an OR: Ready to send/receive cells. */
#define OR_CONN_STATE_OPEN 3
#define _OR_CONN_STATE_MAX 3
#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
/** 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
/** 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
/** 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_MAX 4
#if 0
......@@ -198,34 +198,34 @@
/* the AP state values must be disjoint from the EXIT state values */
#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
/** State for a SOCKS connection: got a y.onion URL; waiting to receive
* rendezvous rescriptor. */
* rendezvous rescriptor. */
#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
/** 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
/** 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_MAX 9
#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
/** 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
/** 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
/** 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
/** 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_MAX 5
#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
/** Purpose for connection to directory server: download a rendezvous
* descriptor. */
......@@ -233,22 +233,22 @@
/** Purpose for connection to directory server: set after a rendezvous
* descriptor is downloaded. */
#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
/** Purpose for connection to directory server: upload a rendezvous
* descriptor */
* descriptor. */
#define DIR_PURPOSE_UPLOAD_RENDDESC 5
/** Purpose for connection at a directory server. */
#define DIR_PURPOSE_SERVER 6
#define _DIR_PURPOSE_MAX 6
/* Circuit state: I'm the OP, still haven't done all my handshakes */
/** Circuit state: I'm the OP, still haven't done all my handshakes. */
#define CIRCUIT_STATE_BUILDING 0
/* Circuit state: Waiting to process the onionskin */
/** Circuit state: Waiting to process the onionskin. */
#define CIRCUIT_STATE_ONIONSKIN_PENDING 1
/* Circuit state: I'm the OP, my firsthop is still connecting */
/** Circuit state: I'm the OP, my firsthop is still connecting. */
#define CIRCUIT_STATE_OR_WAIT 2
/* Circuit state: onionskin(s) processed, ready to send/receive cells */
/** Circuit state: onionskin(s) processed, ready to send/receive cells. */
#define CIRCUIT_STATE_OPEN 3
#define _CIRCUIT_PURPOSE_MIN 1
......@@ -257,11 +257,11 @@
#define _CIRCUIT_PURPOSE_OR_MIN 1
/** OR-side circuit purpose: normal circuit, at OR. */
#define CIRCUIT_PURPOSE_OR 1
/** OR-side circuit purpose: At OR, from Bob, waiting for intro from Alices */
/** OR-side circuit purpose: At OR, from Bob, waiting for intro from Alices. */
#define CIRCUIT_PURPOSE_INTRO_POINT 2
/** OR-side circuit purpose: At OR, from Alice, waiting for Bob */
/** OR-side circuit purpose: At OR, from Alice, waiting for Bob. */
#define CIRCUIT_PURPOSE_REND_POINT_WAITING 3
/** OR-side circuit purpose: At OR, both circuits have this purpose */
/** OR-side circuit purpose: At OR, both circuits have this purpose. */
#define CIRCUIT_PURPOSE_REND_ESTABLISHED 4
#define _CIRCUIT_PURPOSE_OR_MAX 4
......@@ -288,30 +288,30 @@
*/
/** Client-side circuit purpose: Normal circuit, with cpath. */
#define CIRCUIT_PURPOSE_C_GENERAL 5
/** Client-side circuit purpose: at Alice, connecting to intro point */
/** Client-side circuit purpose: at Alice, connecting to intro point. */
#define CIRCUIT_PURPOSE_C_INTRODUCING 6
/** Client-side circuit purpose: at Alice, sent INTRODUCE1 to intro point, waiting for ACK/NAK */
/** Client-side circuit purpose: at Alice, sent INTRODUCE1 to intro point, waiting for ACK/NAK. */
#define CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT 7
/** Client-side circuit purpose: at Alice, introduced and acked, closing */
/** Client-side circuit purpose: at Alice, introduced and acked, closing. */
#define CIRCUIT_PURPOSE_C_INTRODUCE_ACKED 8
/** Client-side circuit purpose: at Alice, waiting for ack */
/** Client-side circuit purpose: at Alice, waiting for ack. */
#define CIRCUIT_PURPOSE_C_ESTABLISH_REND 9
/** Client-side circuit purpose: at Alice, waiting for Bob */
/** Client-side circuit purpose: at Alice, waiting for Bob. */
#define CIRCUIT_PURPOSE_C_REND_READY 10
/** Client-side circuit purpose: at Alice, waiting for Bob, INTRODUCE
* has been acknowledged. */
#define CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED 11
/** Client-side circuit purpose: at Alice, rendezvous established */
/** Client-side circuit purpose: at Alice, rendezvous established. */
#define CIRCUIT_PURPOSE_C_REND_JOINED 12
/** Hidden-service-side circuit purpose: at Bob, waiting for introductions */
/** Hidden-service-side circuit purpose: at Bob, waiting for introductions. */
#define CIRCUIT_PURPOSE_S_ESTABLISH_INTRO 13
/** Hidden-service-side circuit purpose: at Bob, successfully established
* intro */
* intro. */
#define CIRCUIT_PURPOSE_S_INTRO 14
/** Hidden-service-side circuit purpose: at Bob, connecting to rend point */
/** Hidden-service-side circuit purpose: at Bob, connecting to rend point. */
#define CIRCUIT_PURPOSE_S_CONNECT_REND 15
/** Hidden-service-side circuit purpose: at Bob, rendezvous established.*/
/** Hidden-service-side circuit purpose: at Bob, rendezvous established. */
#define CIRCUIT_PURPOSE_S_REND_JOINED 16
#define _CIRCUIT_PURPOSE_MAX 16
......@@ -408,8 +408,8 @@
typedef struct {
uint16_t circ_id; /**< Circuit which received the cell. */
unsigned char command; /**< Type of the cell: one of PADDING, CREATE, RELAY,
* or DESTROY */
unsigned char payload[CELL_PAYLOAD_SIZE]; /**< Cell body */
* or DESTROY. */
unsigned char payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
} cell_t;
/** Beginning of a RELAY cell payload. */
......@@ -426,22 +426,22 @@ typedef struct socks_request_t socks_request_t;
#define CONNECTION_MAGIC 0x7C3C304Eu
/** Description of a connection to another host or process, and associated
* data */
* data. */
struct connection_t {
uint32_t magic; /**< For memory debugging: must equal CONNECTION_MAGIC. */
uint8_t type; /**< What kind of connection is this? */
uint8_t state; /**< Current state of this connection. */
uint8_t purpose; /**< Only used for DIR types currently */
uint8_t wants_to_read; /**< Should we start reading again once
uint8_t purpose; /**< Only used for DIR types currently. */
uint8_t wants_to_read; /**< Boolean: should we start reading again once
* the bandwidth throttler allows it?
*/
uint8_t wants_to_write; /**< Should we start writing again once
uint8_t wants_to_write; /**< Boolean: should we start writing again once
* the bandwidth throttler allows reads?
*/
int s; /**< Our socket; -1 if this connection is closed. */
int poll_index; /**< Index of this conn into the poll_array */
int marked_for_close; /**< Should we close this conn on the next
int poll_index; /**< Index of this conn into the poll_array. */
int marked_for_close; /**< Boolean: should we close this conn on the next
* iteration of the main loop?
*/
char *marked_for_close_file; /**< For debugging: in which file were we marked
......@@ -450,11 +450,11 @@ struct connection_t {
* for close, do we flush it before closing it?
*/
buf_t *inbuf; /**< Buffer holding data read over this connection */
buf_t *inbuf; /**< Buffer holding data read over this connection. */
int inbuf_reached_eof; /**< Boolean: did read() return 0 on this conn? */
time_t timestamp_lastread; /**< When was the last time poll() said we could read? */
buf_t *outbuf; /**< Buffer holding data to write over this connection */
buf_t *outbuf; /**< Buffer holding data to write over this connection. */
int outbuf_flushlen; /**< How much data should we try to flush from the
* outbuf? */
time_t timestamp_lastwritten; /**< When was the last time poll() said we could write? */
......@@ -463,13 +463,13 @@ struct connection_t {
uint32_t addr; /**< IP of the other side of the connection; used to identify
* routers, along with port. */
uint16_t port; /**< If non-zero, porrt on the other end
uint16_t port; /**< If non-zero, port on the other end
* of the connection. */
char *address; /**< FQDN (or IP) of the guy on the other end.
* strdup into this, because free_connection frees it
* strdup into this, because free_connection frees it.
*/
crypto_pk_env_t *identity_pkey; /**> Public RSA key for the other side's
* signing key */
* signing key. */
char *nickname; /**< Nickname of OR on other side (if any). */
/* Used only by OR connections: */
......@@ -479,7 +479,7 @@ struct connection_t {
* range 0..1<<15-1. (OR only.)*/
/* bandwidth and receiver_bucket only used by ORs in OPEN state: */
int bandwidth; /**< cOnnection bandwidth. (OPEN ORs only.) */
int bandwidth; /**< Connection bandwidth. (OPEN ORs only.) */
int receiver_bucket; /**< When this hits 0, stop receiving. Every second we
* add 'bandwidth' to this, capping it at 10*bandwidth.
* (OPEN ORs only)
......@@ -500,10 +500,10 @@ struct connection_t {
int deliver_window; /**< How many more relay cells can end at me? (Edge
* only.) */
int done_sending; /**< For half-open connections; not used currently */
int done_receiving; /**< For half-open connections; not used currently */
int done_sending; /**< For half-open connections; not used currently. */
int done_receiving; /**< For half-open connections; not used currently. */
char has_sent_end; /**< For debugging: set once we've set the stream end,
and check in circuit_about_to_close_connection() */
and check in circuit_about_to_close_connection(). */
char num_retries; /**< How many times have we re-tried beginning this stream? (Edge only) */
/* Used only by AP connections */
......@@ -518,13 +518,13 @@ typedef struct connection_t connection_t;
/** A linked list of exit policy rules */
struct exit_policy_t {
char policy_type; /**< One of EXIT_POLICY_ACCEPT or EXIT_POLICY_REJECT */
char *string; /**< String representation of this rule */
uint32_t addr; /**< Base address to accept or reject */
uint32_t msk; /**< Accept/reject all addresses <b>a</b> such that a & msk ==
char policy_type; /**< One of EXIT_POLICY_ACCEPT or EXIT_POLICY_REJECT. */
char *string; /**< String representation of this rule. */
uint32_t addr; /**< Base address to accept or reject. */
uint32_t msk; /**< Accept/reject all addresses <b>a</b> such that a & msk ==
* <b>addr</b> & msk . */
uint16_t prt_min; /**< Lowest port number to accept/reject */
uint16_t prt_max; /**< Highest port number to accept/reject */
uint16_t prt_min; /**< Lowest port number to accept/reject. */
uint16_t prt_max; /**< Highest port number to accept/reject. */
struct exit_policy_t *next; /**< Next rule in list. */
};
......@@ -535,15 +535,15 @@ typedef struct {
char *nickname; /**< Human-readable OR name. */
uint32_t addr; /**< IPv4 address of OR, in host order. */
uint16_t or_port; /**< Port for OR-to-OR and OP-to-OR connections */
uint16_t socks_port; /**< Port for SOCKS connections */
uint16_t dir_port; /**< Port for HTTP directory connections */
uint16_t or_port; /**< Port for OR-to-OR and OP-to-OR connections. */
uint16_t socks_port; /**< Port for SOCKS connections. */
uint16_t dir_port; /**< Port for HTTP directory connections. */
time_t published_on; /**< When was the information in this routerinfo_t
* published? */
crypto_pk_env_t *onion_pkey; /**< public RSA key for onions */
crypto_pk_env_t *identity_pkey; /**< public RSA key for signing */
crypto_pk_env_t *onion_pkey; /**< Public RSA key for onions. */
crypto_pk_env_t *identity_pkey; /**< Public RSA key for signing. */
int is_running; /**< As far as we know, is this OR currently running? */
......@@ -609,7 +609,7 @@ struct crypt_path_t {
* (The list is circular, so the last node
* links to the first.) */
struct crypt_path_t *prev; /**< Link to previous crypt_path_t in the