Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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#define RTR_STRIPGUARD 64
51#define RTR_STRIPHSDIR 128
52#define RTR_STRIPV2DIR 256
53
54#endif /* defined(PROCESS_DESCS_PRIVATE) || defined(TOR_UNIT_TESTS) */
55
56#ifdef TOR_UNIT_TESTS
57
58void authdir_init_fingerprint_list(void);
59
60authdir_config_t *authdir_return_fingerprint_list(void);
61
62#endif /* defined(TOR_UNIT_TESTS) */
63
65
66#ifdef HAVE_MODULE_DIRAUTH
69 const char *desc, size_t desclen,
70 uint8_t purpose,
71 const char *source,
72 const char **msg);
74 const char **msg,
75 const char *source);
76
78 const vote_routerstatus_t *vrs);
79int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
80 int complain,
81 int *valid_out);
83 const ed25519_public_key_t *edkey);
84uint32_t dirserv_router_get_status(const routerinfo_t *router,
85 const char **msg,
86 int severity);
88 uint32_t authstatus);
89#else /* !defined(HAVE_MODULE_DIRAUTH) */
90static inline int
92{
93 return 0;
94}
95static inline enum was_router_added_t
96dirserv_add_multiple_descriptors(const char *desc, size_t desclen,
97 uint8_t purpose,
98 const char *source,
99 const char **msg)
100{
101 (void)desc;
102 (void)desclen;
103 (void)purpose;
104 (void)source;
105 *msg = "No directory authority support";
106 return (enum was_router_added_t)0;
107}
108static inline enum was_router_added_t
110 const char **msg,
111 const char *source)
112{
113 (void)ri;
114 (void)source;
115 *msg = "No directory authority support";
116 return (enum was_router_added_t)0;
117}
118static inline int
120 const vote_routerstatus_t *vrs)
121{
122 (void)rs;
123 (void)vrs;
124 return 0;
125}
126static inline int
127authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
128 int complain,
129 int *valid_out)
130{
131 (void)ri;
132 (void)complain;
133 *msg = "No directory authority support";
134 *valid_out = 0;
135 return 0;
136}
137static inline int
139{
140 (void)pk;
141 (void)edkey;
142 return 0;
143}
144static inline uint32_t
146 const char **msg,
147 int severity)
148{
149 (void)router;
150 (void)severity;
151 if (msg)
152 *msg = "No directory authority support";
153 return 0;
154}
155static inline void
157 uint32_t authstatus)
158{
159 (void)node;
160 (void)authstatus;
161}
162#endif /* defined(HAVE_MODULE_DIRAUTH) */
163
164#ifdef TOR_UNIT_TESTS
166STATIC bool dirserv_rejects_tor_version(const char *platform,
167 const char **msg);
168#endif /* defined(TOR_UNIT_TESTS) */
169
170#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