Browse Source

Extract cached_dir_t into a new header.

Nick Mathewson 6 years ago
parent
commit
958df2829a
7 changed files with 31 additions and 13 deletions
  1. 25 0
      src/or/cached_dir_st.h
  2. 1 0
      src/or/control.c
  3. 1 0
      src/or/dirauth/dirvote.c
  4. 1 0
      src/or/directory.c
  5. 1 0
      src/or/dirserv.c
  6. 1 0
      src/or/include.am
  7. 1 13
      src/or/or.h

+ 25 - 0
src/or/cached_dir_st.h

@@ -0,0 +1,25 @@
+/* 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 CACHED_DIR_ST_H
+#define CACHED_DIR_ST_H
+
+/** A cached_dir_t represents a cacheable directory object, along with its
+ * compressed form. */
+struct cached_dir_t {
+  char *dir; /**< Contents of this object, NUL-terminated. */
+  char *dir_compressed; /**< Compressed contents of this object. */
+  size_t dir_len; /**< Length of <b>dir</b> (not counting its NUL). */
+  size_t dir_compressed_len; /**< Length of <b>dir_compressed</b>. */
+  time_t published; /**< When was this object published. */
+  common_digests_t digests; /**< Digests of this object (networkstatus only) */
+  /** Sha3 digest (also ns only) */
+  uint8_t digest_sha3_as_signed[DIGEST256_LEN];
+  int refcnt; /**< Reference count for this cached_dir_t. */
+};
+
+#endif
+

+ 1 - 0
src/or/control.c

@@ -81,6 +81,7 @@
 #include "routerparse.h"
 #include "shared_random_client.h"
 
+#include "cached_dir_st.h"
 #include "control_connection_st.h"
 #include "cpath_build_state_st.h"
 #include "entry_connection_st.h"

+ 1 - 0
src/or/dirauth/dirvote.c

@@ -29,6 +29,7 @@
 #include "dirauth/shared_random_state.h"
 
 #include "authority_cert_st.h"
+#include "cached_dir_st.h"
 #include "dir_server_st.h"
 #include "document_signature_st.h"
 #include "microdesc_st.h"

+ 1 - 0
src/or/directory.c

@@ -55,6 +55,7 @@
 #include "dirauth/shared_random.h"
 
 #include "authority_cert_st.h"
+#include "cached_dir_st.h"
 #include "dir_connection_st.h"
 #include "dir_server_st.h"
 #include "entry_connection_st.h"

+ 1 - 0
src/or/dirserv.c

@@ -36,6 +36,7 @@
 
 #include "dirauth/dirvote.h"
 
+#include "cached_dir_st.h"
 #include "dir_connection_st.h"
 #include "extrainfo_st.h"
 #include "microdesc_st.h"

+ 1 - 0
src/or/include.am

@@ -195,6 +195,7 @@ ORHEADERS = \
 	src/or/circuitstats.h				\
 	src/or/circuituse.h				\
 	src/or/circuit_st.h				\
+	src/or/cached_dir_st.h				\
 	src/or/command.h				\
 	src/or/config.h					\
 	src/or/confparse.h				\

+ 1 - 13
src/or/or.h

@@ -1384,19 +1384,7 @@ typedef struct addr_policy_t {
   uint16_t prt_max; /**< Highest port number to accept/reject. */
 } addr_policy_t;
 
-/** A cached_dir_t represents a cacheable directory object, along with its
- * compressed form. */
-typedef struct cached_dir_t {
-  char *dir; /**< Contents of this object, NUL-terminated. */
-  char *dir_compressed; /**< Compressed contents of this object. */
-  size_t dir_len; /**< Length of <b>dir</b> (not counting its NUL). */
-  size_t dir_compressed_len; /**< Length of <b>dir_compressed</b>. */
-  time_t published; /**< When was this object published. */
-  common_digests_t digests; /**< Digests of this object (networkstatus only) */
-  /** Sha3 digest (also ns only) */
-  uint8_t digest_sha3_as_signed[DIGEST256_LEN];
-  int refcnt; /**< Reference count for this cached_dir_t. */
-} cached_dir_t;
+typedef struct cached_dir_t cached_dir_t;
 
 /** Enum used to remember where a signed_descriptor_t is stored and how to
  * manage the memory for signed_descriptor_body.  */