Update copyrights to 2021, using "make update-copyright"
[tor.git] / src / feature / nodelist / signed_descriptor_st.h
blobe1982af29d3837e3d3db6a5c4b8ece7fe67836e9
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * @file signed_descriptor_st.h
9 * @brief Descriptor/extrainfo signature structure
10 **/
12 #ifndef SIGNED_DESCRIPTOR_ST_H
13 #define SIGNED_DESCRIPTOR_ST_H
15 #include "feature/dirclient/download_status_st.h"
17 /** Information need to cache an onion router's descriptor. */
18 struct signed_descriptor_t {
19 /** Pointer to the raw server descriptor, preceded by annotations. Not
20 * necessarily NUL-terminated. If saved_location is SAVED_IN_CACHE, this
21 * pointer is null. */
22 char *signed_descriptor_body;
23 /** Length of the annotations preceding the server descriptor. */
24 size_t annotations_len;
25 /** Length of the server descriptor. */
26 size_t signed_descriptor_len;
27 /** Digest of the server descriptor, computed as specified in
28 * dir-spec.txt. */
29 char signed_descriptor_digest[DIGEST_LEN];
30 /** Identity digest of the router. */
31 char identity_digest[DIGEST_LEN];
32 /** Declared publication time of the descriptor. */
33 time_t published_on;
34 /** For routerdescs only: digest of the corresponding extrainfo. */
35 char extra_info_digest[DIGEST_LEN];
36 /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
37 char extra_info_digest256[DIGEST256_LEN];
38 /** Certificate for ed25519 signing key. */
39 struct tor_cert_st *signing_key_cert;
40 /** For routerdescs only: Status of downloading the corresponding
41 * extrainfo. */
42 download_status_t ei_dl_status;
43 /** Where is the descriptor saved? */
44 saved_location_t saved_location;
45 /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
46 * this descriptor in the corresponding file. */
47 off_t saved_offset;
48 /** What position is this descriptor within routerlist->routers or
49 * routerlist->old_routers? -1 for none. */
50 int routerlist_index;
51 /** The valid-until time of the most recent consensus that listed this
52 * descriptor. 0 for "never listed in a consensus, so far as we know." */
53 time_t last_listed_as_valid_until;
54 /* If true, we do not ever try to save this object in the cache. */
55 unsigned int do_not_cache : 1;
56 /* If true, this item is meant to represent an extrainfo. */
57 unsigned int is_extrainfo : 1;
58 /* If true, we got an extrainfo for this item, and the digest was right,
59 * but it was incompatible. */
60 unsigned int extrainfo_is_bogus : 1;
61 /* If true, we are willing to transmit this item unencrypted. */
62 unsigned int send_unencrypted : 1;
65 #endif /* !defined(SIGNED_DESCRIPTOR_ST_H) */