Tor 0.4.9.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-2021, 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
20struct authdir_config_t;
21
22/** Target of status_by_digest map. */
23typedef uint32_t rtr_flags_t;
24
25int 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. */
34typedef 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/** We'll vote to only use this router as a midpoint. */
49#define RTR_MIDDLEONLY 32
50
51#endif /* defined(PROCESS_DESCS_PRIVATE) || defined(TOR_UNIT_TESTS) */
52
53#ifdef TOR_UNIT_TESTS
54
55void authdir_init_fingerprint_list(void);
56
57authdir_config_t *authdir_return_fingerprint_list(void);
58
59#endif /* defined(TOR_UNIT_TESTS) */
60
62
63#ifdef HAVE_MODULE_DIRAUTH
66 const char *desc, size_t desclen,
67 uint8_t purpose,
68 const char *source,
69 const char **msg);
71 const char **msg,
72 const char *source);
73
75 const vote_routerstatus_t *vrs);
76int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
77 int complain,
78 int *valid_out);
80 const ed25519_public_key_t *edkey);
81uint32_t dirserv_router_get_status(const routerinfo_t *router,
82 const char **msg,
83 int severity);
85 uint32_t authstatus);
86#else /* !defined(HAVE_MODULE_DIRAUTH) */
87static inline int
89{
90 return 0;
91}
92static inline enum was_router_added_t
93dirserv_add_multiple_descriptors(const char *desc, size_t desclen,
94 uint8_t purpose,
95 const char *source,
96 const char **msg)
97{
98 (void)desc;
99 (void)desclen;
100 (void)purpose;
101 (void)source;
102 *msg = "No directory authority support";
103 return (enum was_router_added_t)0;
104}
105static inline enum was_router_added_t
107 const char **msg,
108 const char *source)
109{
110 (void)ri;
111 (void)source;
112 *msg = "No directory authority support";
113 return (enum was_router_added_t)0;
114}
115static inline int
117 const vote_routerstatus_t *vrs)
118{
119 (void)rs;
120 (void)vrs;
121 return 0;
122}
123static inline int
124authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
125 int complain,
126 int *valid_out)
127{
128 (void)ri;
129 (void)complain;
130 *msg = "No directory authority support";
131 *valid_out = 0;
132 return 0;
133}
134static inline int
136{
137 (void)pk;
138 (void)edkey;
139 return 0;
140}
141static inline uint32_t
143 const char **msg,
144 int severity)
145{
146 (void)router;
147 (void)severity;
148 if (msg)
149 *msg = "No directory authority support";
150 return 0;
151}
152static inline void
154 uint32_t authstatus)
155{
156 (void)node;
157 (void)authstatus;
158}
159#endif /* defined(HAVE_MODULE_DIRAUTH) */
160
161#ifdef TOR_UNIT_TESTS
163STATIC bool dirserv_rejects_tor_version(const char *platform,
164 const char **msg);
165#endif /* defined(TOR_UNIT_TESTS) */
166
167#endif /* !defined(TOR_RECV_UPLOADS_H) */
Header for crypto_ed25519.c.
int dirserv_would_reject_router(const routerstatus_t *rs, const vote_routerstatus_t *vrs)
int dirserv_load_fingerprint_file(void)
STATIC bool dirserv_rejects_tor_version(const char *platform, const char **msg)
was_router_added_t dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
void dirserv_set_node_flags_from_authoritative_status(node_t *node, uint32_t authstatus)
int dirserv_add_own_fingerprint(crypto_pk_t *pk, const ed25519_public_key_t *edkey)
was_router_added_t dirserv_add_multiple_descriptors(const char *desc, size_t desclen, uint8_t purpose, const char *source, const char **msg)
uint32_t dirserv_router_get_status(const routerinfo_t *router, const char **msg, int severity)
STATIC int dirserv_router_has_valid_address(routerinfo_t *ri)
int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg, int complain, int *valid_out)
int add_ed25519_to_dir(const ed25519_public_key_t *edkey, struct authdir_config_t *list, rtr_flags_t add_status)
int add_rsa_fingerprint_to_dir(const char *fp, struct authdir_config_t *list, rtr_flags_t add_status)
void dirserv_free_fingerprint_list(void)
uint32_t rtr_flags_t
Definition: process_descs.h:23
Header file for routerlist.c.
was_router_added_t
Definition: routerlist.h:17
digest256map_t * status_by_digest256
Definition: process_descs.h:37
strmap_t * fp_by_name
Definition: process_descs.h:35
digestmap_t * status_by_digest
Definition: process_descs.h:36
Definition: node_st.h:34
#define STATIC
Definition: testsupport.h:32