Tor  0.4.3.0-alpha-dev
microdesc_st.h
Go to the documentation of this file.
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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * @file microdesc_st.h
9  * @brief Microdescriptor structure
10  **/
11 
12 #ifndef MICRODESC_ST_H
13 #define MICRODESC_ST_H
14 
17 struct nodefamily_t;
18 struct short_policy_t;
19 
20 /** A microdescriptor is the smallest amount of information needed to build a
21  * circuit through a router. They are generated by the directory authorities,
22  * using information from the uploaded routerinfo documents. They are not
23  * self-signed, but are rather authenticated by having their hash in a signed
24  * networkstatus document. */
25 struct microdesc_t {
26  /** Hashtable node, used to look up the microdesc by its digest. */
27  HT_ENTRY(microdesc_t) node;
28 
29  /* Cache information */
30 
31  /** When was this microdescriptor last listed in a consensus document?
32  * Once a microdesc has been unlisted long enough, we can drop it.
33  */
34  time_t last_listed;
35  /** Where is this microdescriptor currently stored? */
36  saved_location_bitfield_t saved_location : 3;
37  /** If true, do not attempt to cache this microdescriptor on disk. */
38  unsigned int no_save : 1;
39  /** If true, this microdesc has an entry in the microdesc_map */
40  unsigned int held_in_map : 1;
41  /** True iff the exit policy for this router rejects everything. */
42  unsigned int policy_is_reject_star : 1;
43  /** Reference count: how many node_ts have a reference to this microdesc? */
44  unsigned int held_by_nodes;
45 
46  /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the
47  * microdescriptor in the cache. */
48  off_t off;
49 
50  /* The string containing the microdesc. */
51 
52  /** A pointer to the encoded body of the microdescriptor. If the
53  * saved_location is SAVED_IN_CACHE, then the body is a pointer into an
54  * mmap'd region. Otherwise, it is a malloc'd string. The string might not
55  * be NUL-terminated; take the length from <b>bodylen</b>. */
56  char *body;
57  /** The length of the microdescriptor in <b>body</b>. */
58  size_t bodylen;
59  /** A SHA256-digest of the microdescriptor. */
61 
62  /* Fields in the microdescriptor. */
63 
64  /**
65  * Public RSA TAP key for onions, ASN.1 encoded. We store this
66  * in its encoded format since storing it as a crypto_pk_t uses
67  * significantly more memory. */
68  char *onion_pkey;
69  /** Length of onion_pkey, in bytes. */
71 
72  /** As routerinfo_t.onion_curve25519_pkey */
74  /** Ed25519 identity key, if included. */
76  /** As routerinfo_t.ipv6_addr */
78  /** As routerinfo_t.ipv6_orport */
79  uint16_t ipv6_orport;
80  /** As routerinfo_t.family, with readable members parsed. */
82  /** IPv4 exit policy summary */
84  /** IPv6 exit policy summary */
86 };
87 
88 #endif /* !defined(MICRODESC_ST_H) */
char * body
Definition: microdesc_st.h:56
struct curve25519_public_key_t * onion_curve25519_pkey
Definition: microdesc_st.h:73
time_t last_listed
Definition: microdesc_st.h:34
size_t bodylen
Definition: microdesc_st.h:58
struct nodefamily_t * family
Definition: microdesc_st.h:81
unsigned int no_save
Definition: microdesc_st.h:38
struct ed25519_public_key_t * ed25519_identity_pkey
Definition: microdesc_st.h:75
#define DIGEST256_LEN
Definition: digest_sizes.h:23
HT_ENTRY(microdesc_t) node
size_t onion_pkey_len
Definition: microdesc_st.h:70
struct short_policy_t * exit_policy
Definition: microdesc_st.h:83
tor_addr_t ipv6_addr
Definition: microdesc_st.h:77
char digest[DIGEST256_LEN]
Definition: microdesc_st.h:60
saved_location_bitfield_t saved_location
Definition: microdesc_st.h:36
unsigned int held_by_nodes
Definition: microdesc_st.h:44
char * onion_pkey
Definition: microdesc_st.h:68
unsigned int held_in_map
Definition: microdesc_st.h:40
struct short_policy_t * ipv6_exit_policy
Definition: microdesc_st.h:85
uint16_t ipv6_orport
Definition: microdesc_st.h:79
unsigned int policy_is_reject_star
Definition: microdesc_st.h:42