]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Extract microdesc_t into its own header.
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 18:38:30 +0000 (14:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 18:38:30 +0000 (14:38 -0400)
16 files changed:
src/or/circuitbuild.c
src/or/control.c
src/or/dirauth/dirvote.c
src/or/dirserv.c
src/or/include.am
src/or/microdesc.c
src/or/microdesc_st.h [new file with mode: 0644]
src/or/nodelist.c
src/or/or.h
src/or/policies.c
src/or/routerparse.c
src/test/test_address_set.c
src/test/test_entrynodes.c
src/test/test_hs_common.c
src/test/test_microdesc.c
src/test/test_nodelist.c

index 4944a70ce84b4bb391a7ac7c8087a434e23c0a12..b871bd10c7d023f90e0cefeb12d9e4ba28fbe54b 100644 (file)
@@ -70,6 +70,7 @@
 #include "node_st.h"
 #include "or_circuit_st.h"
 #include "origin_circuit_st.h"
+#include "microdesc_st.h"
 #include "routerstatus_st.h"
 
 static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
index c1d14b7a45180aa5838c4887fcd784e3bdcf951c..642d3877458269c295ed5876cea65b10c5f8eb7a 100644 (file)
@@ -90,6 +90,7 @@
 #include "or_connection_st.h"
 #include "or_circuit_st.h"
 #include "origin_circuit_st.h"
+#include "microdesc_st.h"
 #include "rend_authorized_client_st.h"
 #include "rend_encoded_v2_service_descriptor_st.h"
 #include "rend_service_descriptor_st.h"
index 29134868c89bb3990dd9dfdfe49ccb8831208775..73fa07bfe38b9b3f25f5438ebe6cb7fcb1de72ed 100644 (file)
@@ -31,6 +31,7 @@
 #include "authority_cert_st.h"
 #include "dir_server_st.h"
 #include "document_signature_st.h"
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "networkstatus_voter_info_st.h"
 #include "node_st.h"
index b76fa25d6d28cf449bc1dc26ed4a7e15c9898a74..8cfccda61e201da9125712c5b81b27831c1386ce 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "dir_connection_st.h"
 #include "extrainfo_st.h"
+#include "microdesc_st.h"
 #include "node_st.h"
 #include "routerlist_st.h"
 #include "tor_version_st.h"
index 602b811bebe2f879a2d05dc92fb7e682213bfe18..564af4ba48a6a8723cd4c3ba24243eea96c43926 100644 (file)
@@ -250,6 +250,7 @@ ORHEADERS = \
        src/or/listener_connection_st.h                 \
        src/or/main.h                                   \
        src/or/microdesc.h                              \
+       src/or/microdesc_st.h                           \
        src/or/networkstatus.h                          \
        src/or/networkstatus_st.h                       \
        src/or/networkstatus_sr_info_st.h               \
index f125cf40579f90c4eb057ea6f6f06b05a5266fba..a194fb3b0b5ea8d1bc92a4d6c7b487828455bc70 100644 (file)
@@ -22,6 +22,7 @@
 #include "routerlist.h"
 #include "routerparse.h"
 
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "routerstatus_st.h"
diff --git a/src/or/microdesc_st.h b/src/or/microdesc_st.h
new file mode 100644 (file)
index 0000000..f10a9ed
--- /dev/null
@@ -0,0 +1,71 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef MICRODESC_ST_H
+#define MICRODESC_ST_H
+
+/** A microdescriptor is the smallest amount of information needed to build a
+ * circuit through a router.  They are generated by the directory authorities,
+ * using information from the uploaded routerinfo documents.  They are not
+ * self-signed, but are rather authenticated by having their hash in a signed
+ * networkstatus document. */
+struct microdesc_t {
+  /** Hashtable node, used to look up the microdesc by its digest. */
+  HT_ENTRY(microdesc_t) node;
+
+  /* Cache information */
+
+  /**  When was this microdescriptor last listed in a consensus document?
+   * Once a microdesc has been unlisted long enough, we can drop it.
+   */
+  time_t last_listed;
+  /** Where is this microdescriptor currently stored? */
+  saved_location_bitfield_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 */
+  unsigned int held_in_map : 1;
+  /** Reference count: how many node_ts have a reference to this microdesc? */
+  unsigned int held_by_nodes;
+
+  /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the
+   * microdescriptor in the cache. */
+  off_t off;
+
+  /* The string containing the microdesc. */
+
+  /** A pointer to the encoded body of the microdescriptor.  If the
+   * saved_location is SAVED_IN_CACHE, then the body is a pointer into an
+   * mmap'd region.  Otherwise, it is a malloc'd string.  The string might not
+   * be NUL-terminated; take the length from <b>bodylen</b>. */
+  char *body;
+  /** The length of the microdescriptor in <b>body</b>. */
+  size_t bodylen;
+  /** A SHA256-digest of the microdescriptor. */
+  char digest[DIGEST256_LEN];
+
+  /* Fields in the microdescriptor. */
+
+  /** As routerinfo_t.onion_pkey */
+  crypto_pk_t *onion_pkey;
+  /** As routerinfo_t.onion_curve25519_pkey */
+  curve25519_public_key_t *onion_curve25519_pkey;
+  /** Ed25519 identity key, if included. */
+  ed25519_public_key_t *ed25519_identity_pkey;
+  /** As routerinfo_t.ipv6_addr */
+  tor_addr_t ipv6_addr;
+  /** As routerinfo_t.ipv6_orport */
+  uint16_t ipv6_orport;
+  /** As routerinfo_t.family */
+  smartlist_t *family;
+  /** IPv4 exit policy summary */
+  short_policy_t *exit_policy;
+  /** IPv6 exit policy summary */
+  short_policy_t *ipv6_exit_policy;
+};
+
+#endif
+
index b542fd516642526bd5b68509c5b8a73ae31b4966..91d10033682f08057930a6c78f973bf40a00cc12 100644 (file)
@@ -69,6 +69,7 @@
 #include "dirauth/mode.h"
 
 #include "dir_server_st.h"
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "routerlist_st.h"
index 0d564b1e2df102475782a3b181d6eb518e8b07e2..40d7dfee31d3d57efb978f3bbdd69c3d5608d937 100644 (file)
@@ -1715,67 +1715,7 @@ typedef struct short_policy_t {
   short_policy_entry_t entries[FLEXIBLE_ARRAY_MEMBER];
 } short_policy_t;
 
-/** A microdescriptor is the smallest amount of information needed to build a
- * circuit through a router.  They are generated by the directory authorities,
- * using information from the uploaded routerinfo documents.  They are not
- * self-signed, but are rather authenticated by having their hash in a signed
- * networkstatus document. */
-typedef struct microdesc_t {
-  /** Hashtable node, used to look up the microdesc by its digest. */
-  HT_ENTRY(microdesc_t) node;
-
-  /* Cache information */
-
-  /**  When was this microdescriptor last listed in a consensus document?
-   * Once a microdesc has been unlisted long enough, we can drop it.
-   */
-  time_t last_listed;
-  /** Where is this microdescriptor currently stored? */
-  saved_location_bitfield_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 */
-  unsigned int held_in_map : 1;
-  /** Reference count: how many node_ts have a reference to this microdesc? */
-  unsigned int held_by_nodes;
-
-  /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the
-   * microdescriptor in the cache. */
-  off_t off;
-
-  /* The string containing the microdesc. */
-
-  /** A pointer to the encoded body of the microdescriptor.  If the
-   * saved_location is SAVED_IN_CACHE, then the body is a pointer into an
-   * mmap'd region.  Otherwise, it is a malloc'd string.  The string might not
-   * be NUL-terminated; take the length from <b>bodylen</b>. */
-  char *body;
-  /** The length of the microdescriptor in <b>body</b>. */
-  size_t bodylen;
-  /** A SHA256-digest of the microdescriptor. */
-  char digest[DIGEST256_LEN];
-
-  /* Fields in the microdescriptor. */
-
-  /** As routerinfo_t.onion_pkey */
-  crypto_pk_t *onion_pkey;
-  /** As routerinfo_t.onion_curve25519_pkey */
-  curve25519_public_key_t *onion_curve25519_pkey;
-  /** Ed25519 identity key, if included. */
-  ed25519_public_key_t *ed25519_identity_pkey;
-  /** As routerinfo_t.ipv6_addr */
-  tor_addr_t ipv6_addr;
-  /** As routerinfo_t.ipv6_orport */
-  uint16_t ipv6_orport;
-  /** As routerinfo_t.family */
-  smartlist_t *family;
-  /** IPv4 exit policy summary */
-  short_policy_t *exit_policy;
-  /** IPv6 exit policy summary */
-  short_policy_t *ipv6_exit_policy;
-
-} microdesc_t;
-
+typedef struct microdesc_t microdesc_t;
 typedef struct node_t node_t;
 typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
 typedef struct vote_routerstatus_t vote_routerstatus_t;
index 0c1e3497eb34574f85c661abe18a49cb9bee55c9..07cf12387fc6927834967ade60e05b7cf127e5c2 100644 (file)
@@ -31,6 +31,7 @@
 #include "ht.h"
 
 #include "dir_server_st.h"
+#include "microdesc_st.h"
 #include "node_st.h"
 #include "port_cfg_st.h"
 #include "routerstatus_st.h"
index 7a19460dff11bdf62f595b2123234d20a2f00b96..dee4220b6e7020b757d47a5f9d4144d7e8612fcb 100644 (file)
@@ -84,6 +84,7 @@
 #include "authority_cert_st.h"
 #include "document_signature_st.h"
 #include "extrainfo_st.h"
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "networkstatus_voter_info_st.h"
 #include "ns_detached_signatures_st.h"
index a704e6fb3e6ca08a645adbea20c80ce5ba6a9c12..efc4d4e8aba3626011d22f7702deed66d9587023 100644 (file)
@@ -10,6 +10,7 @@
 #include "routerlist.h"
 #include "torcert.h"
 
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "routerstatus_st.h"
 
index d16af591d48df3786967ccc7436ad41024aea361..6a93921f908b6e939f6c4224e070ef7c50fb7a6d 100644 (file)
@@ -33,6 +33,7 @@
 #include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "dir_connection_st.h"
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "origin_circuit_st.h"
index ea5fb497929bf41a1800e65563d6e2329b8bc242..342626bcc1015ba32f2af6a0da2e475c5f6398f0 100644 (file)
@@ -33,6 +33,7 @@
 #include "util.h"
 #include "voting_schedule.h"
 
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "routerstatus_st.h"
index 1fdac092431e9ea0c85d0c0d569027d5176818e5..59308933534d0d8813f0ba5250e40a38e207d149 100644 (file)
@@ -13,6 +13,7 @@
 #include "routerparse.h"
 #include "torcert.h"
 
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "routerstatus_st.h"
 
index 018f109e5c8f919e56eeaed60b06723847fe72ad..e41557ed35167c47c264dc98bb2f10d41f15fad2 100644 (file)
@@ -12,6 +12,7 @@
 #include "nodelist.h"
 #include "torcert.h"
 
+#include "microdesc_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "routerstatus_st.h"