tor  0.4.1.0-alpha-dev
Functions
process_descs.h File Reference

Go to the source code of this file.

Functions

int dirserv_load_fingerprint_file (void)
 
void dirserv_free_fingerprint_list (void)
 
int dirserv_add_own_fingerprint (crypto_pk_t *pk)
 
enum was_router_added_t dirserv_add_multiple_descriptors (const char *desc, size_t desclen, uint8_t purpose, const char *source, const char **msg)
 
enum was_router_added_t dirserv_add_descriptor (routerinfo_t *ri, const char **msg, const char *source)
 
int authdir_wants_to_reject_router (routerinfo_t *ri, const char **msg, int complain, int *valid_out)
 
uint32_t dirserv_router_get_status (const routerinfo_t *router, const char **msg, int severity)
 
void dirserv_set_node_flags_from_authoritative_status (node_t *node, uint32_t authstatus)
 
int dirserv_would_reject_router (const routerstatus_t *rs)
 

Detailed Description

Header file for process_descs.c.

Definition in file process_descs.h.

Function Documentation

◆ authdir_wants_to_reject_router()

int authdir_wants_to_reject_router ( routerinfo_t ri,
const char **  msg,
int  complain,
int *  valid_out 
)

Check whether we, as a directory server, want to accept ri. If so, set its is_valid,running fields and return 0. Otherwise, return -1.

If the router is rejected, set *msg to an explanation of why.

If complain then explain at log-level 'notice' why we refused a descriptor; else explain at log-level 'info'.

Definition at line 452 of file process_descs.c.

References routerinfo_t::contact_info, LOG_INFO, and LOG_NOTICE.

◆ dirserv_add_descriptor()

enum was_router_added_t dirserv_add_descriptor ( routerinfo_t ri,
const char **  msg,
const char *  source 
)

Examine the parsed server descriptor in ri and maybe insert it into the list of server descriptors. Set *msg to a message that should be passed back to the origin of this descriptor, or NULL if there is no such message. Use source to produce better log messages.

If ri is not added to the list of server descriptors, free it. That means the caller must not access ri after this function returns, since it might have been freed.

Return the status of the operation.

This function is only called when fresh descriptors are posted, not when we re-load the cache.

Definition at line 620 of file process_descs.c.

References signed_descriptor_t::annotations_len, MAX_DESCRIPTOR_UPLOAD_SIZE, and signed_descriptor_t::signed_descriptor_len.

◆ dirserv_add_multiple_descriptors()

enum was_router_added_t dirserv_add_multiple_descriptors ( const char *  desc,
size_t  desclen,
uint8_t  purpose,
const char *  source,
const char **  msg 
)

As for dirserv_add_descriptor(), but accepts multiple documents, and returns the most severe error that occurred for any one of them.

Definition at line 522 of file process_descs.c.

References ROUTER_ANNOTATION_BUF_LEN.

◆ dirserv_add_own_fingerprint()

int dirserv_add_own_fingerprint ( crypto_pk_t pk)

Add the fingerprint for this OR to the global list of recognized identity key fingerprints.

Definition at line 127 of file process_descs.c.

References crypto_pk_get_fingerprint(), and FINGERPRINT_LEN.

◆ dirserv_free_fingerprint_list()

void dirserv_free_fingerprint_list ( void  )

Clear the current fingerprint list.

Definition at line 410 of file process_descs.c.

References fingerprint_list.

◆ dirserv_load_fingerprint_file()

int dirserv_load_fingerprint_file ( void  )

Load the nickname->fingerprint mappings stored in the approved-routers file. The file format is line-based, with each non-blank holding one nickname, some space, and a fingerprint for that nickname. On success, replace the current fingerprint list with the new list and return 0. On failure, leave the current fingerprint list untouched, and return -1.

Definition at line 146 of file process_descs.c.

◆ dirserv_router_get_status()

uint32_t dirserv_router_get_status ( const routerinfo_t router,
const char **  msg,
int  severity 
)

Check whether router has a nickname/identity key combination that we recognize from the fingerprint list, or an IP we automatically act on according to our configuration. Return the appropriate router status.

If the status is 'FP_REJECT' and msg is provided, set *msg to an explanation of why.

Definition at line 226 of file process_descs.c.

References crypto_pk_get_digest(), DIGEST_LEN, and routerinfo_t::identity_pkey.

Referenced by directory_remove_invalid().

◆ dirserv_set_node_flags_from_authoritative_status()

void dirserv_set_node_flags_from_authoritative_status ( node_t node,
uint32_t  authstatus 
)

Update the relevant flags of node based on our opinion as a directory authority in authstatus, as returned by dirserv_router_get_status or equivalent.

Definition at line 505 of file process_descs.c.

References FP_BADEXIT, FP_INVALID, node_t::is_bad_exit, and node_t::is_valid.

◆ dirserv_would_reject_router()

int dirserv_would_reject_router ( const routerstatus_t rs)

Return true if there is no point in downloading the router described by rs because this directory would reject it.

Definition at line 302 of file process_descs.c.

References routerstatus_t::addr, dirserv_get_status_impl(), FP_REJECT, routerstatus_t::identity_digest, LOG_DEBUG, routerstatus_t::nickname, and routerstatus_t::or_port.