aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/circuitbuild.c1
-rw-r--r--src/or/control.c1
-rw-r--r--src/or/dirauth/dirvote.c1
-rw-r--r--src/or/dirserv.c1
-rw-r--r--src/or/include.am1
-rw-r--r--src/or/microdesc.c1
-rw-r--r--src/or/microdesc_st.h71
-rw-r--r--src/or/nodelist.c1
-rw-r--r--src/or/or.h62
-rw-r--r--src/or/policies.c1
-rw-r--r--src/or/routerparse.c1
-rw-r--r--src/test/test_address_set.c1
-rw-r--r--src/test/test_entrynodes.c1
-rw-r--r--src/test/test_hs_common.c1
-rw-r--r--src/test/test_microdesc.c1
-rw-r--r--src/test/test_nodelist.c1
16 files changed, 86 insertions, 61 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 4944a70ce8..b871bd10c7 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -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,
diff --git a/src/or/control.c b/src/or/control.c
index c1d14b7a45..642d387745 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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"
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 29134868c8..73fa07bfe3 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -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"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index b76fa25d6d..8cfccda61e 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -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"
diff --git a/src/or/include.am b/src/or/include.am
index 602b811beb..564af4ba48 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -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 \
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index f125cf4057..a194fb3b0b 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -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
index 0000000000..f10a9ed7f5
--- /dev/null
+++ b/src/or/microdesc_st.h
@@ -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
+
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index b542fd5166..91d1003368 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -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"
diff --git a/src/or/or.h b/src/or/or.h
index 0d564b1e2d..40d7dfee31 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -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;
diff --git a/src/or/policies.c b/src/or/policies.c
index 0c1e3497eb..07cf12387f 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -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"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 7a19460dff..dee4220b6e 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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"
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index a704e6fb3e..efc4d4e8ab 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -10,6 +10,7 @@
#include "routerlist.h"
#include "torcert.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index d16af591d4..6a93921f90 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -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"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index ea5fb49792..342626bcc1 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -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"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 1fdac09243..5930893353 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -13,6 +13,7 @@
#include "routerparse.h"
#include "torcert.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index 018f109e5c..e41557ed35 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -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"