Tor 0.4.9.13
Loading...
Searching...
No Matches
address.h
Go to the documentation of this file.
1/* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
4/* See LICENSE for licensing information */
5
6/**
7 * \file address.h
8 * \brief Headers for address.h
9 **/
10
11#ifndef TOR_ADDRESS_H
12#define TOR_ADDRESS_H
13
14#include "orconfig.h"
15#include "lib/cc/torint.h"
16#include "lib/log/util_bug.h"
17#include "lib/net/inaddr_st.h"
18#include "lib/net/nettypes.h"
19
20#ifdef HAVE_NETINET_IN_H
21#include <netinet/in.h>
22#endif
23#ifdef _WIN32
24#include <winsock2.h>
25#include <windows.h>
26#endif
27
28#include <stddef.h>
29#include <stdlib.h>
30
31#ifdef ADDRESS_PRIVATE
32
33#if defined(HAVE_SYS_IOCTL_H)
34#include <sys/ioctl.h>
35#endif
36
37#ifdef HAVE_GETIFADDRS
38#define HAVE_IFADDRS_TO_SMARTLIST
39#endif
40
41#ifdef _WIN32
42#define HAVE_IP_ADAPTER_TO_SMARTLIST
43#endif
44
45#if defined(SIOCGIFCONF) && defined(HAVE_IOCTL)
46#define HAVE_IFCONF_TO_SMARTLIST
47#endif
48
49#if defined(HAVE_NET_IF_H)
50#include <net/if.h> // for struct ifconf
51#endif
52
53#if defined(HAVE_IFADDRS_TO_SMARTLIST)
54#include <ifaddrs.h>
55#endif
56
57// TODO win32 specific includes
58#endif /* defined(ADDRESS_PRIVATE) */
59
60/** The number of bits from an address to consider while doing a masked
61 * comparison. */
62typedef uint8_t maskbits_t;
63
64struct in_addr;
65
66/** Holds an IPv4 or IPv6 address. (Uses less memory than struct
67 * sockaddr_storage.) */
68typedef struct tor_addr_t
69{
70 sa_family_t family;
71 union {
72 uint32_t dummy_; /* This field is here so we have something to initialize
73 * with a reliable cross-platform type. */
74 struct in_addr in_addr;
75 struct in6_addr in6_addr;
76 } addr;
78
79/** Holds an IP address and a TCP/UDP port. */
80typedef struct tor_addr_port_t
81{
82 tor_addr_t addr;
83 uint16_t port;
85
86#define TOR_ADDR_NULL {AF_UNSPEC, {0}}
87
88/* XXXX To do: extract all of the functions here that can possibly invoke
89 * XXXX resolver, and make sure they have distinctive names. */
90
91static inline const struct in6_addr *tor_addr_to_in6(const tor_addr_t *a);
92static inline const struct in6_addr *tor_addr_to_in6_assert(
93 const tor_addr_t *a);
94static inline uint32_t tor_addr_to_ipv4n(const tor_addr_t *a);
95static inline uint32_t tor_addr_to_ipv4h(const tor_addr_t *a);
96static inline uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a);
97static inline sa_family_t tor_addr_family(const tor_addr_t *a);
98static inline bool tor_addr_is_unspec(const tor_addr_t *a);
99static inline const struct in_addr *tor_addr_to_in(const tor_addr_t *a);
100static inline int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u);
101
102socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port,
103 struct sockaddr *sa_out, socklen_t len);
104int tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa,
105 uint16_t *port_out);
108#define tor_addr_port_make_null(addr, port, family) \
109 (void)(tor_addr_make_null(addr, family), (port) = 0)
110#define tor_addr_port_make_null_ap(ap, family) \
111 tor_addr_port_make_null(&(ap)->addr, (ap)->port, family)
112char *tor_sockaddr_to_str(const struct sockaddr *sa);
113
114bool name_is_valid_for_dns(const char *name);
115
116/** Return an in6_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
117 * an IPv6 address. */
118static inline const struct in6_addr *
120{
121 return a->family == AF_INET6 ? &a->addr.in6_addr : NULL;
122}
123
124/** As tor_addr_to_in6, but assert that the address truly is an IPv6
125 * address. */
126static inline const struct in6_addr *
128{
129 tor_assert(a->family == AF_INET6);
130 return &a->addr.in6_addr;
131}
132
133/** Given an IPv6 address <b>x</b>, yield it as an array of uint8_t.
134 *
135 * Requires that <b>x</b> is actually an IPv6 address.
136 */
137#define tor_addr_to_in6_addr8(x) tor_addr_to_in6_assert(x)->s6_addr
138
139/** Given an IPv6 address <b>x</b>, yield it as an array of uint16_t.
140 *
141 * Requires that <b>x</b> is actually an IPv6 address.
142 */
143#define tor_addr_to_in6_addr16(x) S6_ADDR16(*tor_addr_to_in6_assert(x))
144
145/** Given an IPv6 address <b>x</b>, yield it as an array of uint32_t.
146 *
147 * Requires that <b>x</b> is actually an IPv6 address.
148 */
149#define tor_addr_to_in6_addr32(x) S6_ADDR32(*tor_addr_to_in6_assert(x))
150
151/** Return an IPv4 address in network order for <b>a</b>, or 0 if
152 * <b>a</b> is not an IPv4 address. */
153static inline uint32_t
155{
156 return a->family == AF_INET ? a->addr.in_addr.s_addr : 0;
157}
158
159/** Return an IPv4 address in host order for <b>a</b>, or 0 if
160 * <b>a</b> is not an IPv4 address. */
161static inline uint32_t
163{
164 return ntohl(tor_addr_to_ipv4n(a));
165}
166
167/** Given an IPv6 address, return its mapped IPv4 address in host order, or
168 * 0 if <b>a</b> is not an IPv6 address.
169 *
170 * (Does not check whether the address is really a mapped address.) */
171static inline uint32_t
173{
174 if (a->family == AF_INET6) {
175 uint32_t *addr32 = NULL;
176 // Work around an incorrect NULL pointer dereference warning in
177 // "clang --analyze" due to limited analysis depth
178 addr32 = tor_addr_to_in6_addr32(a);
179 tor_assert(addr32);
180 return ntohl(addr32[3]);
181 } else {
182 return 0;
183 }
184}
185
186/** Return the address family of <b>a</b>. Possible values are:
187 * AF_INET6, AF_INET, AF_UNSPEC, AF_UNIX. */
188static inline sa_family_t
190{
191 return a->family;
192}
193
194/**
195 * Return true if the address @a is in the UNSPEC family.
196 **/
197static inline bool
199{
200 return a->family == AF_UNSPEC;
201}
202
203/** Return an in_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
204 * an IPv4 address. */
205static inline const struct in_addr *
207{
208 return a->family == AF_INET ? &a->addr.in_addr : NULL;
209}
210
211/** Return true iff <b>a</b> is an IPv4 address equal to the host-ordered
212 * address in <b>u</b>. */
213static inline int
214tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
215{
216 return a->family == AF_INET ? (tor_addr_to_ipv4h(a) == u) : 0;
217}
218
219/** Length of a buffer that you need to allocate to be sure you can encode
220 * any tor_addr_t.
221 *
222 * This allows enough space for
223 * "[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]",
224 * plus a terminating NUL.
225 */
226#define TOR_ADDR_BUF_LEN 48
227
228/** Length of a buffer containing an IP address along with a port number and
229 * a separating colon.
230 *
231 * This allows enough space for
232 * "[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]:12345",
233 * plus a terminating NUL.
234 */
235#define TOR_ADDRPORT_BUF_LEN (TOR_ADDR_BUF_LEN + 6)
236
237char *tor_addr_to_str_dup(const tor_addr_t *addr) ATTR_MALLOC;
238
239/** Wrapper function of fmt_addr_impl(). It does not decorate IPv6
240 * addresses. */
241#define fmt_addr(a) fmt_addr_impl((a), 0)
242
243/** Wrapper function of fmt_addr_impl(). It decorates IPv6
244 * addresses. */
245#define fmt_and_decorate_addr(a) fmt_addr_impl((a), 1)
246
247const char *fmt_addr_impl(const tor_addr_t *addr, int decorate);
248const char *fmt_addrport(const tor_addr_t *addr, uint16_t port);
249#define fmt_addrport_ap(ap) fmt_addrport(&(ap)->addr, (ap)->port)
250const char *fmt_addr32(uint32_t addr);
251const char *fmt_addr32_port(uint32_t addr, uint16_t port);
252const char *fmt_af_family(sa_family_t family);
253const char *fmt_addr_family(const tor_addr_t *addr);
254
255MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family,
256tor_addr_t *addr));
257
258struct smartlist_t;
259void interface_address6_list_free_(struct smartlist_t * addrs);
260#define interface_address6_list_free(addrs) \
261 FREE_AND_NULL(struct smartlist_t, interface_address6_list_free_, (addrs))
262
264 sa_family_t family,
265 int include_internal));
266
267/** Flag to specify how to do a comparison between addresses. In an "exact"
268 * comparison, addresses are equivalent only if they are in the same family
269 * with the same value. In a "semantic" comparison, IPv4 addresses match all
270 * IPv6 encodings of those addresses. */
271typedef enum {
272 CMP_EXACT,
273 CMP_SEMANTIC,
275
276int tor_addr_compare(const tor_addr_t *addr1, const tor_addr_t *addr2,
278int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
280/** Return true iff a and b are the same address. The comparison is done
281 * "exactly". */
282#define tor_addr_eq(a,b) (0==tor_addr_compare((a),(b),CMP_EXACT))
283
284uint64_t tor_addr_hash(const tor_addr_t *addr);
285struct sipkey;
286uint64_t tor_addr_keyed_hash(const struct sipkey *key, const tor_addr_t *addr);
287
288int tor_addr_is_v4(const tor_addr_t *addr);
289int tor_addr_is_v6(const tor_addr_t *addr);
290int tor_addr_is_internal_(const tor_addr_t *ip, int for_listening,
291 const char *filename, int lineno);
292#define tor_addr_is_internal(addr, for_listening) \
293 tor_addr_is_internal_((addr), (for_listening), SHORT_FILE__, __LINE__)
295
296/** Longest length that can be required for a reverse lookup name. */
297/* 32 nybbles, 32 dots, 8 characters of "ip6.arpa", 1 NUL: 73 characters. */
298#define REVERSE_LOOKUP_NAME_BUF_LEN 73
299int tor_addr_to_PTR_name(char *out, size_t outlen,
300 const tor_addr_t *addr);
301int tor_addr_parse_PTR_name(tor_addr_t *result, const char *address,
302 int family, int accept_regular);
303
304/* Does the address * yield an AF_UNSPEC wildcard address (1),
305 * which expands to corresponding wildcard IPv4 and IPv6 rules, and do we
306 * allow *4 and *6 for IPv4 and IPv6 wildcards, respectively;
307 * or does the address * yield IPv4 wildcard address (0). */
308#define TAPMP_EXTENDED_STAR 1
309/* Does the address * yield an IPv4 wildcard address rule (1);
310 * or does it yield wildcard IPv4 and IPv6 rules (0) */
311#define TAPMP_STAR_IPV4_ONLY (1 << 1)
312/* Does the address * yield an IPv6 wildcard address rule (1);
313 * or does it yield wildcard IPv4 and IPv6 rules (0) */
314#define TAPMP_STAR_IPV6_ONLY (1 << 2)
315/* TAPMP_STAR_IPV4_ONLY and TAPMP_STAR_IPV6_ONLY are mutually exclusive. */
316int tor_addr_parse_mask_ports(const char *s, unsigned flags,
317 tor_addr_t *addr_out, maskbits_t *mask_out,
318 uint16_t *port_min_out, uint16_t *port_max_out);
319
320const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len,
321 int decorate);
322int tor_addr_parse(tor_addr_t *addr, const char *src);
323void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src);
324void tor_addr_copy_tight(tor_addr_t *dest, const tor_addr_t *src);
325
326void tor_addr_from_ipv4n(tor_addr_t *dest, uint32_t v4addr);
327/** Set <b>dest</b> to the IPv4 address encoded in <b>v4addr</b> in host
328 * order. */
329#define tor_addr_from_ipv4h(dest, v4addr) \
330 tor_addr_from_ipv4n((dest), htonl(v4addr))
331void tor_addr_from_ipv6_bytes(tor_addr_t *dest, const uint8_t *bytes);
332/** Set <b>dest</b> to the IPv4 address incoded in <b>in</b>. */
333#define tor_addr_from_in(dest, in) \
334 tor_addr_from_ipv4n((dest), (in)->s_addr);
335void tor_addr_from_in6(tor_addr_t *dest, const struct in6_addr *in6);
336void tor_addr_copy_ipv6_bytes(uint8_t *dest, const tor_addr_t *src);
337
338int tor_addr_is_null(const tor_addr_t *addr);
339int tor_addr_is_loopback(const tor_addr_t *addr);
340
341int tor_addr_is_valid(const tor_addr_t *addr, int for_listening);
342int tor_addr_is_valid_ipv4n(uint32_t v4n_addr, int for_listening);
343#define tor_addr_is_valid_ipv4h(v4h_addr, for_listening) \
344 tor_addr_is_valid_ipv4n(htonl(v4h_addr), (for_listening))
345int tor_port_is_valid(uint16_t port, int for_listening);
346
347/* Are addr and port both valid? */
348#define tor_addr_port_is_valid(addr, port, for_listening) \
349 (tor_addr_is_valid((addr), (for_listening)) && \
350 tor_port_is_valid((port), (for_listening)))
351/* Are ap->addr and ap->port both valid? */
352#define tor_addr_port_is_valid_ap(ap, for_listening) \
353 tor_addr_port_is_valid(&(ap)->addr, (ap)->port, (for_listening))
354/* Are the network-order v4addr and port both valid? */
355#define tor_addr_port_is_valid_ipv4n(v4n_addr, port, for_listening) \
356 (tor_addr_is_valid_ipv4n((v4n_addr), (for_listening)) && \
357 tor_port_is_valid((port), (for_listening)))
358/* Are the host-order v4addr and port both valid? */
359#define tor_addr_port_is_valid_ipv4h(v4h_addr, port, for_listening) \
360 (tor_addr_is_valid_ipv4h((v4h_addr), (for_listening)) && \
361 tor_port_is_valid((port), (for_listening)))
362
363int tor_addr_port_split(int severity, const char *addrport,
364 char **address_out, uint16_t *port_out);
365
366int tor_addr_port_parse(int severity, const char *addrport,
367 tor_addr_t *address_out, uint16_t *port_out,
368 int default_port);
369
370int tor_addr_hostname_is_local(const char *name);
371
372/* IPv4 helpers */
373int parse_port_range(const char *port, uint16_t *port_min_out,
374 uint16_t *port_max_out);
375int addr_mask_get_bits(uint32_t mask);
376char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
377
378MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr));
379#define interface_address_list_free(lst)\
380 interface_address6_list_free(lst)
381
382/** Return a smartlist of the IPv4 addresses of all interfaces on the server.
383 * Excludes loopback and multicast addresses. Only includes internal addresses
384 * if include_internal is true. (Note that a relay behind NAT may use an
385 * internal address to connect to the Internet.)
386 * An empty smartlist means that there are no IPv4 addresses.
387 * Returns NULL on failure.
388 * Use free_interface_address_list to free the returned list.
389 */
390static inline struct smartlist_t *
391get_interface_address_list(int severity, int include_internal)
392{
393 return get_interface_address6_list(severity, AF_INET, include_internal);
394}
395
396tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port);
398 const tor_addr_port_t *b);
399void tor_addr_port_copy(tor_addr_port_t *dest, const tor_addr_port_t *source);
400
401int string_is_valid_dest(const char *string);
402int string_is_valid_nonrfc_hostname(const char *string);
403int string_is_valid_ipv4_address(const char *string);
404int string_is_valid_ipv6_address(const char *string);
405
406#ifdef ADDRESS_PRIVATE
408 sa_family_t family));
410 sa_family_t family,
411 tor_addr_t *addr));
412STATIC ssize_t valid_dns_name_encoded_len(const char *name);
413
414#ifdef HAVE_IFADDRS_TO_SMARTLIST
415STATIC struct smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa,
416 sa_family_t family);
417STATIC struct smartlist_t *get_interface_addresses_ifaddrs(int severity,
418 sa_family_t family);
419#endif /* defined(HAVE_IFADDRS_TO_SMARTLIST) */
420
421#ifdef HAVE_IP_ADAPTER_TO_SMARTLIST
422STATIC struct smartlist_t *ip_adapter_addresses_to_smartlist(
423 const IP_ADAPTER_ADDRESSES *addresses);
424STATIC struct smartlist_t *get_interface_addresses_win32(int severity,
425 sa_family_t family);
426#endif /* defined(HAVE_IP_ADAPTER_TO_SMARTLIST) */
427
428#ifdef HAVE_IFCONF_TO_SMARTLIST
429STATIC struct smartlist_t *ifreq_to_smartlist(const uint8_t *ifr,
430 size_t buflen);
431STATIC struct smartlist_t *get_interface_addresses_ioctl(int severity,
432 sa_family_t family);
433#endif /* defined(HAVE_IFCONF_TO_SMARTLIST) */
434
435#endif /* defined(ADDRESS_PRIVATE) */
436
437#endif /* !defined(TOR_ADDRESS_H) */
smartlist_t * get_interface_addresses_raw(int severity, sa_family_t family)
Definition address.c:1602
int get_interface_address6_via_udp_socket_hack(int severity, sa_family_t family, tor_addr_t *addr)
Definition address.c:1647
int string_is_valid_ipv6_address(const char *string)
Definition address.c:2144
char * tor_sockaddr_to_str(const struct sockaddr *sa)
Definition address.c:198
uint64_t tor_addr_hash(const tor_addr_t *addr)
Definition address.c:1123
socklen_t tor_addr_to_sockaddr(const tor_addr_t *a, uint16_t port, struct sockaddr *sa_out, socklen_t len)
Definition address.c:113
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
Definition address.c:933
void tor_addr_from_ipv4n(tor_addr_t *dest, uint32_t v4addr)
Definition address.c:889
static uint32_t tor_addr_to_ipv4n(const tor_addr_t *a)
Definition address.h:154
void tor_addr_make_unspec(tor_addr_t *a)
Definition address.c:225
char * tor_dup_ip(uint32_t addr) ATTR_MALLOC
Definition address.c:2047
const char * fmt_addr_impl(const tor_addr_t *addr, int decorate)
Definition address.c:1184
int string_is_valid_ipv4_address(const char *string)
Definition address.c:2133
int tor_addr_hostname_is_local(const char *name)
Definition address.c:2090
static const struct in_addr * tor_addr_to_in(const tor_addr_t *a)
Definition address.h:206
int tor_addr_parse(tor_addr_t *addr, const char *src)
Definition address.c:1349
void tor_addr_make_null(tor_addr_t *a, sa_family_t family)
Definition address.c:235
int tor_addr_port_parse(int severity, const char *addrport, tor_addr_t *address_out, uint16_t *port_out, int default_port)
Definition address.c:1857
static struct smartlist_t * get_interface_address_list(int severity, int include_internal)
Definition address.h:391
int string_is_valid_dest(const char *string)
Definition address.c:2155
tor_addr_port_t * tor_addr_port_new(const tor_addr_t *addr, uint16_t port)
Definition address.c:2100
int tor_addr_is_loopback(const tor_addr_t *addr)
Definition address.c:805
static sa_family_t tor_addr_family(const tor_addr_t *a)
Definition address.h:189
int get_interface_address(int severity, uint32_t *addr)
Definition address.c:2073
int string_is_valid_nonrfc_hostname(const char *string)
Definition address.c:2188
int tor_addr_is_v4(const tor_addr_t *addr)
Definition address.c:750
int tor_addr_compare(const tor_addr_t *addr1, const tor_addr_t *addr2, tor_addr_comparison_t how)
Definition address.c:984
void tor_addr_copy_ipv6_bytes(uint8_t *dest, const tor_addr_t *src)
Definition address.c:920
int tor_addr_port_split(int severity, const char *addrport, char **address_out, uint16_t *port_out)
Definition address.c:1916
int tor_addr_is_null(const tor_addr_t *addr)
Definition address.c:780
int tor_addr_parse_PTR_name(tor_addr_t *result, const char *address, int family, int accept_regular)
Definition address.c:380
void tor_addr_port_copy(tor_addr_port_t *dest, const tor_addr_port_t *source)
Definition address.c:2121
static uint32_t tor_addr_to_ipv4h(const tor_addr_t *a)
Definition address.h:162
static const struct in6_addr * tor_addr_to_in6(const tor_addr_t *a)
Definition address.h:119
int tor_addr_is_multicast(const tor_addr_t *a)
Definition address.c:1624
void tor_addr_from_ipv6_bytes(tor_addr_t *dest, const uint8_t *bytes)
Definition address.c:900
static uint32_t tor_addr_to_mapped_ipv4h(const tor_addr_t *a)
Definition address.h:172
int addr_mask_get_bits(uint32_t mask)
Definition address.c:1975
int tor_addr_parse_mask_ports(const char *s, unsigned flags, tor_addr_t *addr_out, maskbits_t *mask_out, uint16_t *port_min_out, uint16_t *port_max_out)
Definition address.c:543
static const struct in6_addr * tor_addr_to_in6_assert(const tor_addr_t *a)
Definition address.h:127
bool name_is_valid_for_dns(const char *name)
Definition address.c:2340
int get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr)
Definition address.c:1723
int tor_addr_is_v6(const tor_addr_t *addr)
Definition address.c:770
const char * fmt_addrport(const tor_addr_t *addr, uint16_t port)
Definition address.c:1199
tor_addr_comparison_t
Definition address.h:271
void tor_addr_from_in6(tor_addr_t *dest, const struct in6_addr *in6)
Definition address.c:911
uint64_t tor_addr_keyed_hash(const struct sipkey *key, const tor_addr_t *addr)
Definition address.c:1142
#define tor_addr_to_in6_addr32(x)
Definition address.h:149
static int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
Definition address.h:214
static bool tor_addr_is_unspec(const tor_addr_t *a)
Definition address.h:198
const char * fmt_af_family(sa_family_t family)
Definition address.c:1246
void interface_address6_list_free_(struct smartlist_t *addrs)
Definition address.c:1757
void tor_addr_copy_tight(tor_addr_t *dest, const tor_addr_t *src)
Definition address.c:947
const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len, int decorate)
Definition address.c:328
int tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa, uint16_t *port_out)
Definition address.c:165
uint8_t maskbits_t
Definition address.h:62
struct smartlist_t * get_interface_address6_list(int severity, sa_family_t family, int include_internal)
Definition address.c:1777
const char * fmt_addr32_port(uint32_t addr, uint16_t port)
Definition address.c:1233
int tor_addr_is_internal_(const tor_addr_t *ip, int for_listening, const char *filename, int lineno)
Definition address.c:255
const char * fmt_addr32(uint32_t addr)
Definition address.c:1210
char * tor_addr_to_str_dup(const tor_addr_t *addr) ATTR_MALLOC
Definition address.c:1164
int parse_port_range(const char *port, uint16_t *port_min_out, uint16_t *port_max_out)
Definition address.c:1994
int tor_addr_port_eq(const tor_addr_port_t *a, const tor_addr_port_t *b)
Definition address.c:2111
const char * fmt_addr_family(const tor_addr_t *addr)
Definition address.c:1276
int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2, maskbits_t mask, tor_addr_comparison_t how)
Definition address.c:1005
int tor_addr_to_PTR_name(char *out, size_t outlen, const tor_addr_t *addr)
Definition address.c:470
const char * name
Definition config.c:2475
Define in6_addr, its members, and related types on platforms that lack it.
uint16_t sa_family_t
Definition inaddr_st.h:77
Declarations for types used throughout the Tor networking system.
#define STATIC
Definition testsupport.h:32
#define MOCK_DECL(rv, funcname, arglist)
Integer definitions used throughout Tor.
Macros to manage assertions, fatal and non-fatal.
#define tor_assert(expr)
Definition util_bug.h:103