[or-cvs] more cleanup, including fleshing out or.h more
Roger Dingledine
arma at seul.org
Mon May 10 07:37:13 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
config.c connection.c dns.c or.h
Log Message:
more cleanup, including fleshing out or.h more
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- config.c 10 May 2004 04:48:13 -0000 1.111
+++ config.c 10 May 2004 07:37:10 -0000 1.112
@@ -92,7 +92,7 @@
return newline;
}
-/** Herlper: parse the config file and strdup into key/value
+/** Helper: parse the config file and strdup into key/value
* strings. Return list, or NULL if parsing the file failed. Warn and
* ignore any misformatted lines. */
static struct config_line_t *config_get_lines(FILE *f) {
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- connection.c 10 May 2004 04:34:48 -0000 1.216
+++ connection.c 10 May 2004 07:37:10 -0000 1.217
@@ -4,7 +4,8 @@
/**
* \file connection.c
- * \brief foo
+ * \brief General high-level functions to handle reading and writing
+ * on connections.
**/
#include "or.h"
Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- dns.c 10 May 2004 04:34:48 -0000 1.88
+++ dns.c 10 May 2004 07:37:10 -0000 1.89
@@ -15,7 +15,7 @@
#include "or.h"
#include "tree.h"
-extern or_options_t options; /**< command-line and config-file options */
+extern or_options_t options; /* command-line and config-file options */
/** Longest hostname we're willing to resolve. */
#define MAX_ADDRESSLEN 256
@@ -52,12 +52,12 @@
struct cached_resolve {
SPLAY_ENTRY(cached_resolve) node;
char address[MAX_ADDRESSLEN]; /**< the hostname to be resolved */
- uint32_t addr; /**< in host order. I know I'm horrible for assuming ipv4 */
+ uint32_t addr; /**< IPv4 addr for <b>address</b>. */
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;
};
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.335
retrieving revision 1.336
diff -u -d -r1.335 -r1.336
--- or.h 10 May 2004 06:52:01 -0000 1.335
+++ or.h 10 May 2004 07:37:10 -0000 1.336
@@ -108,7 +108,7 @@
#include "../common/log.h"
#include "../common/util.h"
-/** Upper bound on maximum simulataneous connections; can be lowered by
+/** Upper bound on maximum simultaneous connections; can be lowered by
* config file */
#define MAXCONNECTIONS 1000
@@ -140,7 +140,7 @@
#define CONN_TYPE_EXIT 5
/** 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 */
#define CONN_TYPE_DIR_LISTENER 8
@@ -640,41 +640,78 @@
#define CIRCUIT_MAGIC 0x35315243u
-/** struct for a path (circuit) through the onion routing network */
+/** Struct for a path (circuit) through the onion routing network */
struct circuit_t {
- uint32_t magic; /**< for memory debugging: must equal CRICUIT_MAGIC */
+ uint32_t magic; /**< For memory debugging: must equal CIRCUIT_MAGIC */
int marked_for_close; /**< Should we close this circuit at the end of the
* main loop? */
char *marked_for_close_file; /**< For debugging: in which file was this
* circuit marked for close? */
- /* XXXX ARMA : please document these: I can't untangle them so well. */
-
+ /** The IPv4 address of the OR that is next in this circuit. */
uint32_t n_addr;
+ /** The port for the OR that is next in this circuit. */
uint16_t n_port;
+ /** The OR connection that is previous in this circuit. */
connection_t *p_conn;
- connection_t *n_conn; /* for the OR conn, if there is one */
+ /** The OR connection that is next in this circuit. */
+ connection_t *n_conn;
+ /** Linked list of AP streams associated with this circuit. */
connection_t *p_streams;
+ /** Linked list of Exit streams associated with this circuit. */
connection_t *n_streams;
+ /** Linked list of Exit streams associated with this circuit that are
+ * still being resolved. */
connection_t *resolving_streams;
+ /** The next stream_id that will be tried when we're attempting to
+ * construct a new AP stream originating at this circuit. */
uint16_t next_stream_id;
+ /** How many relay data cells can we package (read from edge streams)
+ * on this circuit before we receive a circuit-level sendme cell asking
+ * for more? */
int package_window;
+ /** How many relay data cells will we deliver (write to edge streams)
+ * on this circuit? When deliver_window gets low, we send some
+ * circuit-level sendme cells to indicate that we're willing to accept
+ * more. */
int deliver_window;
- uint16_t p_circ_id; /* circuit identifiers */
+ /** The circuit_id used in the previous (backward) hop of this circuit. */
+ uint16_t p_circ_id;
+ /** The circuit_id used in the next (forward) hop of this circuit. */
uint16_t n_circ_id;
- crypto_cipher_env_t *p_crypto; /* used only for intermediate hops */
+ /** The cipher used by intermediate hops for cells heading toward the
+ * OP */
+ crypto_cipher_env_t *p_crypto;
+ /** The cipher used by intermediate hops for cells heading away from
+ * the OP */
crypto_cipher_env_t *n_crypto;
- crypto_digest_env_t *p_digest; /* for integrity checking, */
- crypto_digest_env_t *n_digest; /* intermediate hops only */
+ /** The integrity-checking digest used by intermediate hops, for
+ * cells packaged here and heading towards the OP.
+ */
+ crypto_digest_env_t *p_digest;
+ /** The integrity-checking digest used by intermediate hops, for
+ * cells packaged at the OP and arriving here.
+ */
+ crypto_digest_env_t *n_digest;
+ /** Build state for this circuit. It includes the intended path
+ * length, the chosen exit router, rendezvous information, etc.
+ */
cpath_build_state_t *build_state;
+ /** The doubly-linked list of crypt_path_t entries, one per hop,
+ * for this circuit. This includes ciphers for each hop,
+ * integrity-checking digests for each hop, and package/delivery
+ * windows for each hop.
+ *
+ * The cpath field is defined only when we are the circuit's origin.
+ */
crypt_path_t *cpath;
- char onionskin[ONIONSKIN_CHALLENGE_LEN]; /**< for storage while onionskin
+ char onionskin[ONIONSKIN_CHALLENGE_LEN]; /**< For storage while onionskin
* pending */
char handshake_digest[DIGEST_LEN]; /**< Stores KH for intermediate hops */
@@ -686,14 +723,14 @@
uint8_t purpose; /**< Why are we creating this circuit? */
/**
- * rend_query holds y portion of y.onion (nul-terminated) if purpose
- * is C_INTRODUCING or C_ESTABLISH_REND, or is a C_GENERAL for a
- * hidden service, or is S_*.
+ * The rend_query field holds y portion of y.onion (nul-terminated)
+ * if purpose is C_INTRODUCING or C_ESTABLISH_REND, or is a C_GENERAL
+ * for a hidden service, or is S_*.
*/
char rend_query[REND_SERVICE_ID_LEN+1];
- /** rend_pk_digest holds a hash of location-hidden service's PK if
- * purpose is INTRO_POINT or S_ESTABLISH_INTRO or S_RENDEZVOUSING
+ /** The rend_pk_digest field holds a hash of location-hidden service's
+ * PK if purpose is INTRO_POINT or S_ESTABLISH_INTRO or S_RENDEZVOUSING
*/
char rend_pk_digest[DIGEST_LEN];
@@ -786,10 +823,15 @@
struct socks_request_t {
char socks_version; /**< Which version of SOCKS did the client use? */
int replylen; /**< Length of <b>reply</b> */
- char reply[MAX_SOCKS_REPLY_LEN]; /* XXXX ARMA */
+ char reply[MAX_SOCKS_REPLY_LEN]; /**< Write an entry into this string if
+ * we want to specify our own socks reply,
+ * rather than using the default socks4 or
+ * socks5 socks reply. We use this for the
+ * two-stage socks5 handshake.
+ */
int has_finished; /**< Has the SOCKS handshake finished? */
- char address[MAX_SOCKS_ADDR_LEN]; /* XXXX ARMA */
- uint16_t port; /* XXXX ARMA */
+ char address[MAX_SOCKS_ADDR_LEN]; /**< What address did the client ask to connect to? */
+ uint16_t port; /**< What port did the client ask to connect to? */
};
/* all the function prototypes go here */
@@ -823,7 +865,6 @@
/********************************* circuit.c ***************************/
extern char *circuit_state_to_string[];
-void circuit_remove(circuit_t *circ);
circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn);
void circuit_close_all_marked(void);
void circuit_free(circuit_t *circ);
More information about the tor-commits
mailing list