2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
5 * Copyright (C) 2005 Neil Cafferkey
6 * Copyright (C) 2005 Pavel Fedin
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Library General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this file; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
26 * All rights reserved.
28 * Redistribution and use in source and binary forms are permitted
29 * provided that: (1) source distributions retain this entire copyright
30 * notice and comment, and (2) distributions including binaries display
31 * the following acknowledgement: ``This product includes software
32 * developed by the University of California, Berkeley and its contributors''
33 * in the documentation or other materials provided with the distribution
34 * and in all advertising materials mentioning features or use of this
35 * software. Neither the name of the University nor the names of its
36 * contributors may be used to endorse or promote products derived
37 * from this software without specific prior written permission.
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
39 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
40 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
46 #include <sys/types.h>
48 #include <sys/socket.h> /* for socklen_t */
51 * Structures returned by network data base library. All addresses are
52 * supplied in host order, and returned in network order (suitable for
53 * use in system calls).
56 char *h_name
; /* official name of host */
57 char **h_aliases
; /* alias list */
58 int h_addrtype
; /* host address type */
59 int h_length
; /* length of address */
60 char **h_addr_list
; /* list of addresses from name server */
61 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
65 * Assumption here is that a network number
66 * fits in 32 bits -- probably a poor one.
69 char *n_name
; /* official name of net */
70 char **n_aliases
; /* alias list */
71 int n_addrtype
; /* net address type */
72 unsigned long n_net
; /* network # */
76 char *s_name
; /* official service name */
77 char **s_aliases
; /* alias list */
78 int s_port
; /* port # */
79 char *s_proto
; /* protocol to use */
83 char *p_name
; /* official protocol name */
84 char **p_aliases
; /* alias list */
85 int p_proto
; /* protocol # */
92 #include <bsdsocket.h>
99 * Error return codes from gethostbyname() and gethostbyaddr()
100 * (left in extern int h_errno).
106 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
107 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
108 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
109 #define NO_DATA 4 /* Valid name, no data record of requested type */
110 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
113 long ai_flags
; /* AI_PASSIVE, AI_CANONNAME */
114 long ai_family
; /* PF_xxx */
115 long ai_socktype
; /* SOCK_xxx */
116 long ai_protocol
; /* IPPROTO_xxx for IPv4 and IPv6 */
117 size_t ai_addrlen
; /* length of ai_addr */
118 char *ai_canonname
; /* canonical name for host */
119 struct sockaddr
*ai_addr
; /* binary address */
120 struct addrinfo
*ai_next
; /* next structure in linked list */
123 /* following for getaddrinfo() */
124 #define AI_PASSIVE 1 /* socket is intended for bind() + listen() */
125 #define AI_CANONNAME 2 /* return canonical name */
127 /* following for getnameinfo() */
128 #define NI_MAXHOST 1025 /* max hostname returned */
129 #define NI_MAXSERV 32 /* max service name returned */
131 #define NI_NOFQDN 1 /* do not return FQDN */
132 #define NI_NUMERICHOST 2 /* return numeric form of hostname */
133 #define NI_NAMEREQD 4 /* return error if hostname not found */
134 #define NI_NUMERICSERV 8 /* return numeric form of service name */
135 #define NI_DGRAM 16 /* datagram service for getservbyname() */
138 #define EAI_ADDRFAMILY 1 /* address family for host not supported */
139 #define EAI_AGAIN 2 /* temporary failure in name resolution */
140 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
141 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
142 #define EAI_FAMILY 5 /* ai_family not supported */
143 #define EAI_MEMORY 6 /* memory allocation failure */
144 #define EAI_NODATA 7 /* no address associated with host */
145 #define EAI_NONAME 8 /* host nor service provided, or not known */
146 #define EAI_SERVICE 9 /* service not supported for ai_socktype */
147 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
148 #define EAI_SYSTEM 11 /* system error returned in errno */
151 /* Flags for ResetNetDB() */
152 #define NETDB_IFF_CLEANOLD 1
153 #define NETDB_IFF_MODIFYOLD 2
154 #define NETDB_IFF_ADDNEW 4
156 #endif /* !NETDB_H */