Sfoglia il codice sorgente

Create routerparse.h

Sebastian Hahn 14 anni fa
parent
commit
05072723cb

+ 1 - 0
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>

+ 1 - 0
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,

+ 1 - 0
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. */

+ 1 - 0
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

+ 1 - 0
src/or/dirserv.c

@@ -20,6 +20,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file dirserv.c

+ 1 - 0
src/or/dirvote.c

@@ -15,6 +15,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file dirvote.c

+ 1 - 0
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>

+ 1 - 0
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

+ 1 - 0
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. */
 

+ 0 - 75
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
 

+ 1 - 0
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. */

+ 1 - 0
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,

+ 1 - 0
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

+ 1 - 0
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);

+ 1 - 0
src/or/router.c

@@ -23,6 +23,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 /**
  * \file router.c

+ 1 - 0
src/or/routerlist.c

@@ -29,6 +29,7 @@
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
+#include "routerparse.h"
 
 // #define DEBUG_ROUTERLIST
 

+ 1 - 0
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>
 

+ 5 - 6
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
+

+ 1 - 0
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>

+ 1 - 0
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