1 /* Declarations for host.c
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
5 This file is part of GNU Wget.
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Wget. If not, see <http://www.gnu.org/licenses/>.
20 Additional permission under GNU GPL version 3 section 7
22 If you modify this program, or any covered work, by linking or
23 combining it with the OpenSSL project's OpenSSL library (or a
24 modified version of that library), containing parts covered by the
25 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
26 grants you additional permission to convey the resulting work.
27 Corresponding Source for a non-source form of such a combination
28 shall include the source code for the parts of OpenSSL used as well
29 as that of the covered work. */
39 # else /* def __VMS */
41 # endif /* def __VMS [else] */
42 # include <sys/socket.h>
43 # include <netinet/in.h>
45 # include <arpa/inet.h>
52 /* This struct defines an IP address, tagged with family type. */
55 /* Address family, one of AF_INET or AF_INET6. */
58 /* The actual data, in the form of struct in_addr or in6_addr: */
60 struct in_addr d4; /* IPv4 address */
62 struct in6_addr d6; /* IPv6 address */
66 /* Under IPv6 getaddrinfo also returns scope_id. Since it's
67 IPv6-specific it strictly belongs in the above union, but we put
68 it here for simplicity. */
69 #if defined ENABLE_IPV6 && defined HAVE_SOCKADDR_IN6_SCOPE_ID
74 /* IP_INADDR_DATA macro returns a void pointer that can be interpreted
75 as a pointer to struct in_addr in IPv4 context or a pointer to
76 struct in6_addr in IPv4 context. This pointer can be passed to
77 functions that work on either, such as inet_ntop. */
78 #define IP_INADDR_DATA(x) ((void *) &(x)->data)
85 struct address_list *lookup_host (const char *, int);
87 void address_list_get_bounds (const struct address_list *, int *, int *);
88 const ip_address *address_list_address_at (const struct address_list *, int);
89 bool address_list_contains (const struct address_list *, const ip_address *);
90 void address_list_set_faulty (struct address_list *, int);
91 void address_list_set_connected (struct address_list *);
92 bool address_list_connected_p (const struct address_list *);
93 void address_list_release (struct address_list *);
95 const char *print_address (const ip_address *);
97 bool is_valid_ipv6_address (const char *, const char *);
100 bool accept_domain (struct url *);
101 bool sufmatch (const char **, const char *);
103 void host_cleanup (void);