aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-01-16 22:32:12 -0500
committerNick Mathewson <nickm@torproject.org>2013-01-16 22:32:12 -0500
commitb998431a33db2be0246f176ea0077b98d5258866 (patch)
treed03935b5fbc9e8f6327af93b2897fc1f34d931fe /src/or
parent8b62a738b3add64dcd26a82dff44a7e9e11ff5a9 (diff)
parentb7cf7bd9ae31aeddd03ad2094dd480d2b1d34d4f (diff)
downloadtor-b998431a33db2be0246f176ea0077b98d5258866.tar.gz
tor-b998431a33db2be0246f176ea0077b98d5258866.zip
Merge branch '024_msvc_squashed'
Conflicts: src/or/or.h srcwin32/orconfig.h
Diffstat (limited to 'src/or')
-rw-r--r--src/or/Makefile.nmake74
-rw-r--r--src/or/addressmap.c2
-rw-r--r--src/or/channel.h2
-rw-r--r--src/or/or.h29
-rw-r--r--src/or/routerparse.c2
5 files changed, 77 insertions, 32 deletions
diff --git a/src/or/Makefile.nmake b/src/or/Makefile.nmake
index 677618e74f..bf67769b52 100644
--- a/src/or/Makefile.nmake
+++ b/src/or/Makefile.nmake
@@ -1,28 +1,70 @@
all: tor.exe
-CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \
+ /I ..\ext
-LIBS = ..\..\..\build-alpha\lib\libevent.a \
- ..\..\..\build-alpha\lib\libcrypto.a \
- ..\..\..\build-alpha\lib\libssl.a \
- ..\..\..\build-alpha\lib\libz.a \
+LIBS = ..\..\..\build-alpha\lib\libevent.lib \
+ ..\..\..\build-alpha\lib\libcrypto.lib \
+ ..\..\..\build-alpha\lib\libssl.lib \
+ ..\..\..\build-alpha\lib\libz.lib \
ws2_32.lib advapi32.lib shell32.lib
-LIBTOR_OBJECTS = buffers.obj channel.obj channeltls.obj circuitbuild.obj \
- circuitlist.obj circuitmux.obj circuitmux_ewma.obj circuituse.obj \
- command.obj config.obj connection.obj connection_edge.obj \
- connection_or.obj control.obj cpuworker.obj directory.obj \
- dirserv.obj dirvote.obj dns.obj dnsserv.obj geoip.obj hibernate.obj \
- main.obj microdesc.obj networkstatus.obj nodelist.obj onion.obj \
- policies.obj reasons.obj relay.obj rendclient.obj rendcommon.obj \
- rendmid.obj rendservice.obj rephist.obj router.obj routerlist.obj \
- routerparse.obj status.obj config_codedigest.obj ntmain.obj
+LIBTOR_OBJECTS = \
+ addressmap.obj \
+ buffers.obj \
+ channel.obj \
+ channeltls.obj \
+ circuitbuild.obj \
+ circuitlist.obj \
+ circuitmux.obj \
+ circuitmux_ewma.obj \
+ circuitstats.obj \
+ circuituse.obj \
+ command.obj \
+ config.obj \
+ config_codedigest.obj \
+ confparse.obj \
+ connection.obj \
+ connection_edge.obj \
+ connection_or.obj \
+ control.obj \
+ cpuworker.obj \
+ directory.obj \
+ dirserv.obj \
+ dirvote.obj \
+ dns.obj \
+ dnsserv.obj \
+ entrynodes.obj \
+ geoip.obj \
+ hibernate.obj \
+ main.obj \
+ microdesc.obj \
+ networkstatus.obj \
+ nodelist.obj \
+ ntmain.obj \
+ onion.obj \
+ policies.obj \
+ reasons.obj \
+ relay.obj \
+ rendclient.obj \
+ rendcommon.obj \
+ rendmid.obj \
+ rendservice.obj \
+ rephist.obj \
+ replaycache.obj \
+ router.obj \
+ routerlist.obj \
+ routerparse.obj \
+ routerset.obj \
+ statefile.obj \
+ status.obj \
+ transports.obj
libtor.lib: $(LIBTOR_OBJECTS)
- lib $(LIBTOR_OBJECTS) /out:libtor.lib
+ lib $(LIBTOR_OBJECTS) /out:$@
tor.exe: libtor.lib tor_main.obj
- $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj
+ $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj /Fe$@
clean:
del $(LIBTOR_OBJECTS) *.lib tor.exe
diff --git a/src/or/addressmap.c b/src/or/addressmap.c
index 5166317264..826eb301db 100644
--- a/src/or/addressmap.c
+++ b/src/or/addressmap.c
@@ -45,7 +45,7 @@
typedef struct {
char *new_address;
time_t expires;
- addressmap_entry_source_t source:3;
+ ENUM_BF(addressmap_entry_source_t) source:3;
unsigned src_wildcard:1;
unsigned dst_wildcard:1;
short num_resolve_failures;
diff --git a/src/or/channel.h b/src/or/channel.h
index 2ca7cf9d18..31bd519474 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -142,7 +142,7 @@ struct channel_s {
* When we send CREATE cells along this connection, which half of the
* space should we use?
*/
- circ_id_type_t circ_id_type:2;
+ ENUM_BF(circ_id_type_t) circ_id_type:2;
/*
* Which circ_id do we try to use next on this connection? This is
* always in the range 0..1<<15-1.
diff --git a/src/or/or.h b/src/or/or.h
index eaa6010dc2..a6f3d3e88a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -81,7 +81,6 @@
#include <process.h>
#include <direct.h>
#include <windows.h>
-#define snprintf _snprintf
#endif
#ifdef USE_BUFFEREVENTS
@@ -1592,6 +1591,13 @@ typedef struct entry_connection_t {
} entry_connection_t;
+typedef enum {
+ DIR_SPOOL_NONE=0, DIR_SPOOL_SERVER_BY_DIGEST, DIR_SPOOL_SERVER_BY_FP,
+ DIR_SPOOL_EXTRA_BY_DIGEST, DIR_SPOOL_EXTRA_BY_FP,
+ DIR_SPOOL_CACHED_DIR, DIR_SPOOL_NETWORKSTATUS,
+ DIR_SPOOL_MICRODESC, /* NOTE: if we add another entry, add another bit. */
+} dir_spool_source_t;
+
/** Subtype of connection_t for an "directory connection" -- that is, an HTTP
* connection to retrieve or serve directory material. */
typedef struct dir_connection_t {
@@ -1610,12 +1616,8 @@ typedef struct dir_connection_t {
* "spooling" of directory material to the outbuf. Otherwise, we'd have
* to append everything to the outbuf in one enormous chunk. */
/** What exactly are we spooling right now? */
- enum {
- DIR_SPOOL_NONE=0, DIR_SPOOL_SERVER_BY_DIGEST, DIR_SPOOL_SERVER_BY_FP,
- DIR_SPOOL_EXTRA_BY_DIGEST, DIR_SPOOL_EXTRA_BY_FP,
- DIR_SPOOL_CACHED_DIR, DIR_SPOOL_NETWORKSTATUS,
- DIR_SPOOL_MICRODESC, /* NOTE: if we add another entry, add another bit. */
- } dir_spool_src : 3;
+ ENUM_BF(dir_spool_source_t) dir_spool_src : 3;
+
/** If we're fetching descriptors, what router purpose shall we assign
* to them? */
uint8_t router_purpose;
@@ -1791,7 +1793,8 @@ typedef enum {
/** A reference-counted address policy rule. */
typedef struct addr_policy_t {
int refcnt; /**< Reference count */
- addr_policy_action_t policy_type:2;/**< What to do when the policy matches.*/
+ /** What to do when the policy matches.*/
+ ENUM_BF(addr_policy_action_t) policy_type:2;
unsigned int is_private:1; /**< True iff this is the pseudo-address,
* "private". */
unsigned int is_canonical:1; /**< True iff this policy is the canonical
@@ -1859,7 +1862,7 @@ typedef struct download_status_t {
* again? */
uint8_t n_download_failures; /**< Number of failures trying to download the
* most recent descriptor. */
- download_schedule_t schedule : 8;
+ ENUM_BF(download_schedule_t) schedule : 8;
} download_status_t;
/** If n_download_failures is this high, the download can never happen. */
@@ -2128,7 +2131,7 @@ typedef struct microdesc_t {
*/
time_t last_listed;
/** Where is this microdescriptor currently stored? */
- saved_location_t saved_location : 3;
+ ENUM_BF(saved_location_t) saved_location : 3;
/** If true, do not attempt to cache this microdescriptor on disk. */
unsigned int no_save : 1;
/** If true, this microdesc has an entry in the microdesc_map */
@@ -2378,8 +2381,8 @@ typedef enum {
/** A common structure to hold a v3 network status vote, or a v3 network
* status consensus. */
typedef struct networkstatus_t {
- networkstatus_type_t type : 8; /**< Vote, consensus, or opinion? */
- consensus_flavor_t flavor : 8; /**< If a consensus, what kind? */
+ ENUM_BF(networkstatus_type_t) type : 8; /**< Vote, consensus, or opinion? */
+ ENUM_BF(consensus_flavor_t) flavor : 8; /**< If a consensus, what kind? */
time_t published; /**< Vote only: Time when vote was written. */
time_t valid_after; /**< Time after which this vote or consensus applies. */
time_t fresh_until; /**< Time before which this is the most recent vote or
@@ -2887,7 +2890,7 @@ typedef struct origin_circuit_t {
/** Kludge to help us prevent the warn in bug #6475 and eventually
* debug why we are not seeing first hops in some cases. */
- path_state_t path_state : 3;
+ ENUM_BF(path_state_t) path_state : 3;
/** For path probing. Store the temporary probe stream ID
* for response comparison */
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 6185e87fd5..b945ea6aa6 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -3844,7 +3844,7 @@ get_next_token(memarea_t *area,
if ((size_t)(eol-next) != 9+obname_len+5 ||
strcmp_len(next+9, tok->object_type, obname_len) ||
strcmp_len(eol-5, "-----", 5)) {
- snprintf(ebuf, sizeof(ebuf), "Malformed object: mismatched end tag %s",
+ tor_snprintf(ebuf, sizeof(ebuf), "Malformed object: mismatched end tag %s",
tok->object_type);
ebuf[sizeof(ebuf)-1] = '\0';
RET_ERR(ebuf);