]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/getaddrinfo.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / compat / getaddrinfo.h
1 /*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef _getaddrinfo_h
10 #define _getaddrinfo_h
11
12 /*
13 * Shamelessly duplicated from the fetchmail public sources
14 * for use by the Squid Project under GNU Public License.
15 *
16 * Update/Maintenance History:
17 *
18 * 15-Aug-2007 : Copied from fetchmail 6.3.8
19 * - added protection around library headers
20 *
21 * 16-Aug-2007 : Altered configure checks
22 * Un-hacked slightly to use system gethostbyname()
23 *
24 * Original License and code follows.
25 */
26
27 /*
28 * This file is part of libESMTP, a library for submission of RFC 2822
29 * formatted electronic mail messages using the SMTP protocol described
30 * in RFC 2821.
31 *
32 * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
33 *
34 * This library is free software; you can redistribute it and/or
35 * modify it under the terms of the GNU Lesser General Public
36 * License as published by the Free Software Foundation; either
37 * version 2.1 of the License, or (at your option) any later version.
38 *
39 * This library is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 * Lesser General Public License for more details.
43 *
44 * You should have received a copy of the GNU Lesser General Public
45 * License along with this library; if not, write to the Free Software
46 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
47 */
48
49 /* Structure and prototypes taken from RFC 2553 */
50
51 /* These functions are provided by the OS */
52 #if !HAVE_DECL_GETADDRINFO
53
54 #ifndef EAI_SYSTEM
55 /* Not defined on mingw32. */
56 #define EAI_SYSTEM 11 /* System error returned in `errno'. */
57 #endif
58 #ifndef EAI_OVERFLOW
59 /* Not defined on mingw32. */
60 #define EAI_OVERFLOW 12 /* Argument buffer overflow. */
61 #endif
62
63 #ifndef IN_EXPERIMENTAL
64 #define IN_EXPERIMENTAL(a) \
65 ((((long int) (a)) & 0xf0000000) == 0xf0000000)
66 #endif
67
68 /* RFC 2553 / Posix resolver */
69 SQUIDCEXTERN int xgetaddrinfo (const char *nodename, const char *servname,
70 const struct addrinfo *hints, struct addrinfo **res);
71 #define getaddrinfo xgetaddrinfo
72
73 /* Free addrinfo structure and associated storage */
74 SQUIDCEXTERN void xfreeaddrinfo (struct addrinfo *ai);
75 #define freeaddrinfo xfreeaddrinfo
76
77 /* Convert error return from getaddrinfo() to string */
78 SQUIDCEXTERN const char *xgai_strerror (int code);
79 #if !defined(gai_strerror)
80 #define gai_strerror xgai_strerror
81 #endif
82
83 #endif /* HAVE_DECL_GETADDRINFO */
84 #endif /* _getaddrinfo_h */
85