tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 958df2829a9248cf8518aafd9e19da48ce14cf64
parent f85d731e3af16e72682f68be4f598f08ed227618
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri, 15 Jun 2018 15:06:00 -0400

Extract cached_dir_t into a new header.

Diffstat:
Asrc/or/cached_dir_st.h | 25+++++++++++++++++++++++++
Msrc/or/control.c | 1+
Msrc/or/dirauth/dirvote.c | 1+
Msrc/or/directory.c | 1+
Msrc/or/dirserv.c | 1+
Msrc/or/include.am | 1+
Msrc/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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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. */