2018-09-25 16:13:47 -04:00
|
|
|
/* Copyright (c) 2001 Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2020-01-08 18:39:17 -05:00
|
|
|
* Copyright (c) 2007-2020, The Tor Project, Inc. */
|
2018-09-25 16:13:47 -04:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file describe.h
|
|
|
|
* \brief Header file for describe.c.
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef TOR_DESCRIBE_H
|
|
|
|
#define TOR_DESCRIBE_H
|
|
|
|
|
|
|
|
struct extend_info_t;
|
|
|
|
struct node_t;
|
|
|
|
struct routerinfo_t;
|
|
|
|
struct routerstatus_t;
|
|
|
|
|
|
|
|
const char *extend_info_describe(const struct extend_info_t *ei);
|
|
|
|
const char *node_describe(const struct node_t *node);
|
|
|
|
const char *router_describe(const struct routerinfo_t *ri);
|
|
|
|
const char *routerstatus_describe(const struct routerstatus_t *ri);
|
|
|
|
|
2019-08-19 16:26:28 +10:00
|
|
|
void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
|
|
|
|
|
2019-08-19 16:35:24 +10:00
|
|
|
#if defined(DESCRIBE_PRIVATE) || defined(TOR_UNIT_TESTS)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Longest allowed output for an IPv4 address "255.255.255.255", with NO
|
|
|
|
* terminating NUL.
|
|
|
|
*/
|
|
|
|
#define IPV4_BUF_LEN_NO_NUL 15
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Longest allowed output of format_node_description, plus 1 character for
|
|
|
|
* NUL. This allows space for:
|
|
|
|
* "$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at"
|
|
|
|
* " 255.255.255.255 and [ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]"
|
|
|
|
* plus a terminating NUL.
|
|
|
|
*/
|
|
|
|
#define NODE_DESC_BUF_LEN \
|
|
|
|
(MAX_VERBOSE_NICKNAME_LEN+4+IPV4_BUF_LEN_NO_NUL+5+TOR_ADDR_BUF_LEN)
|
|
|
|
|
|
|
|
#endif /* defined(DESCRIBE_PRIVATE) || defined(TOR_UNIT_TESTS) */
|
|
|
|
|
|
|
|
#ifdef TOR_UNIT_TESTS
|
|
|
|
|
|
|
|
STATIC const char *format_node_description(char *buf,
|
|
|
|
const char *id_digest,
|
|
|
|
const char *nickname,
|
|
|
|
const tor_addr_t *addr,
|
|
|
|
uint32_t addr32h);
|
|
|
|
|
|
|
|
#endif /* defined(TOR_UNIT_TESTS) */
|
|
|
|
|
2019-06-05 09:33:35 -04:00
|
|
|
#endif /* !defined(TOR_DESCRIBE_H) */
|