[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Extract signed_descriptor_t into its own header.



commit 03fc83ab6da6b73b930e422c57089ad5a4907c83
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Jun 15 14:53:07 2018 -0400

    Extract signed_descriptor_t into its own header.
---
 src/or/authority_cert_st.h    |  2 ++
 src/or/extrainfo_st.h         |  2 ++
 src/or/include.am             |  1 +
 src/or/or.h                   | 48 +----------------------------------
 src/or/routerinfo_st.h        |  2 ++
 src/or/signed_descriptor_st.h | 59 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 47 deletions(-)

diff --git a/src/or/authority_cert_st.h b/src/or/authority_cert_st.h
index b1dbcddbe..bc274a1c6 100644
--- a/src/or/authority_cert_st.h
+++ b/src/or/authority_cert_st.h
@@ -7,6 +7,8 @@
 #ifndef AUTHORITY_CERT_ST_H
 #define AUTHORITY_CERT_ST_H
 
+#include "signed_descriptor_st.h"
+
 /** Certificate for v3 directory protocol: binds long-term authority identity
  * keys to medium-term authority signing keys. */
 struct authority_cert_t {
diff --git a/src/or/extrainfo_st.h b/src/or/extrainfo_st.h
index d65397849..c4d84b8ee 100644
--- a/src/or/extrainfo_st.h
+++ b/src/or/extrainfo_st.h
@@ -7,6 +7,8 @@
 #ifndef EXTRAINFO_ST_H
 #define EXTRAINFO_ST_H
 
+#include "signed_descriptor_st.h"
+
 /** Information needed to keep and cache a signed extra-info document. */
 struct extrainfo_t {
   signed_descriptor_t cache_info;
diff --git a/src/or/include.am b/src/or/include.am
index 468b231f7..cb9f4994e 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -307,6 +307,7 @@ ORHEADERS = \
 	src/or/scheduler.h				\
 	src/or/server_port_cfg_st.h			\
 	src/or/shared_random_client.h			\
+	src/or/signed_descriptor_st.h			\
 	src/or/socks_request_st.h			\
 	src/or/statefile.h				\
 	src/or/status.h					\
diff --git a/src/or/or.h b/src/or/or.h
index 208ec6d33..3dd1b6fe5 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1511,53 +1511,7 @@ typedef struct download_status_t {
  * create any that are larger than this. */
 #define ROUTER_ANNOTATION_BUF_LEN 256
 
-/** Information need to cache an onion router's descriptor. */
-typedef struct signed_descriptor_t {
-  /** Pointer to the raw server descriptor, preceded by annotations.  Not
-   * necessarily NUL-terminated.  If saved_location is SAVED_IN_CACHE, this
-   * pointer is null. */
-  char *signed_descriptor_body;
-  /** Length of the annotations preceding the server descriptor. */
-  size_t annotations_len;
-  /** Length of the server descriptor. */
-  size_t signed_descriptor_len;
-  /** Digest of the server descriptor, computed as specified in
-   * dir-spec.txt. */
-  char signed_descriptor_digest[DIGEST_LEN];
-  /** Identity digest of the router. */
-  char identity_digest[DIGEST_LEN];
-  /** Declared publication time of the descriptor. */
-  time_t published_on;
-  /** For routerdescs only: digest of the corresponding extrainfo. */
-  char extra_info_digest[DIGEST_LEN];
-  /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
-  char extra_info_digest256[DIGEST256_LEN];
-  /** Certificate for ed25519 signing key. */
-  struct tor_cert_st *signing_key_cert;
-  /** For routerdescs only: Status of downloading the corresponding
-   * extrainfo. */
-  download_status_t ei_dl_status;
-  /** Where is the descriptor saved? */
-  saved_location_t saved_location;
-  /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
-   * this descriptor in the corresponding file. */
-  off_t saved_offset;
-  /** What position is this descriptor within routerlist->routers or
-   * routerlist->old_routers? -1 for none. */
-  int routerlist_index;
-  /** The valid-until time of the most recent consensus that listed this
-   * descriptor.  0 for "never listed in a consensus, so far as we know." */
-  time_t last_listed_as_valid_until;
-  /* If true, we do not ever try to save this object in the cache. */
-  unsigned int do_not_cache : 1;
-  /* If true, this item is meant to represent an extrainfo. */
-  unsigned int is_extrainfo : 1;
-  /* If true, we got an extrainfo for this item, and the digest was right,
-   * but it was incompatible. */
-  unsigned int extrainfo_is_bogus : 1;
-  /* If true, we are willing to transmit this item unencrypted. */
-  unsigned int send_unencrypted : 1;
-} signed_descriptor_t;
+typedef struct signed_descriptor_t signed_descriptor_t;
 
 /** A signed integer representing a country code. */
 typedef int16_t country_t;
diff --git a/src/or/routerinfo_st.h b/src/or/routerinfo_st.h
index 800a8cbe3..11ee3e350 100644
--- a/src/or/routerinfo_st.h
+++ b/src/or/routerinfo_st.h
@@ -7,6 +7,8 @@
 #ifndef ROUTERINFO_ST_H
 #define ROUTERINFO_ST_H
 
+#include "signed_descriptor_st.h"
+
 /** Information about another onion router in the network. */
 struct routerinfo_t {
   signed_descriptor_t cache_info;
diff --git a/src/or/signed_descriptor_st.h b/src/or/signed_descriptor_st.h
new file mode 100644
index 000000000..0159e9176
--- /dev/null
+++ b/src/or/signed_descriptor_st.h
@@ -0,0 +1,59 @@
+/* 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 SIGNED_DESCRIPTOR_ST_H
+#define SIGNED_DESCRIPTOR_ST_H
+
+/** Information need to cache an onion router's descriptor. */
+struct signed_descriptor_t {
+  /** Pointer to the raw server descriptor, preceded by annotations.  Not
+   * necessarily NUL-terminated.  If saved_location is SAVED_IN_CACHE, this
+   * pointer is null. */
+  char *signed_descriptor_body;
+  /** Length of the annotations preceding the server descriptor. */
+  size_t annotations_len;
+  /** Length of the server descriptor. */
+  size_t signed_descriptor_len;
+  /** Digest of the server descriptor, computed as specified in
+   * dir-spec.txt. */
+  char signed_descriptor_digest[DIGEST_LEN];
+  /** Identity digest of the router. */
+  char identity_digest[DIGEST_LEN];
+  /** Declared publication time of the descriptor. */
+  time_t published_on;
+  /** For routerdescs only: digest of the corresponding extrainfo. */
+  char extra_info_digest[DIGEST_LEN];
+  /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
+  char extra_info_digest256[DIGEST256_LEN];
+  /** Certificate for ed25519 signing key. */
+  struct tor_cert_st *signing_key_cert;
+  /** For routerdescs only: Status of downloading the corresponding
+   * extrainfo. */
+  download_status_t ei_dl_status;
+  /** Where is the descriptor saved? */
+  saved_location_t saved_location;
+  /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
+   * this descriptor in the corresponding file. */
+  off_t saved_offset;
+  /** What position is this descriptor within routerlist->routers or
+   * routerlist->old_routers? -1 for none. */
+  int routerlist_index;
+  /** The valid-until time of the most recent consensus that listed this
+   * descriptor.  0 for "never listed in a consensus, so far as we know." */
+  time_t last_listed_as_valid_until;
+  /* If true, we do not ever try to save this object in the cache. */
+  unsigned int do_not_cache : 1;
+  /* If true, this item is meant to represent an extrainfo. */
+  unsigned int is_extrainfo : 1;
+  /* If true, we got an extrainfo for this item, and the digest was right,
+   * but it was incompatible. */
+  unsigned int extrainfo_is_bogus : 1;
+  /* If true, we are willing to transmit this item unencrypted. */
+  unsigned int send_unencrypted : 1;
+};
+
+#endif
+



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits