Tor  0.4.4.0-alpha-dev
process_descs.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-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file process_descs.h
9  * \brief Header file for process_descs.c.
10  **/
11 
12 #ifndef TOR_RECV_UPLOADS_H
13 #define TOR_RECV_UPLOADS_H
14 
15 // for was_router_added_t.
17 
19 
21 
22 /** Target of status_by_digest map. */
23 typedef uint32_t rtr_flags_t;
24 
25 int add_rsa_fingerprint_to_dir(const char *fp, struct authdir_config_t *list,
26  rtr_flags_t add_status);
27 
29  struct authdir_config_t *list,
30  rtr_flags_t add_status);
31 
32 /** List of nickname->identity fingerprint mappings for all the routers
33  * that we name. Used to prevent router impersonation. */
34 typedef struct authdir_config_t {
35  strmap_t *fp_by_name; /**< Map from lc nickname to fingerprint. */
36  digestmap_t *status_by_digest; /**< Map from digest to router_status_t. */
37  digest256map_t *status_by_digest256; /**< Map from digest256 to
38  * router_status_t. */
40 
41 #if defined(PROCESS_DESCS_PRIVATE) || defined(TOR_UNIT_TESTS)
42 
43 /* 1 Historically used to indicate Named */
44 #define RTR_INVALID 2 /**< Believed invalid. */
45 #define RTR_REJECT 4 /**< We will not publish this router. */
46 /* 8 Historically used to avoid using this as a dir. */
47 #define RTR_BADEXIT 16 /**< We'll tell clients not to use this as an exit. */
48 /* 32 Historically used to indicade Unnamed */
49 
50 #endif /* defined(PROCESS_DESCS_PRIVATE) || defined(TOR_UNIT_TESTS) */
51 
52 #ifdef TOR_UNIT_TESTS
53 
54 void authdir_init_fingerprint_list(void);
55 
56 authdir_config_t *authdir_return_fingerprint_list(void);
57 
58 #endif /* defined(TOR_UNIT_TESTS) */
59 
61 
62 #ifdef HAVE_MODULE_DIRAUTH
65  const char *desc, size_t desclen,
66  uint8_t purpose,
67  const char *source,
68  const char **msg);
70  const char **msg,
71  const char *source);
72 
74  const vote_routerstatus_t *vrs);
75 int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
76  int complain,
77  int *valid_out);
79  const ed25519_public_key_t *edkey);
80 uint32_t dirserv_router_get_status(const routerinfo_t *router,
81  const char **msg,
82  int severity);
84  uint32_t authstatus);
85 #else /* !defined(HAVE_MODULE_DIRAUTH) */
86 static inline int
88 {
89  return 0;
90 }
91 static inline enum was_router_added_t
92 dirserv_add_multiple_descriptors(const char *desc, size_t desclen,
93  uint8_t purpose,
94  const char *source,
95  const char **msg)
96 {
97  (void)desc;
98  (void)desclen;
99  (void)purpose;
100  (void)source;
101  (void)msg;
102  return (enum was_router_added_t)0;
103 }
104 static inline enum was_router_added_t
106  const char **msg,
107  const char *source)
108 {
109  (void)ri;
110  (void)msg;
111  (void)source;
112  return (enum was_router_added_t)0;
113 }
114 static inline int
116  const vote_routerstatus_t *vrs)
117 {
118  (void)rs;
119  (void)vrs;
120  return 0;
121 }
122 static inline int
123 authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
124  int complain,
125  int *valid_out)
126 {
127  (void)ri;
128  (void)msg;
129  (void)complain;
130  (void)valid_out;
131  return 0;
132 }
133 static inline int
135 {
136  (void)pk;
137  (void)edkey;
138  return 0;
139 }
140 static inline uint32_t
142  const char **msg,
143  int severity)
144 {
145  (void)router;
146  (void)msg;
147  (void)severity;
148  return 0;
149 }
150 static inline void
152  uint32_t authstatus)
153 {
154  (void)node;
155  (void)authstatus;
156 }
157 #endif /* defined(HAVE_MODULE_DIRAUTH) */
158 
159 #ifdef TOR_UNIT_TESTS
161 STATIC bool dirserv_rejects_tor_version(const char *platform,
162  const char **msg);
163 #endif /* defined(TOR_UNIT_TESTS) */
164 
165 #endif /* !defined(TOR_RECV_UPLOADS_H) */
Definition: node_st.h:34
STATIC bool dirserv_rejects_tor_version(const char *platform, const char **msg)
was_router_added_t
Definition: routerlist.h:17
uint32_t dirserv_router_get_status(const routerinfo_t *router, const char **msg, int severity)
uint32_t rtr_flags_t
Definition: process_descs.h:20
#define STATIC
Definition: testsupport.h:32
int dirserv_load_fingerprint_file(void)
was_router_added_t dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
digest256map_t * status_by_digest256
Definition: process_descs.h:37
int add_ed25519_to_dir(const ed25519_public_key_t *edkey, struct authdir_config_t *list, rtr_flags_t add_status)
int dirserv_would_reject_router(const routerstatus_t *rs, const vote_routerstatus_t *vrs)
int dirserv_add_own_fingerprint(crypto_pk_t *pk, const ed25519_public_key_t *edkey)
void dirserv_set_node_flags_from_authoritative_status(node_t *node, uint32_t authstatus)
Header for crypto_ed25519.c.
digestmap_t * status_by_digest
Definition: process_descs.h:36
strmap_t * fp_by_name
Definition: process_descs.h:35
int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg, int complain, int *valid_out)
int add_rsa_fingerprint_to_dir(const char *fp, struct authdir_config_t *list, rtr_flags_t add_status)
Definition: process_descs.c:99
STATIC int dirserv_router_has_valid_address(routerinfo_t *ri)
was_router_added_t dirserv_add_multiple_descriptors(const char *desc, size_t desclen, uint8_t purpose, const char *source, const char **msg)
void dirserv_free_fingerprint_list(void)
Header file for routerlist.c.