summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-03-12 23:31:16 +0000
committerNick Mathewson <nickm@torproject.org>2006-03-12 23:31:16 +0000
commitbd8ffccae7e1bb4030f9ca5e6dd9c8918256de75 (patch)
tree26820b373ebcbe66894a347d59b0136eb9265bbf /src
parent474c60b7433da2302c35832571f41867714d8f65 (diff)
downloadtor-bd8ffccae7e1bb4030f9ca5e6dd9c8918256de75.tar.gz
tor-bd8ffccae7e1bb4030f9ca5e6dd9c8918256de75.zip
More cleanups noticed by weasel; also, remove macros that nobody uses.
svn:r6143
Diffstat (limited to 'src')
-rw-r--r--src/common/aes.c2
-rw-r--r--src/common/crypto.c14
-rw-r--r--src/or/buffers.c3
-rw-r--r--src/or/config.c8
-rw-r--r--src/or/connection.c6
-rw-r--r--src/or/connection_or.c1
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/main.c2
-rw-r--r--src/or/or.h8
-rw-r--r--src/or/rendcommon.c2
-rw-r--r--src/or/rendservice.c6
-rw-r--r--src/or/routerlist.c4
12 files changed, 13 insertions, 45 deletions
diff --git a/src/common/aes.c b/src/common/aes.c
index a0c759dc46..088d29a18e 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -48,8 +48,6 @@ typedef uint32_t u32;
typedef uint8_t u8;
#ifndef USE_OPENSSL_AES
-#define MAXKC (256/32)
-#define MAXKB (256/8)
#define MAXNR 14
static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/],
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 1be1bc1a2f..789c1fb6b7 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -63,28 +63,14 @@ const char crypto_c_id[] =
#if OPENSSL_VERSION_NUMBER < 0x00905000l
#error "We require openssl >= 0.9.5"
-#elif OPENSSL_VERSION_NUMBER < 0x00906000l
-#define OPENSSL_095
#endif
#if OPENSSL_VERSION_NUMBER < 0x00907000l
-#define OPENSSL_PRE_097
#define NO_ENGINES
#else
#include <openssl/engine.h>
#endif
-/* Certain functions that return a success code in OpenSSL 0.9.6 return void
- * (and don't indicate errors) in OpenSSL version 0.9.5.
- *
- * [OpenSSL 0.9.5 matters, because it ships with Redhat 6.2.]
- */
-#ifdef OPENSSL_095
-#define RETURN_SSL_OUTCOME(exp) (exp); return 0
-#else
-#define RETURN_SSL_OUTCOME(exp) return !(exp)
-#endif
-
/** Macro: is k a valid RSA public or private key? */
#define PUBLIC_KEY_OK(k) ((k) && (k)->key && (k)->key->n)
/** Macro: is k a valid RSA private key? */
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 0e1f38fb9d..69dc0ad7c9 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -69,7 +69,6 @@ uint64_t buf_total_alloc = 0;
/** Size, in bytes, for minimum 'shrink' size for buffers. Buffers may start
* out smaller than this, but they will never autoshrink to less
* than this size. */
-#define MIN_GREEDY_SHRINK_SIZE (16*1024)
#define MIN_LAZY_SHRINK_SIZE (4*1024)
static INLINE void peek_from_buf(char *string, size_t string_len, buf_t *buf);
@@ -1156,8 +1155,6 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
}
}
-#define CONTROL_CMD_FRAGMENTHEADER 0x0010
-#define CONTROL_CMD_FRAGMENT 0x0011
/** If there is a complete version 0 control message waiting on buf, then store
* its contents into *<b>type_out</b>, store its body's length into
* *<b>len_out</b>, allocate and store a string for its body into
diff --git a/src/or/config.c b/src/or/config.c
index e6c3265213..ad6289b562 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -336,9 +336,6 @@ typedef struct {
*(uint32_t*)STRUCT_VAR_P(cfg,fmt->magic_offset)); \
} while (0)
-/** Largest allowed config line */
-#define CONFIG_LINE_T_MAXLEN 4096
-
static void config_line_append(config_line_t **lst,
const char *key, const char *val);
static void option_clear(config_format_t *fmt, or_options_t *options,
@@ -4140,6 +4137,9 @@ config_getinfo_helper(const char *question, char **answer)
return 0;
}
+#include "../common/ht.h"
+#include "../common/test.h"
+
/** Dump the version of every file to the log. */
static void
print_cvs_version(void)
@@ -4184,6 +4184,8 @@ print_cvs_version(void)
puts(COMPAT_H_ID);
puts(CONTAINER_H_ID);
puts(CRYPTO_H_ID);
+ puts(HT_H_ID);
+ puts(TEST_H_ID);
puts(LOG_H_ID);
puts(TORGZIP_H_ID);
puts(TORINT_H_ID);
diff --git a/src/or/connection.c b/src/or/connection.c
index 1806f6afa1..f9e93a75e4 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2113,6 +2113,8 @@ assert_connection_ok(connection_t *conn, time_t now)
case CONN_TYPE_EXIT:
tor_assert(conn->state >= _EXIT_CONN_STATE_MIN);
tor_assert(conn->state <= _EXIT_CONN_STATE_MAX);
+ tor_assert(conn->purpose >= _EXIT_PURPOSE_MIN);
+ tor_assert(conn->purpose <= _EXIT_PURPOSE_MAX);
break;
case CONN_TYPE_AP:
tor_assert(conn->state >= _AP_CONN_STATE_MIN);
@@ -2126,8 +2128,8 @@ assert_connection_ok(connection_t *conn, time_t now)
tor_assert(conn->purpose <= _DIR_PURPOSE_MAX);
break;
case CONN_TYPE_DNSWORKER:
- tor_assert(conn->state == DNSWORKER_STATE_IDLE ||
- conn->state == DNSWORKER_STATE_BUSY);
+ tor_assert(conn->state >= _DNSWORKER_STATE_MIN);
+ tor_assert(conn->state <= _DNSWORKER_STATE_MAX);
break;
case CONN_TYPE_CPUWORKER:
tor_assert(conn->state >= _CPUWORKER_STATE_MIN);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index ee4d3915e5..2710329399 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -16,6 +16,7 @@ const char connection_or_c_id[] =
/** How much clock skew do we tolerate when checking certificates for
* known routers? (sec) */
+
#define TIGHT_CERT_ALLOW_SKEW (90*60)
static int connection_tls_finish_handshake(connection_t *conn);
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 860025a55c..1e57c93316 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -23,8 +23,6 @@ const char cpuworker_c_id[] =
/** 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+CPATH_KEY_MATERIAL_LEN)
diff --git a/src/or/main.c b/src/or/main.c
index 5cc4331503..775e0798ba 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -96,7 +96,7 @@ static char* nt_strerror(uint32_t errnum);
* that would require an upload? */
#define CHECK_DESCRIPTOR_INTERVAL (60)
/** How often do we (as a router) check whether our IP address has changed? */
-#define CHECK_IPADDRESS_INTERVAL (15*60) /* 15 minutes */
+#define CHECK_IPADDRESS_INTERVAL (15*60)
/** How often do we check buffers for empty space that can be deallocated? */
#define BUF_SHRINK_INTERVAL (60)
/** How often do we check for router descriptors that we should download? */
diff --git a/src/or/or.h b/src/or/or.h
index e436e064f7..49c47caa30 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -534,10 +534,6 @@ typedef enum {
/** How long to test reachability before complaining to the user. */
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60)
-/* people behind fascist firewalls use only these ports */
-#define REQUIRED_FIREWALL_DIRPORT 80
-#define REQUIRED_FIREWALL_ORPORT 443
-
/* legal characters in a nickname */
#define LEGAL_NICKNAME_CHARACTERS \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@@ -1689,10 +1685,6 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state,
const char *rendquery);
#define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
-#define connection_has_pending_tls_data(conn) \
- ((conn)->type == CONN_TYPE_OR && \
- (conn)->state == OR_CONN_STATE_OPEN && \
- tor_tls_get_pending_bytes((conn)->tls))
int connection_is_listener(connection_t *conn);
int connection_state_is_open(connection_t *conn);
int connection_state_is_connecting(connection_t *conn);
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 0b66bc7a3c..ef9cfddc95 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -233,7 +233,7 @@ rend_get_service_id(crypto_pk_env_t *pk, char *out)
/** How old do we let hidden service descriptors get discarding them as too
* old? */
-#define REND_CACHE_MAX_AGE (48*60*60)
+#define REND_CACHE_MAX_AGE (2*24*60*60)
/** How wrong to we assume our clock may be when checking whether hidden
* services are too old or too new? */
#define REND_CACHE_MAX_SKEW (24*60*60)
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 9a63e8cb22..5292e5e9c5 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -27,7 +27,7 @@ typedef struct rend_service_port_config_t {
#define NUM_INTRO_POINTS 3
/** If we can't build our intro circuits, don't retry for this long. */
-#define INTRO_CIRC_RETRY_PERIOD 60*5
+#define INTRO_CIRC_RETRY_PERIOD (60*5)
/** Don't try to build more than this many circuits before giving up
* for a while.*/
#define MAX_INTRO_CIRCS_PER_PERIOD 10
@@ -927,10 +927,6 @@ upload_service_descriptor(rend_service_t *service, int version)
service->desc_is_dirty = 0;
}
-/* XXXX Make this longer once directories remember service descriptors across
- * restarts.*/
-#define MAX_SERVICE_PUBLICATION_INTERVAL (15*60)
-
/** For every service, check how many intro points it currently has, and:
* - Pick new intro points as necessary.
* - Launch circuits to any new intro points.
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 0ead642f59..608b585787 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3437,10 +3437,6 @@ update_router_descriptor_client_downloads(time_t now)
/** When directory clients have only a few servers to request, they batch
* them until they have more, or until this amount of time has passed. */
#define MAX_CLIENT_INTERVAL_WITHOUT_REQUEST (10*60)
- /** When directory caches and authorities have only a few servers to
- * request, they batch them until they have more, or until this amount of
- * time has passed. */
-#define MAX_SERVER_INTERVAL_WITHOUT_REQUEST (60)
smartlist_t *downloadable = NULL;
int should_delay, n_downloadable;
or_options_t *options = get_options();