summaryrefslogtreecommitdiffstats
path: root/lib/getaddrinfo.h
diff options
context:
space:
mode:
authorJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-07 22:11:25 (GMT)
committerJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-07 22:11:25 (GMT)
commit7ceff0d5a95f5c5f34235ef6682595f169864d2f (patch)
treee153a07b7ba9416c1b7262ce00542e55cab9cb93 /lib/getaddrinfo.h
parent1f7520fae4a776e0af2c5221071f1ff300de8727 (diff)
downloadmonitoring-plugins-7ceff0d5a95f5c5f34235ef6682595f169864d2f.tar.gz
Added getaddrinfo.[ch] & gethostbyname.[ch] to provide RFC2553 functions
if missing in system libs and lwres not present Moved all references to netdb.h and sys/socket.h into common.h.in Modified automake call in tools/setup to include adding missing files so config.sub and config.guess will be available git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@376 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/getaddrinfo.h')
-rw-r--r--lib/getaddrinfo.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/lib/getaddrinfo.h b/lib/getaddrinfo.h
new file mode 100644
index 0000000..c474d3b
--- /dev/null
+++ b/lib/getaddrinfo.h
@@ -0,0 +1,67 @@
1#ifndef _getaddrinfo_h
2#define _getaddrinfo_h
3/*
4 * This file is part of libESMTP, a library for submission of RFC 2822
5 * formatted electronic mail messages using the SMTP protocol described
6 * in RFC 2821.
7 *
8 * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25/* Structure and prototypes aken from RFC 2553 */
26
27struct addrinfo
28 {
29 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
30 int ai_family; /* PF_xxx */
31 int ai_socktype; /* SOCK_xxx */
32 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
33 size_t ai_addrlen; /* length of ai_addr */
34 char *ai_canonname; /* canonical name for nodename */
35 struct sockaddr *ai_addr; /* binary address */
36 struct addrinfo *ai_next; /* next structure in linked list */
37 };
38
39/* Supposed to be defined in <netdb.h> */
40#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
41#define AI_CANONNAME 2 /* Request for canonical name. */
42#define AI_NUMERICHOST 4 /* Don't use name resolution. */
43
44/* Supposed to be defined in <netdb.h> */
45#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */
46#define EAI_AGAIN 2 /* temporary failure in name resolution */
47#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
48#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
49#define EAI_FAMILY 5 /* ai_family not supported */
50#define EAI_MEMORY 6 /* memory allocation failure */
51#define EAI_NODATA 7 /* no address associated with nodename */
52#define EAI_NONAME 8 /* nodename nor servname provided, or not known */
53#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
54#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
55#define EAI_SYSTEM 11 /* system error returned in errno */
56
57/* RFC 2553 / Posix resolver */
58int getaddrinfo (const char *nodename, const char *servname,
59 const struct addrinfo *hints, struct addrinfo **res);
60
61/* Free addrinfo structure and associated storage */
62void freeaddrinfo (struct addrinfo *ai);
63
64/* Convert error return from getaddrinfo() to string */
65const char *gai_strerror (int code);
66
67#endif