Tor  0.4.8.0-alpha-dev
dirlist.h
Go to the documentation of this file.
1 /* Copyright (c) 2001-2004, Roger Dingledine.
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2021, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 /**
7  * \file dirlist.h
8  * \brief Header file for dirlist.c
9  **/
10 
11 #ifndef TOR_DIRLIST_H
12 #define TOR_DIRLIST_H
13 
14 typedef struct auth_dirport_t auth_dirport_t;
15 /**
16  * Different usages for an authority's HTTP directory port.
17  *
18  * Historically, only legacy ports existed; proposal 330 added multiple types
19  * of dirport to better enable authorities to offload work and resist DoS
20  * attacks.
21  **/
22 typedef enum auth_dirport_usage_t {
23  /** Flag for an authority's dirport that is intended for misc/legacy
24  * usage. May be used when no other dirport is available. */
26  /** Flag for an authority's dirport that is intended for descriptor uploads
27  * only. */
29  /** Flag for an authority's dirport that is intended for voting only */
31  /** Flag for an authority's dirport that is intended for relay downloads
32  * only. */
35 
37 const smartlist_t *router_get_trusted_dir_servers(void);
38 const smartlist_t *router_get_fallback_dir_servers(void);
40 smartlist_t *router_get_fallback_dir_servers_mutable(void);
41 void mark_all_dirservers_up(smartlist_t *server_list);
42 
44 
47  const char *digest);
48 int router_digest_is_fallback_dir(const char *digest);
50  (const char *d));
51 
53  (const char *digest, dirinfo_type_t type));
54 
57  int addr_family);
59  const dir_server_t *ds,
61  int addr_family);
62 
64  dirinfo_type_t type);
65 #define router_addr_is_trusted_dir(d) \
66  router_addr_is_trusted_dir_type((d), NO_DIRINFO)
67 
68 #define router_digest_is_trusted_dir(d) \
69  router_digest_is_trusted_dir_type((d), NO_DIRINFO)
70 
71 dir_server_t *trusted_dir_server_new(const char *nickname, const char *address,
72  uint16_t dir_port, uint16_t or_port,
73  const tor_addr_port_t *addrport_ipv6,
74  const char *digest, const char *v3_auth_digest,
75  dirinfo_type_t type, double weight);
78  const tor_addr_port_t *dirport);
80  uint16_t dir_port, uint16_t or_port,
81  const tor_addr_port_t *addrport_ipv6,
82  const char *id_digest, double weight);
83 void dir_server_add(dir_server_t *ent);
84 
85 void clear_dir_servers(void);
86 void dirlist_free_all(void);
87 
89 
90 #endif /* !defined(TOR_DIRLIST_H) */
dir_server_t * fallback_dir_server_new(const tor_addr_t *addr, uint16_t dir_port, uint16_t or_port, const tor_addr_port_t *addrport_ipv6, const char *id_digest, double weight)
Definition: dirlist.c:553
bool router_addr_is_trusted_dir_type(const tor_addr_t *addr, dirinfo_type_t type)
Definition: dirlist.c:277
auth_dirport_usage_t
Definition: dirlist.h:22
@ AUTH_USAGE_VOTING
Definition: dirlist.h:30
@ AUTH_USAGE_DOWNLOAD
Definition: dirlist.h:33
@ AUTH_USAGE_LEGACY
Definition: dirlist.h:25
@ AUTH_USAGE_UPLOAD
Definition: dirlist.h:28
void trusted_dir_server_add_dirport(dir_server_t *ds, auth_dirport_usage_t usage, const tor_addr_port_t *dirport)
Definition: dirlist.c:477
void mark_all_dirservers_up(smartlist_t *server_list)
Definition: dirlist.c:232
int get_n_authorities(dirinfo_type_t type)
Definition: dirlist.c:103
dir_server_t * trusteddirserver_get_by_v3_auth_digest(const char *d)
Definition: dirlist.c:215
const tor_addr_port_t * trusted_dir_server_get_dirport_exact(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
Definition: dirlist.c:503
int router_digest_is_trusted_dir_type(const char *digest, dirinfo_type_t type)
Definition: dirlist.c:256
void clear_dir_servers(void)
Definition: dirlist.c:600
auth_dirport_usage_t auth_dirport_usage_for_purpose(int purpose)
Definition: dirlist.c:304
const tor_addr_port_t * trusted_dir_server_get_dirport(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
Definition: dirlist.c:529
void dir_server_add(dir_server_t *ent)
Definition: dirlist.c:564
int router_digest_is_fallback_dir(const char *digest)
Definition: dirlist.c:205
void dirlist_add_trusted_dir_addresses(void)
Definition: dirlist.c:87
dir_server_t * router_get_fallback_dirserver_by_digest(const char *digest)
Definition: dirlist.c:181
dir_server_t * trusted_dir_server_new(const char *nickname, const char *address, uint16_t dir_port, uint16_t or_port, const tor_addr_port_t *addrport_ipv6, const char *digest, const char *v3_auth_digest, dirinfo_type_t type, double weight)
Definition: dirlist.c:419
smartlist_t * router_get_trusted_dir_servers_mutable(void)
Definition: dirlist.c:119
dir_server_t * router_get_trusteddirserver_by_digest(const char *d)
Definition: dirlist.c:160
dirinfo_type_t
Definition: or.h:775
tor_addr_port_t dirport
Definition: dirlist.c:51
auth_dirport_usage_t usage
Definition: dirlist.c:49
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127