[or-cvs] rename circ_id_t to uint16_t for code clarity
Roger Dingledine
arma at seul.org
Fri Dec 19 19:55:04 UTC 2003
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuit.c connection.c cpuworker.c or.h routerlist.c
Log Message:
rename circ_id_t to uint16_t for code clarity
change message when using non-recommended tor version
Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- circuit.c 19 Dec 2003 05:09:51 -0000 1.125
+++ circuit.c 19 Dec 2003 19:55:02 -0000 1.126
@@ -10,7 +10,7 @@
crypt_path_t **layer_hint, char *recognized);
static connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction);
static void circuit_free_cpath_node(crypt_path_t *victim);
-static circ_id_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type);
+static uint16_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type);
unsigned long stats_n_relay_cells_relayed = 0;
unsigned long stats_n_relay_cells_delivered = 0;
@@ -56,7 +56,7 @@
}
}
-circuit_t *circuit_new(circ_id_t p_circ_id, connection_t *p_conn) {
+circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) {
circuit_t *circ;
circ = tor_malloc_zero(sizeof(circuit_t));
@@ -129,8 +129,8 @@
}
/* return 0 if can't get a unique circ_id. */
-static circ_id_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type) {
- circ_id_t test_circ_id;
+static uint16_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type) {
+ uint16_t test_circ_id;
int attempts=0;
uint16_t high_bit;
@@ -156,7 +156,7 @@
return test_circ_id;
}
-circuit_t *circuit_get_by_circ_id_conn(circ_id_t circ_id, connection_t *conn) {
+circuit_t *circuit_get_by_circ_id_conn(uint16_t circ_id, connection_t *conn) {
circuit_t *circ;
connection_t *tmpconn;
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- connection.c 19 Dec 2003 05:09:51 -0000 1.143
+++ connection.c 19 Dec 2003 19:55:02 -0000 1.144
@@ -647,7 +647,7 @@
return 0;
}
-int connection_send_destroy(circ_id_t circ_id, connection_t *conn) {
+int connection_send_destroy(uint16_t circ_id, connection_t *conn) {
cell_t cell;
assert(conn);
Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cpuworker.c 17 Dec 2003 05:58:30 -0000 1.18
+++ cpuworker.c 19 Dec 2003 19:55:02 -0000 1.19
@@ -30,18 +30,18 @@
return 0;
}
-static void tag_pack(char *tag, uint32_t addr, uint16_t port, circ_id_t circ_id) {
- *(uint32_t *)tag = addr;
+static void tag_pack(char *tag, uint32_t addr, uint16_t port, uint16_t circ_id) {
+ *(uint32_t *)tag = addr;
*(uint16_t *)(tag+4) = port;
- *(circ_id_t *)(tag+6) = circ_id;
+ *(uint16_t *)(tag+6) = circ_id;
}
-static void tag_unpack(char *tag, uint32_t *addr, uint16_t *port, circ_id_t *circ_id) {
+static void tag_unpack(char *tag, uint32_t *addr, uint16_t *port, uint16_t *circ_id) {
struct in_addr in;
- *addr = *(uint32_t *)tag;
- *port = *(uint16_t *)(tag+4);
- *circ_id = *(circ_id_t *)(tag+6);
+ *addr = *(uint32_t *)tag;
+ *port = *(uint16_t *)(tag+4);
+ *circ_id = *(uint16_t *)(tag+6);
in.s_addr = htonl(*addr);
log_fn(LOG_DEBUG,"onion was from %s:%d, circ_id %d.", inet_ntoa(in), *port, *circ_id);
@@ -51,7 +51,7 @@
unsigned char buf[LEN_ONION_RESPONSE];
uint32_t addr;
uint16_t port;
- circ_id_t circ_id;
+ uint16_t circ_id;
connection_t *p_conn;
circuit_t *circ;
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- or.h 19 Dec 2003 05:09:51 -0000 1.212
+++ or.h 19 Dec 2003 19:55:02 -0000 1.213
@@ -230,8 +230,6 @@
#define SOCKS4_NETWORK_LEN 8
-typedef uint16_t circ_id_t;
-
/*
* Relay payload:
* Relay command [1 byte]
@@ -276,7 +274,7 @@
/* cell definition */
typedef struct {
- circ_id_t circ_id;
+ uint16_t circ_id;
unsigned char command;
unsigned char payload[CELL_PAYLOAD_SIZE];
} cell_t;
@@ -331,8 +329,8 @@
/* Used only by OR connections: */
tor_tls *tls;
- circ_id_t next_circ_id; /* Which circ_id do we try to use next on this connection?
- * This is always in the range 0..1<<15-1.*/
+ uint16_t next_circ_id; /* Which circ_id do we try to use next on this connection?
+ * This is always in the range 0..1<<15-1.*/
/* bandwidth and receiver_bucket only used by ORs in OPEN state: */
uint32_t bandwidth; /* connection bandwidth. */
@@ -450,8 +448,8 @@
int package_window;
int deliver_window;
- circ_id_t p_circ_id; /* circuit identifiers */
- circ_id_t n_circ_id;
+ uint16_t p_circ_id; /* circuit identifiers */
+ uint16_t n_circ_id;
crypto_cipher_env_t *p_crypto; /* used only for intermediate hops */
crypto_cipher_env_t *n_crypto;
@@ -554,11 +552,11 @@
void circuit_add(circuit_t *circ);
void circuit_remove(circuit_t *circ);
-circuit_t *circuit_new(circ_id_t p_circ_id, connection_t *p_conn);
+circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn);
void circuit_free(circuit_t *circ);
void circuit_free_cpath(crypt_path_t *cpath);
-circuit_t *circuit_get_by_circ_id_conn(circ_id_t circ_id, connection_t *conn);
+circuit_t *circuit_get_by_circ_id_conn(uint16_t circ_id, connection_t *conn);
circuit_t *circuit_get_by_conn(connection_t *conn);
circuit_t *circuit_get_newest(connection_t *conn, int must_be_open);
@@ -650,7 +648,7 @@
int connection_is_listener(connection_t *conn);
int connection_state_is_open(connection_t *conn);
-int connection_send_destroy(circ_id_t circ_id, connection_t *conn);
+int connection_send_destroy(uint16_t circ_id, connection_t *conn);
int connection_process_inbuf(connection_t *conn);
int connection_finished_flushing(connection_t *conn);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- routerlist.c 17 Dec 2003 21:09:31 -0000 1.12
+++ routerlist.c 19 Dec 2003 19:55:02 -0000 1.13
@@ -333,9 +333,10 @@
}
if (compare_recommended_versions(VERSION, routerlist->software_versions) < 0) {
log(options.IgnoreVersion ? LOG_WARN : LOG_ERR,
- "You are running Tor version %s, which is not recommended.\n"
- "Please upgrade to one of %s.",
- VERSION, routerlist->software_versions);
+ "You are running Tor version %s, which will not work with this network.\n"
+ "Please use %s%s.",
+ VERSION, strchr(routerlist->software_versions,',') ? "one of " : "",
+ routerlist->software_versions);
if(options.IgnoreVersion) {
log(LOG_WARN, "IgnoreVersion is set. If it breaks, we told you so.");
} else {
More information about the tor-commits
mailing list