[or-cvs] [tor/master 35/40] Create routerparse.h

nickm at torproject.org nickm at torproject.org
Fri Jul 30 01:56:58 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Fri, 23 Jul 2010 23:23:43 +0200
Subject: Create routerparse.h
Commit: 05072723cb8c14193376964ad5716a962d707770

---
 src/or/circuitbuild.c  |    1 +
 src/or/connection.c    |    1 +
 src/or/control.c       |    1 +
 src/or/directory.c     |    1 +
 src/or/dirserv.c       |    1 +
 src/or/dirvote.c       |    1 +
 src/or/main.c          |    1 +
 src/or/microdesc.c     |    1 +
 src/or/networkstatus.c |    1 +
 src/or/or.h            |   75 ------------------------------------------------
 src/or/policies.c      |    1 +
 src/or/relay.c         |    1 +
 src/or/rendcommon.c    |    1 +
 src/or/rendservice.c   |    1 +
 src/or/router.c        |    1 +
 src/or/routerlist.c    |    1 +
 src/or/routerparse.c   |    1 +
 src/or/routerparse.h   |   11 +++----
 src/test/test.c        |    1 +
 src/test/test_dir.c    |    1 +
 20 files changed, 23 insertions(+), 81 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index fc3dbda..5bb9d70 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -29,6 +29,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 #include "crypto.h"
 #undef log
 #include <math.h>
diff --git a/src/or/connection.c b/src/or/connection.c
index 02acd97..55d2fa8 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -34,6 +34,7 @@
 #include "rendcommon.h"
 #include "rephist.h"
 #include "router.h"
+#include "routerparse.h"
 
 static connection_t *connection_create_listener(
                                struct sockaddr *listensockaddr,
diff --git a/src/or/control.c b/src/or/control.c
index ffcbcfd..7cbb1bd 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -30,6 +30,7 @@
 #include "reasons.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /** Yield true iff <b>s</b> is the state of a control_connection_t that has
  * finished authentication and is accepting commands. */
diff --git a/src/or/directory.c b/src/or/directory.c
index c1e68bf..a3e575a 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -22,6 +22,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
 #ifndef OPENBSD
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 397a0c8..86cd186 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -20,6 +20,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file dirserv.c
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 2448a6a..fd4d742 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -15,6 +15,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file dirvote.c
diff --git a/src/or/main.c b/src/or/main.c
index 92c60e7..ff674f3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -43,6 +43,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
 #include <openssl/crypto.h>
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index ead0f9f..f56ccd9 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -4,6 +4,7 @@
 #include "or.h"
 #include "config.h"
 #include "microdesc.h"
+#include "routerparse.h"
 
 /** A data structure to hold a bunch of cached microdescriptors.  There are
  * two active files in the cache: a "cache file" that we mmap, and a "journal
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index c763e23..a9a9c78 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -22,6 +22,7 @@
 #include "relay.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /* For tracking v2 networkstatus documents.  Only caches do this now. */
 
diff --git a/src/or/or.h b/src/or/or.h
index f51da60..44fdd69 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3494,80 +3494,5 @@ typedef struct tor_version_t {
   char git_tag[DIGEST_LEN];
 } tor_version_t;
 
-int router_get_router_hash(const char *s, size_t s_len, char *digest);
-int router_get_dir_hash(const char *s, char *digest);
-int router_get_runningrouters_hash(const char *s, char *digest);
-int router_get_networkstatus_v2_hash(const char *s, char *digest);
-int router_get_networkstatus_v3_hash(const char *s, char *digest,
-                                     digest_algorithm_t algorithm);
-int router_get_networkstatus_v3_hashes(const char *s, digests_t *digests);
-int router_get_extrainfo_hash(const char *s, char *digest);
-int router_append_dirobj_signature(char *buf, size_t buf_len,
-                                   const char *digest,
-                                   size_t digest_len,
-                                   crypto_pk_env_t *private_key);
-int router_parse_list_from_string(const char **s, const char *eos,
-                                  smartlist_t *dest,
-                                  saved_location_t saved_location,
-                                  int is_extrainfo,
-                                  int allow_annotations,
-                                  const char *prepend_annotations);
-int router_parse_routerlist_from_directory(const char *s,
-                                           routerlist_t **dest,
-                                           crypto_pk_env_t *pkey,
-                                           int check_version,
-                                           int write_to_cache);
-int router_parse_runningrouters(const char *str);
-int router_parse_directory(const char *str);
-routerinfo_t *router_parse_entry_from_string(const char *s, const char *end,
-                                             int cache_copy,
-                                             int allow_annotations,
-                                             const char *prepend_annotations);
-extrainfo_t *extrainfo_parse_entry_from_string(const char *s, const char *end,
-                         int cache_copy, struct digest_ri_map_t *routermap);
-addr_policy_t *router_parse_addr_policy_item_from_string(const char *s,
-                                                  int assume_action);
-version_status_t tor_version_is_obsolete(const char *myversion,
-                                         const char *versionlist);
-int tor_version_parse(const char *s, tor_version_t *out);
-int tor_version_as_new_as(const char *platform, const char *cutoff);
-int tor_version_compare(tor_version_t *a, tor_version_t *b);
-void sort_version_list(smartlist_t *lst, int remove_duplicates);
-void assert_addr_policy_ok(smartlist_t *t);
-void dump_distinct_digest_count(int severity);
-
-int compare_routerstatus_entries(const void **_a, const void **_b);
-networkstatus_v2_t *networkstatus_v2_parse_from_string(const char *s);
-int networkstatus_verify_bw_weights(networkstatus_t *ns);
-networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
-                                                 const char **eos_out,
-                                                 networkstatus_type_t ns_type);
-ns_detached_signatures_t *networkstatus_parse_detached_signatures(
-                                          const char *s, const char *eos);
-
-smartlist_t *microdescs_parse_from_string(const char *s, const char *eos,
-                                          int allow_annotations,
-                                          int copy_body);
-
-authority_cert_t *authority_cert_parse_from_string(const char *s,
-                                                   const char **end_of_string);
-int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
-                                     char *desc_id_out,
-                                     char **intro_points_encrypted_out,
-                                     size_t *intro_points_encrypted_size_out,
-                                     size_t *encoded_size_out,
-                                     const char **next_out, const char *desc);
-int rend_decrypt_introduction_points(char **ipos_decrypted,
-                                     size_t *ipos_decrypted_size,
-                                     const char *descriptor_cookie,
-                                     const char *ipos_encrypted,
-                                     size_t ipos_encrypted_size);
-int rend_parse_introduction_points(rend_service_descriptor_t *parsed,
-                                   const char *intro_points_encoded,
-                                   size_t intro_points_encoded_size);
-int rend_parse_client_keys(strmap_t *parsed_clients, const char *str);
-
-void tor_gettimeofday_cache_clear(void);
-
 #endif
 
