Tor 0.4.9.0-alpha-dev
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
114/** Return an in6_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
115 * an IPv6 address. */
116static inline const struct in6_addr *
118{
119 return a->family == AF_INET6 ? &a->addr.in6_addr : NULL;
120}
121
122/** As tor_addr_to_in6, but assert that the address truly is an IPv6
123 * address. */
124static inline const struct in6_addr *
126{
127 tor_assert(a->family == AF_INET6);
128 return &a->addr.in6_addr;
129}
130
131/** Given an IPv6 address <b>x</b>, yield it as an array of uint8_t.
132 *
133 * Requires that <b>x</b> is actually an IPv6 address.
134 */
135#define tor_addr_to_in6_addr8(x) tor_addr_to_in6_assert(x)->s6_addr
136
137/** Given an IPv6 address <b>x</b>, yield it as an array of uint16_t.
138 *
139 * Requires that <b>x</b> is actually an IPv6 address.
140 */
141#define tor_addr_to_in6_addr16(x) S6_ADDR16(*tor_addr_to_in6_assert(x))
142
143/** Given an IPv6 address <b>x</b>, yield it as an array of uint32_t.
144 *
145 * Requires that <b>x</b> is actually an IPv6 address.
146 */
147#define tor_addr_to_in6_addr32(x) S6_ADDR32(*tor_addr_to_in6_assert(x))
148
149/** Return an IPv4 address in network order for <b>a</b>, or 0 if
150 * <b>a</b> is not an IPv4 address. */
151static inline uint32_t
153{
154 return a->family == AF_INET ? a->addr.in_addr.s_addr : 0;
155}
156
157/** Return an IPv4 address in host order for <b>a</b>, or 0 if
158 * <b>a</b> is not an IPv4 address. */
159static inline uint32_t
161{
162 return ntohl(tor_addr_to_ipv4n(a));
163}
164
165/** Given an IPv6 address, return its mapped IPv4 address in host order, or
166 * 0 if <b>a</b> is not an IPv6 address.
167 *
168 * (Does not check whether the address is really a mapped address.) */
169static inline uint32_t
171{
172 if (a->family == AF_INET6) {
173 uint32_t *addr32 = NULL;
174 // Work around an incorrect NULL pointer dereference warning in
175 // "clang --analyze" due to limited analysis depth
176 addr32 = tor_addr_to_in6_addr32(a);
177 tor_assert(addr32);
178 return ntohl(addr32[3]);
179 } else {
180 return 0;
181 }
182}
183
184/** Return the address family of <b>a</b>. Possible values are:
185 * AF_INET6, AF_INET, AF_UNSPEC, AF_UNIX. */
186static inline sa_family_t
188{
189 return a->family;
190}
191
192/**
193 * Return true if the address @a is in the UNSPEC family.
194 **/
195static inline bool
197{
198 return a->family == AF_UNSPEC;
199}
200
201/** Return an in_addr* equivalent to <b>a</b>, or NULL if <b>a</b> is not
202 * an IPv4 address. */
203static inline const struct in_addr *
205{
206 return a->family == AF_INET ? &a->addr.in_addr : NULL;
207}
208
209/** Return true iff <b>a</b> is an IPv4 address equal to the host-ordered
210 * address in <b>u</b>. */
211static inline int
212tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
213{
214 return a->family == AF_INET ? (tor_addr_to_ipv4h(a) == u) : 0;
215}
216
217/** Length of a buffer that you need to allocate to be sure you can encode
218 * any tor_addr_t.
219 *
220 * This allows enough space for
221 * "[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]",
222 * plus a terminating NUL.
223 */
224#define TOR_ADDR_BUF_LEN 48
225
226/** Length of a buffer containing an IP address along with a port number and
227 * a separating colon.
228 *
229 * This allows enough space for
230 * "[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]:12345",
231 * plus a terminating NUL.
232 */
233#define TOR_ADDRPORT_BUF_LEN (TOR_ADDR_BUF_LEN + 6)
234
235char *tor_addr_to_str_dup(const tor_addr_t *addr) ATTR_MALLOC;
236
237/** Wrapper function of fmt_addr_impl(). It does not decorate IPv6
238 * addresses. */
239#define fmt_addr(a) fmt_addr_impl((a), 0)
240
241/** Wrapper function of fmt_addr_impl(). It decorates IPv6
242 * addresses. */
243#define fmt_and_decorate_addr(a) fmt_addr_impl((a), 1)
244
245const char *fmt_addr_impl(const tor_addr_t *addr, int decorate);
246const char *fmt_addrport(const tor_addr_t *addr, uint16_t port);
247#define fmt_addrport_ap(ap) fmt_addrport(&(ap)->addr, (ap)->port)
248const char *fmt_addr32(uint32_t addr);
249const char *fmt_addr32_port(uint32_t addr, uint16_t port);
250const char *fmt_af_family(sa_family_t family);
251const char *fmt_addr_family(const tor_addr_t *addr);
252
253MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family,
254tor_addr_t *addr));
255
256struct smartlist_t;
257void interface_address6_list_free_(struct smartlist_t * addrs);
258#define interface_address6_list_free(addrs) \
259 FREE_AND_NULL(struct smartlist_t, interface_address6_list_free_, (addrs))
260
262 sa_family_t family,
263 int include_internal));
264
265/** Flag to specify how to do a comparison between addresses. In an "exact"
266 * comparison, addresses are equivalent only if they are in the same family
267 * with the same value. In a "semantic" comparison, IPv4 addresses match all
268 * IPv6 encodings of those addresses. */
269typedef enum {
270 CMP_EXACT,
271 CMP_SEMANTIC,
273
274int tor_addr_compare(const tor_addr_t *addr1, const tor_addr_t *addr2,
276int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
278/** Return true iff a and b are the same address. The comparison is done
279 * "exactly". */
280#define tor_addr_eq(a,b) (0==tor_addr_compare((a),(b),CMP_EXACT))
281
282uint64_t tor_addr_hash(const tor_addr_t *addr);
283struct sipkey;
284uint64_t tor_addr_keyed_hash(const struct sipkey *key, const tor_addr_t *addr);
285
286int tor_addr_is_v4(const tor_addr_t *addr);
287int tor_addr_is_v6(const tor_addr_t *addr);
288int tor_addr_is_internal_(const tor_addr_t *ip, int for_listening,
289 const char *filename, int lineno);
290#define tor_addr_is_internal(addr, for_listening) \
291 tor_addr_is_internal_((addr), (for_listening), SHORT_FILE__, __LINE__)
293
294/** Longest length that can be required for a reverse lookup name. */
295/* 32 nybbles, 32 dots, 8 characters of "ip6.arpa", 1 NUL: 73 characters. */
296#define REVERSE_LOOKUP_NAME_BUF_LEN 73
297int tor_addr_to_PTR_name(char *out, size_t outlen,
298 const tor_addr_t *addr);
299int tor_addr_parse_PTR_name(tor_addr_t *result, const char *address,
300 int family, int accept_regular);
301
302/* Does the address * yield an AF_UNSPEC wildcard address (1),
303 * which expands to corresponding wildcard IPv4 and IPv6 rules, and do we
304 * allow *4 and *6 for IPv4 and IPv6 wildcards, respectively;
305 * or does the address * yield IPv4 wildcard address (0). */
306#define TAPMP_EXTENDED_STAR 1
307/* Does the address * yield an IPv4 wildcard address rule (1);
308 * or does it yield wildcard IPv4 and IPv6 rules (0) */
309#define TAPMP_STAR_IPV4_ONLY (1 << 1)
310/* Does the address * yield an IPv6 wildcard address rule (1);
311 * or does it yield wildcard IPv4 and IPv6 rules (0) */
312#define TAPMP_STAR_IPV6_ONLY (1 << 2)
313/* TAPMP_STAR_IPV4_ONLY and TAPMP_STAR_IPV6_ONLY are mutually exclusive. */
314int tor_addr_parse_mask_ports(const char *s, unsigned flags,
315 tor_addr_t *addr_out, maskbits_t *mask_out,
316 uint16_t *port_min_out, uint16_t *port_max_out);
317
318const char * tor_addr_to_str(char *dest, const tor_addr_t *addr, size_t len,
319 int decorate);
320int tor_addr_parse(tor_addr_t *addr, const char *src);
321void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src);
322void tor_addr_copy_tight(tor_addr_t *dest, const tor_addr_t *src);
323
324void tor_addr_from_ipv4n(tor_addr_t *dest, uint32_t v4addr);
325/** Set <b>dest</b> to the IPv4 address encoded in <b>v4addr</b> in host
326 * order. */
327#define tor_addr_from_ipv4h(dest, v4addr) \
328 tor_addr_from_ipv4n((dest), htonl(v4addr))
329void tor_addr_from_ipv6_bytes(tor_addr_t *dest, const uint8_t *bytes);
330/** Set <b>dest</b> to the IPv4 address incoded in <b>in</b>. */
331#define tor_addr_from_in(dest, in) \
332 tor_addr_from_ipv4n((dest), (in)->s_addr);
333void tor_addr_from_in6(tor_addr_t *dest, const struct in6_addr *in6);
334void tor_addr_copy_ipv6_bytes(uint8_t *dest, const tor_addr_t *src);
335
336int tor_addr_is_null(const tor_addr_t *addr);
337int tor_addr_is_loopback(const tor_addr_t *addr);
338
339int tor_addr_is_valid(const tor_addr_t *addr, int for_listening);
340int tor_addr_is_valid_ipv4n(uint32_t v4n_addr, int for_listening);
341#define tor_addr_is_valid_ipv4h(v4h_addr, for_listening) \
342 tor_addr_is_valid_ipv4n(htonl(v4h_addr), (for_listening))
343int tor_port_is_valid(uint16_t port, int for_listening);
344
345/* Are addr and port both valid? */
346#define tor_addr_port_is_valid(addr, port, for_listening) \
347 (tor_addr_is_valid((addr), (for_listening)) && \
348 tor_port_is_valid((port), (for_listening)))
349/* Are ap->addr and ap->port both valid? */
350#define tor_addr_port_is_valid_ap(ap, for_listening) \
351 tor_addr_port_is_valid(&(ap)->addr, (ap)->port, (for_listening))
352/* Are the network-order v4addr and port both valid? */
353#define tor_addr_port_is_valid_ipv4n(v4n_addr, port, for_listening) \
354 (tor_addr_is_valid_ipv4n((v4n_addr), (for_listening)) && \
355 tor_port_is_valid((port), (for_listening)))
356/* Are the host-order v4addr and port both valid? */
357#define tor_addr_port_is_valid_ipv4h(v4h_addr, port, for_listening) \
358 (tor_addr_is_valid_ipv4h((v4h_addr), (for_listening)) && \
359 tor_port_is_valid((port), (for_listening)))
360
361int tor_addr_port_split(int severity, const char *addrport,
362 char **address_out, uint16_t *port_out);
363
364int tor_addr_port_parse(int severity, const char *addrport,
365 tor_addr_t *address_out, uint16_t *port_out,
366 int default_port);
367
368int tor_addr_hostname_is_local(const char *name);
369
370/* IPv4 helpers */
371int parse_port_range(const char *port, uint16_t *port_min_out,
372 uint16_t *port_max_out);
373int addr_mask_get_bits(uint32_t mask);
374char *tor_dup_ip(uint32_t addr) ATTR_MALLOC;
375
376MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr));
377#define interface_address_list_free(lst)\
378 interface_address6_list_free(lst)
379
380/** Return a smartlist of the IPv4 addresses of all interfaces on the server.
381 * Excludes loopback and multicast addresses. Only includes internal addresses
382 * if include_internal is true. (Note that a relay behind NAT may use an
383 * internal address to connect to the Internet.)
384 * An empty smartlist means that there are no IPv4 addresses.
385 * Returns NULL on failure.
386 * Use free_interface_address_list to free the returned list.
387 */
388static inline struct smartlist_t *
389get_interface_address_list(int severity, int include_internal)
390{
391 return get_interface_address6_list(severity, AF_INET, include_internal);
392}
393
394tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port);
396 const tor_addr_port_t *b);
397void tor_addr_port_copy(tor_addr_port_t *dest, const tor_addr_port_t *source);
398
399int string_is_valid_dest(const char *string);
400int string_is_valid_nonrfc_hostname(const char *string);
401int string_is_valid_ipv4_address(const char *string);
402int string_is_valid_ipv6_address(const char *string);
403
404#ifdef ADDRESS_PRIVATE
406 sa_family_t family));
408 sa_family_t family,
409 tor_addr_t *addr));
410
411#ifdef HAVE_IFADDRS_TO_SMARTLIST
412STATIC struct smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa,
413 sa_family_t family);
414STATIC struct smartlist_t *get_interface_addresses_ifaddrs(int severity,
415 sa_family_t family);
416#endif /* defined(HAVE_IFADDRS_TO_SMARTLIST) */
417
418#ifdef HAVE_IP_ADAPTER_TO_SMARTLIST
419STATIC struct smartlist_t *ip_adapter_addresses_to_smartlist(
420 const IP_ADAPTER_ADDRESSES *addresses);
421STATIC struct smartlist_t *get_interface_addresses_win32(int severity,
422 sa_family_t family);
423#endif /* defined(HAVE_IP_ADAPTER_TO_SMARTLIST) */
424
425#ifdef HAVE_IFCONF_TO_SMARTLIST
426STATIC struct smartlist_t *ifreq_to_smartlist(const uint8_t *ifr,
427 size_t buflen);
428STATIC struct smartlist_t *get_interface_addresses_ioctl(int severity,
429 sa_family_t family);
430#endif /* defined(HAVE_IFCONF_TO_SMARTLIST) */
431
432#endif /* defined(ADDRESS_PRIVATE) */
433
434#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:152
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:204
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:389
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:187
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:160
static const struct in6_addr * tor_addr_to_in6(const tor_addr_t *a)
Definition: address.h:117
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:170
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:125
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:269
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:147
static int tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
Definition: address.h:212
static bool tor_addr_is_unspec(const tor_addr_t *a)
Definition: address.h:196
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:2462
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.
Definition: siphash.h:6
#define STATIC
Definition: testsupport.h:32
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
Integer definitions used throughout Tor.
Macros to manage assertions, fatal and non-fatal.
#define tor_assert(expr)
Definition: util_bug.h:103