tor  0.4.1.1-alpha-dev
Macros | Functions
describe.c File Reference
#include "core/or/or.h"
#include "feature/nodelist/describe.h"
#include "feature/nodelist/routerinfo.h"
#include "core/or/extend_info_st.h"
#include "feature/nodelist/node_st.h"
#include "feature/nodelist/routerinfo_st.h"
#include "feature/nodelist/routerstatus_st.h"

Go to the source code of this file.

Macros

#define NODE_DESC_BUF_LEN   (MAX_VERBOSE_NICKNAME_LEN+4+TOR_ADDR_BUF_LEN)
 

Functions

static const char * format_node_description (char *buf, const char *id_digest, int is_named, const char *nickname, const tor_addr_t *addr, uint32_t addr32h)
 
const char * router_describe (const routerinfo_t *ri)
 
const char * node_describe (const node_t *node)
 
const char * routerstatus_describe (const routerstatus_t *rs)
 
const char * extend_info_describe (const extend_info_t *ei)
 
void router_get_verbose_nickname (char *buf, const routerinfo_t *router)
 

Detailed Description

Format short descriptions of relays.

Definition in file describe.c.

Macro Definition Documentation

◆ NODE_DESC_BUF_LEN

#define NODE_DESC_BUF_LEN   (MAX_VERBOSE_NICKNAME_LEN+4+TOR_ADDR_BUF_LEN)

Longest allowed output of format_node_description, plus 1 character for NUL. This allows space for: "$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at" " [ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]" plus a terminating NUL.

Definition at line 28 of file describe.c.

Function Documentation

◆ extend_info_describe()

const char* extend_info_describe ( const extend_info_t ei)

Return a human-readable description of the extend_info_t ei.

This function is not thread-safe. Each call to this function invalidates previous values returned by this function.

Definition at line 154 of file describe.c.

References extend_info_t::addr, format_node_description(), extend_info_t::identity_digest, extend_info_t::nickname, and NODE_DESC_BUF_LEN.

◆ format_node_description()

static const char* format_node_description ( char *  buf,
const char *  id_digest,
int  is_named,
const char *  nickname,
const tor_addr_t addr,
uint32_t  addr32h 
)
static

Use buf (which must be at least NODE_DESC_BUF_LEN bytes long) to hold a human-readable description of a node with identity digest id_digest, named-status is_named, nickname nickname, and address addr or addr32h.

The nickname and addr fields are optional and may be set to NULL. The addr32h field is optional and may be set to 0.

Return a pointer to the front of buf.

Definition at line 41 of file describe.c.

References base16_encode(), DIGEST_LEN, and HEX_DIGEST_LEN.

Referenced by extend_info_describe(), node_describe(), router_describe(), and routerstatus_describe().

◆ node_describe()

const char* node_describe ( const node_t node)

Return a human-readable description of the node_t node.

This function is not thread-safe. Each call to this function invalidates previous values returned by this function.

Definition at line 101 of file describe.c.

References routerinfo_t::addr, routerstatus_t::addr, format_node_description(), node_t::identity, routerstatus_t::is_named, routerstatus_t::nickname, routerinfo_t::nickname, and NODE_DESC_BUF_LEN.

◆ router_describe()

const char* router_describe ( const routerinfo_t ri)

Return a human-readable description of the routerinfo_t ri.

This function is not thread-safe. Each call to this function invalidates previous values returned by this function.

Definition at line 81 of file describe.c.

References routerinfo_t::addr, format_node_description(), signed_descriptor_t::identity_digest, routerinfo_t::nickname, and NODE_DESC_BUF_LEN.

Referenced by directory_remove_invalid().

◆ router_get_verbose_nickname()

void router_get_verbose_nickname ( char *  buf,
const routerinfo_t router 
)

Set buf (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the verbose representation of the identity of router. The format is: A dollar sign. The upper-case hexadecimal encoding of the SHA1 hash of router's identity. A "=" if the router is named (no longer implemented); a "~" if it is not. The router's nickname.

Definition at line 176 of file describe.c.

References base16_encode(), DIGEST_LEN, HEX_DIGEST_LEN, and signed_descriptor_t::identity_digest.

Referenced by list_server_status_v1().

◆ routerstatus_describe()

const char* routerstatus_describe ( const routerstatus_t rs)

Return a human-readable description of the routerstatus_t rs.

This function is not thread-safe. Each call to this function invalidates previous values returned by this function.

Definition at line 134 of file describe.c.

References routerstatus_t::addr, format_node_description(), routerstatus_t::identity_digest, routerstatus_t::is_named, routerstatus_t::nickname, and NODE_DESC_BUF_LEN.