commit 958df2829a9248cf8518aafd9e19da48ce14cf64 Author: Nick Mathewson nickm@torproject.org Date: Fri Jun 15 15:06:00 2018 -0400
Extract cached_dir_t into a new header. --- src/or/cached_dir_st.h | 25 +++++++++++++++++++++++++ src/or/control.c | 1 + src/or/dirauth/dirvote.c | 1 + src/or/directory.c | 1 + src/or/dirserv.c | 1 + src/or/include.am | 1 + src/or/or.h | 14 +------------- 7 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/or/cached_dir_st.h b/src/or/cached_dir_st.h new file mode 100644 index 000000000..4f930b6fb --- /dev/null +++ b/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 + diff --git a/src/or/control.c b/src/or/control.c index 520b6178f..075b62a58 100644 --- a/src/or/control.c +++ b/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" diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c index 94a6139f5..c39708f4e 100644 --- a/src/or/dirauth/dirvote.c +++ b/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" diff --git a/src/or/directory.c b/src/or/directory.c index f6d6d28d4..2394b75b2 100644 --- a/src/or/directory.c +++ b/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" diff --git a/src/or/dirserv.c b/src/or/dirserv.c index e54782d19..68f411b48 100644 --- a/src/or/dirserv.c +++ b/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" diff --git a/src/or/include.am b/src/or/include.am index c28e95f05..cc059ef51 100644 --- a/src/or/include.am +++ b/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 \ diff --git a/src/or/or.h b/src/or/or.h index 9668760cc..958c1e2bb 100644 --- a/src/or/or.h +++ b/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. */
tor-commits@lists.torproject.org