tor  0.4.1.0-alpha-dev
Macros | Functions
dirlist.h File Reference

Go to the source code of this file.

Macros

#define router_digest_is_trusted_dir(d)   router_digest_is_trusted_dir_type((d), NO_DIRINFO)
 

Functions

int get_n_authorities (dirinfo_type_t type)
 
const smartlist_trouter_get_trusted_dir_servers (void)
 
const smartlist_trouter_get_fallback_dir_servers (void)
 
smartlist_trouter_get_trusted_dir_servers_mutable (void)
 
smartlist_trouter_get_fallback_dir_servers_mutable (void)
 
void mark_all_dirservers_up (smartlist_t *server_list)
 
dir_server_trouter_get_trusteddirserver_by_digest (const char *d)
 
dir_server_trouter_get_fallback_dirserver_by_digest (const char *digest)
 
int router_digest_is_fallback_dir (const char *digest)
 
 MOCK_DECL (dir_server_t *, trusteddirserver_get_by_v3_auth_digest,(const char *d))
 
int router_digest_is_trusted_dir_type (const char *digest, dirinfo_type_t type)
 
dir_server_ttrusted_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)
 
dir_server_tfallback_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)
 
void dir_server_add (dir_server_t *ent)
 
void clear_dir_servers (void)
 
void dirlist_free_all (void)
 

Detailed Description

Header file for dirlist.c.

Definition in file dirlist.h.

Function Documentation

◆ clear_dir_servers()

void clear_dir_servers ( void  )

Remove all members from the list of dir servers.

Definition at line 398 of file dirlist.c.

References fallback_dir_servers, and SMARTLIST_FOREACH.

◆ dir_server_add()

void dir_server_add ( dir_server_t ent)

Add a directory server to the global list(s).

Definition at line 366 of file dirlist.c.

References fallback_dir_servers, dir_server_t::is_authority, router_dir_info_changed(), smartlist_add(), and trusted_dir_servers.

◆ fallback_dir_server_new()

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 
)

Return a new dir_server_t for a fallback directory server at addr:or_port/dir_port, with identity key digest id_digest

Definition at line 353 of file dirlist.c.

References dir_server_new().

◆ get_n_authorities()

int get_n_authorities ( dirinfo_type_t  type)

Return the number of directory authorities whose type matches some bit set in type

Definition at line 55 of file dirlist.c.

Referenced by fetch_bridge_descriptors(), and networkstatus_check_consensus_signature().

◆ mark_all_dirservers_up()

void mark_all_dirservers_up ( smartlist_t server_list)

◆ router_digest_is_fallback_dir()

int router_digest_is_fallback_dir ( const char *  digest)

Return 1 if any fallback dirserver's identity key hashes to digest, or 0 if no such fallback is in the list of fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir and UseDefaultFallbackDirs torrc options.) The list of fallback directories includes the list of authorities.

Definition at line 157 of file dirlist.c.

References router_get_fallback_dirserver_by_digest().

◆ router_digest_is_trusted_dir_type()

int router_digest_is_trusted_dir_type ( const char *  digest,
dirinfo_type_t  type 
)

Return true iff digest is the digest of the identity key of a trusted directory matching at least one bit of type. If type is zero (NO_DIRINFO), or ALL_DIRINFO, any authority is okay.

Definition at line 208 of file dirlist.c.

◆ router_get_fallback_dirserver_by_digest()

dir_server_t* router_get_fallback_dirserver_by_digest ( const char *  digest)

Return the dir_server_t for the fallback dirserver whose identity key hashes to digest, or NULL if no such fallback is in the list of fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir and UseDefaultFallbackDirs torrc options.) The list of fallback directories includes the list of authorities.

Definition at line 133 of file dirlist.c.

References DIGEST_LEN, fallback_dir_servers, SMARTLIST_FOREACH, and tor_memeq().

Referenced by router_digest_is_fallback_dir().

◆ router_get_trusted_dir_servers_mutable()

smartlist_t* router_get_trusted_dir_servers_mutable ( void  )

Return a smartlist containing a list of dir_server_t * for all known trusted dirservers. Callers must not modify the list or its contents.

Definition at line 71 of file dirlist.c.

References trusted_dir_servers.

◆ router_get_trusteddirserver_by_digest()

dir_server_t* router_get_trusteddirserver_by_digest ( const char *  digest)

Return the dir_server_t for the directory authority whose identity key hashes to digest, or NULL if no such authority is known.

Definition at line 112 of file dirlist.c.

References DIGEST_LEN, SMARTLIST_FOREACH, tor_memeq(), and trusted_dir_servers.

◆ trusted_dir_server_new()

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 ipv6_addrport,
const char *  digest,
const char *  v3_auth_digest,
dirinfo_type_t  type,
double  weight 
)

Create an authoritative directory server at address:port, with identity key digest. If address is NULL, add ourself. Return the new trusted directory server entry on success or NULL if we couldn't add it.

Definition at line 308 of file dirlist.c.