]> sjero.net Git - wget/blob - src/host.h
Quote some things that needed quoting.
[wget] / src / host.h
1 /* Declarations for host.c
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3    2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5 This file is part of GNU Wget.
6
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.
11
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.
16
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/>.
19
20 Additional permission under GNU GPL version 3 section 7
21
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.  */
30
31 #ifndef HOST_H
32 #define HOST_H
33
34 #ifdef WINDOWS
35 # include <winsock.h>
36 #else
37 # include <netdb.h>
38 # include <sys/socket.h>
39 # include <netinet/in.h>
40 #ifndef __BEOS__
41 # include <arpa/inet.h>
42 #endif
43 #endif
44
45 struct url;
46 struct address_list;
47
48 /* This struct defines an IP address, tagged with family type.  */
49
50 typedef struct {
51   /* Address family, one of AF_INET or AF_INET6. */
52   int family;
53
54   /* The actual data, in the form of struct in_addr or in6_addr: */
55   union {
56     struct in_addr d4;          /* IPv4 address */
57 #ifdef ENABLE_IPV6
58     struct in6_addr d6;         /* IPv6 address */
59 #endif
60   } data;
61
62   /* Under IPv6 getaddrinfo also returns scope_id.  Since it's
63      IPv6-specific it strictly belongs in the above union, but we put
64      it here for simplicity.  */
65 #if defined ENABLE_IPV6 && defined HAVE_SOCKADDR_IN6_SCOPE_ID
66   int ipv6_scope;
67 #endif
68 } ip_address;
69
70 /* IP_INADDR_DATA macro returns a void pointer that can be interpreted
71    as a pointer to struct in_addr in IPv4 context or a pointer to
72    struct in6_addr in IPv4 context.  This pointer can be passed to
73    functions that work on either, such as inet_ntop.  */
74 #define IP_INADDR_DATA(x) ((void *) &(x)->data)
75
76 enum {
77   LH_SILENT  = 1,
78   LH_BIND    = 2,
79   LH_REFRESH = 4
80 };
81 struct address_list *lookup_host (const char *, int);
82
83 void address_list_get_bounds (const struct address_list *, int *, int *);
84 const ip_address *address_list_address_at (const struct address_list *, int);
85 bool address_list_contains (const struct address_list *, const ip_address *);
86 void address_list_set_faulty (struct address_list *, int);
87 void address_list_set_connected (struct address_list *);
88 bool address_list_connected_p (const struct address_list *);
89 void address_list_release (struct address_list *);
90
91 const char *print_address (const ip_address *);
92 #ifdef ENABLE_IPV6
93 bool is_valid_ipv6_address (const char *, const char *);
94 #endif
95
96 bool accept_domain (struct url *);
97 bool sufmatch (const char **, const char *);
98
99 void host_cleanup (void);
100
101 #endif /* HOST_H */