diff --git a/src/or/policies.c b/src/or/policies.c
index cd6307d..db3c6d8 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -12,6 +12,7 @@
 #include "config.h"
 #include "dirserv.h"
 #include "policies.h"
+#include "routerparse.h"
 #include "ht.h"
 
 /** Policy that addresses for incoming SOCKS connections must match. */
diff --git a/src/or/relay.c b/src/or/relay.c
index a40013a..22ecdaa 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -29,6 +29,7 @@
 #include "relay.h"
 #include "rendcommon.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 static int relay_crypt(circuit_t *circ, cell_t *cell,
                        cell_direction_t cell_direction,
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 8a4de3c..ec6680b 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -17,6 +17,7 @@
 #include "rendservice.h"
 #include "rephist.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /** Return 0 if one and two are the same service ids, else -1 or 1 */
 int
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index f7ab60d..b0d7915 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -21,6 +21,7 @@
 #include "relay.h"
 #include "rephist.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
                                             const char *pk_digest);
diff --git a/src/or/router.c b/src/or/router.c
index 36e2d26..978078b 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -23,6 +23,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file router.c
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 7f47e71..146040a 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -29,6 +29,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 // #define DEBUG_ROUTERLIST
 
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 88fbdbf..96749e5 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -21,6 +21,7 @@
 #include "microdesc.h"
 #include "networkstatus.h"
 #include "rephist.h"
+#include "routerparse.h"
 #undef log
 #include <math.h>
 
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index e615636..e246dbe 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -5,14 +5,12 @@
 /* See LICENSE for licensing information */
 
 /**
- * \file geoip.h
- * \brief Header file for geoip functions
+ * \file routerpase.h
+ * \brief Header file for router information parsing.
  **/
 
-#ifndef _TOR_GEOIP_H
-#define _TOR_GEOIP_H
-
-#define MAX_STATUS_TAG_LEN 32
+#ifndef _TOR_ROUTERPARSE_H
+#define _TOR_ROUTERPARSE_H
 
 int router_get_router_hash(const char *s, size_t s_len, char *digest);
 int router_get_dir_hash(const char *s, char *digest);
@@ -91,3 +89,4 @@ int rend_parse_client_keys(strmap_t *parsed_clients, const char *str);
 void tor_gettimeofday_cache_clear(void);
 
 #endif
+
diff --git a/src/test/test.c b/src/test/test.c
index 8bb694d..755d123 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -56,6 +56,7 @@ double fabs(double x);
 #include "onion.h"
 #include "policies.h"
 #include "rephist.h"
+#include "routerparse.h"
 
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 628dac7..a129bf9 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -14,6 +14,7 @@
 #include "networkstatus.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 #include "test.h"
 
 static void
-- 
1.7.1




More information about the tor-commits mailing list