From 89aefb0319778af419abed11707a7bf84648288c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 15 Jun 2018 13:31:47 -0400 Subject: [PATCH] Extract networkstatus_vote_info_t into its own header. --- src/or/consdiffmgr.c | 2 ++ src/or/dirauth/dirvote.c | 1 + src/or/include.am | 1 + src/or/networkstatus.c | 1 + src/or/networkstatus_voter_info_st.h | 31 ++++++++++++++++++++++++++++ src/or/or.h | 21 +------------------ src/or/routerlist.c | 1 + src/or/routerparse.c | 1 + src/test/test_dir.c | 1 + src/test/test_dir_common.c | 1 + 10 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 src/or/networkstatus_voter_info_st.h diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c index 323f4f9ca0..b90660e6c7 100644 --- a/src/or/consdiffmgr.c +++ b/src/or/consdiffmgr.c @@ -23,6 +23,8 @@ #include "routerparse.h" #include "workqueue.h" +#include "networkstatus_voter_info_st.h" + /** * Labels to apply to items in the conscache object. * diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c index 12ab5f3289..5dee8a8797 100644 --- a/src/or/dirauth/dirvote.c +++ b/src/or/dirauth/dirvote.c @@ -30,6 +30,7 @@ #include "dir_server_st.h" #include "document_signature_st.h" +#include "networkstatus_voter_info_st.h" #include "node_st.h" #include "vote_microdesc_hash_st.h" #include "vote_routerstatus_st.h" diff --git a/src/or/include.am b/src/or/include.am index 611b1adbce..6ced3e1558 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -248,6 +248,7 @@ ORHEADERS = \ src/or/main.h \ src/or/microdesc.h \ src/or/networkstatus.h \ + src/or/networkstatus_voter_info_st.h \ src/or/nodelist.h \ src/or/node_st.h \ src/or/ntmain.h \ diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 1bea0d774d..11021a7ead 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -77,6 +77,7 @@ #include "dir_connection_st.h" #include "dir_server_st.h" #include "document_signature_st.h" +#include "networkstatus_voter_info_st.h" #include "node_st.h" #include "vote_microdesc_hash_st.h" #include "vote_routerstatus_st.h" diff --git a/src/or/networkstatus_voter_info_st.h b/src/or/networkstatus_voter_info_st.h new file mode 100644 index 0000000000..32ea597bd8 --- /dev/null +++ b/src/or/networkstatus_voter_info_st.h @@ -0,0 +1,31 @@ +/* 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 NETWORKSTATUS_VOTER_INFO_ST_H +#define NETWORKSTATUS_VOTER_INFO_ST_H + +/** Information about a single voter in a vote or a consensus. */ +typedef struct networkstatus_voter_info_t { + /** Declared SHA-1 digest of this voter's identity key */ + char identity_digest[DIGEST_LEN]; + char *nickname; /**< Nickname of this voter */ + /** Digest of this voter's "legacy" identity key, if any. In vote only; for + * consensuses, we treat legacy keys as additional signers. */ + char legacy_id_digest[DIGEST_LEN]; + char *address; /**< Address of this voter, in string format. */ + uint32_t addr; /**< Address of this voter, in IPv4, in host order. */ + uint16_t dir_port; /**< Directory port of this voter */ + uint16_t or_port; /**< OR port of this voter */ + char *contact; /**< Contact information for this voter. */ + char vote_digest[DIGEST_LEN]; /**< Digest of this voter's vote, as signed. */ + + /* Nothing from here on is signed. */ + /** The signature of the document and the signature's status. */ + smartlist_t *sigs; +} networkstatus_voter_info_t; + +#endif + diff --git a/src/or/or.h b/src/or/or.h index ab1ae5742b..1069e30d0a 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1861,26 +1861,7 @@ typedef struct node_t node_t; typedef struct vote_microdesc_hash_t vote_microdesc_hash_t; typedef struct vote_routerstatus_t vote_routerstatus_t; typedef struct document_signature_t document_signature_t; - -/** Information about a single voter in a vote or a consensus. */ -typedef struct networkstatus_voter_info_t { - /** Declared SHA-1 digest of this voter's identity key */ - char identity_digest[DIGEST_LEN]; - char *nickname; /**< Nickname of this voter */ - /** Digest of this voter's "legacy" identity key, if any. In vote only; for - * consensuses, we treat legacy keys as additional signers. */ - char legacy_id_digest[DIGEST_LEN]; - char *address; /**< Address of this voter, in string format. */ - uint32_t addr; /**< Address of this voter, in IPv4, in host order. */ - uint16_t dir_port; /**< Directory port of this voter */ - uint16_t or_port; /**< OR port of this voter */ - char *contact; /**< Contact information for this voter. */ - char vote_digest[DIGEST_LEN]; /**< Digest of this voter's vote, as signed. */ - - /* Nothing from here on is signed. */ - /** The signature of the document and the signature's status. */ - smartlist_t *sigs; -} networkstatus_voter_info_t; +typedef struct networkstatus_voter_info_t networkstatus_voter_info_t; typedef struct networkstatus_sr_info_t { /* Indicate if the dirauth partitipates in the SR protocol with its vote. diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 68def1c85e..5a8d19f6f4 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -128,6 +128,7 @@ #include "dir_connection_st.h" #include "dir_server_st.h" #include "document_signature_st.h" +#include "networkstatus_voter_info_st.h" #include "node_st.h" #include "vote_routerstatus_st.h" diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 2ae005569c..73721bf236 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -82,6 +82,7 @@ #include "dirauth/dirvote.h" #include "document_signature_st.h" +#include "networkstatus_voter_info_st.h" #include "rend_authorized_client_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" diff --git a/src/test/test_dir.c b/src/test/test_dir.c index c3d00a81f9..f5a3b6f65c 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -46,6 +46,7 @@ #include "voting_schedule.h" #include "document_signature_st.h" +#include "networkstatus_voter_info_st.h" #include "port_cfg_st.h" #include "tor_version_st.h" #include "vote_microdesc_hash_st.h" diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c index 4b36025b54..fca132c9f7 100644 --- a/src/test/test_dir_common.c +++ b/src/test/test_dir_common.c @@ -14,6 +14,7 @@ #include "test_dir_common.h" #include "voting_schedule.h" +#include "networkstatus_voter_info_st.h" #include "vote_microdesc_hash_st.h" #include "vote_routerstatus_st.h"