1 /* Declarations for host.c
2 Copyright (C) 1996-2006 Free Software Foundation, Inc.
4 This file is part of GNU Wget.
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Wget. If not, see <http://www.gnu.org/licenses/>.
19 In addition, as a special exception, the Free Software Foundation
20 gives permission to link the code of its release of Wget with the
21 OpenSSL project's "OpenSSL" library (or with modified versions of it
22 that use the same license as the "OpenSSL" library), and distribute
23 the linked executables. You must obey the GNU General Public License
24 in all respects for all of the code used other than "OpenSSL". If you
25 modify this file, you may extend this exception to your version of the
26 file, but you are not obligated to do so. If you do not wish to do
27 so, delete this exception statement from your version. */
36 # include <sys/socket.h>
37 # include <netinet/in.h>
39 # include <arpa/inet.h>
46 /* This struct defines an IP address, tagged with family type. */
49 /* Address family, one of AF_INET or AF_INET6. */
52 /* The actual data, in the form of struct in_addr or in6_addr: */
54 struct in_addr d4; /* IPv4 address */
56 struct in6_addr d6; /* IPv6 address */
60 /* Under IPv6 getaddrinfo also returns scope_id. Since it's
61 IPv6-specific it strictly belongs in the above union, but we put
62 it here for simplicity. */
63 #if defined ENABLE_IPV6 && defined HAVE_SOCKADDR_IN6_SCOPE_ID
68 /* IP_INADDR_DATA macro returns a void pointer that can be interpreted
69 as a pointer to struct in_addr in IPv4 context or a pointer to
70 struct in6_addr in IPv4 context. This pointer can be passed to
71 functions that work on either, such as inet_ntop. */
72 #define IP_INADDR_DATA(x) ((void *) &(x)->data)
79 struct address_list *lookup_host (const char *, int);
81 void address_list_get_bounds (const struct address_list *, int *, int *);
82 const ip_address *address_list_address_at (const struct address_list *, int);
83 bool address_list_contains (const struct address_list *, const ip_address *);
84 void address_list_set_faulty (struct address_list *, int);
85 void address_list_set_connected (struct address_list *);
86 bool address_list_connected_p (const struct address_list *);
87 void address_list_release (struct address_list *);
89 const char *print_address (const ip_address *);
91 bool is_valid_ipv6_address (const char *, const char *);
94 bool accept_domain (struct url *);
95 bool sufmatch (const char **, const char *);
97 void host_cleanup (void);