mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-28 00:53:04 +01:00
This changes a LOT of code but in the end, behavior is the same. Unfortunately, many functions had to be changed to accomodate but in majority of cases, to become simpler. Functions are also removed specifically those that were there to convert an IPv4 as a host format to a tor_addr_t. Those are not needed anymore. The IPv4 address field has been standardized to "ipv4_addr", the ORPort to "ipv4_orport" (currently IPv6 uses ipv6_orport) and DirPort to "ipv4_dirport". This is related to Sponsor 55 work that adds IPv6 support for relays and this work is needed in order to have a common interface between IPv4 and IPv6. Closes #40043. Signed-off-by: David Goulet <dgoulet@torproject.org>
57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
/* Copyright (c) 2001 Matej Pfajfar.
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
|
* Copyright (c) 2007-2020, The Tor Project, Inc. */
|
|
/* 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);
|
|
|
|
void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
|
|
|
|
#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 *ipv6_addr,
|
|
const tor_addr_t *ipv4_addr);
|
|
|
|
#endif /* defined(TOR_UNIT_TESTS) */
|
|
|
|
#endif /* !defined(TOR_DESCRIBE_H) */
|