Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / os_include / os_netdb.h
blob189f29b9dbb5ec5fa35c28bcbafbbb82226173ae
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file os_netdb.h
7 * definitions for network database operations
9 * @author Don Hinton <dhinton@dresystems.com>
10 * @author This code was originally in various places including ace/OS.h.
12 //=============================================================================
14 #ifndef ACE_OS_INCLUDE_OS_NETDB_H
15 #define ACE_OS_INCLUDE_OS_NETDB_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/config-all.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/os_include/netinet/os_in.h"
26 #include "ace/os_include/os_limits.h"
27 #include "ace/os_include/sys/os_socket.h"
29 // Place all additions (especially function declarations) within extern "C" {}
30 #ifdef __cplusplus
31 extern "C"
33 #endif /* __cplusplus */
35 #if !defined (ACE_LACKS_NETDB_H)
36 # include /**/ <netdb.h>
37 #endif /* !ACE_LACKS_NETDB_H */
39 #if defined (ACE_VXWORKS)
40 # include /**/ <hostLib.h>
41 # if (ACE_VXWORKS < 0x700) || defined (GETHOSTBYNAME_REENTRANT)
42 // With VxWorks 7 hostLib.h defines GETHOSTBYNAME_REENTRANT when gethostbyname()
43 // is reentrant
44 # define ACE_VXWORKS_HAS_GETHOSTBYNAME_REENTRANT
45 # endif
46 # if (ACE_VXWORKS < 0x700) || defined (GETHOSTBYADDR_REENTRANT)
47 // With VxWorks 7 hostLib.h defines GETHOSTBYADDR_REENTRANT when gethostbyaddr()
48 // is reentrant
49 # define ACE_VXWORKS_HAS_GETHOSTBYADDR_REENTRANT
50 # endif
51 #endif /* ACE_VXWORKS */
53 #if defined (ACE_LACKS_HOSTENT)
54 struct hostent {
55 char *h_name; /* official name of host */
56 char **h_aliases; /* alias list */
57 int h_addrtype; /* host address type */
58 int h_length; /* length of address */
59 char **h_addr_list; /* list of addresses from name server */
60 #define h_addr h_addr_list[0] /* address, for backward compatibility */
62 #endif /* ACE_LACKS_HOSTENT */
64 #if defined (ACE_LACKS_PROTOENT)
65 struct protoent {
66 char *p_name; /* official protocol name */
67 char **p_aliases; /* alias list */
68 int p_proto; /* protocol # */
70 #endif /* ACE_LACKS_PROTOENT */
72 #if defined (ACE_LACKS_SERVENT)
73 struct servent {
74 char *s_name; /* official service name */
75 char **s_aliases; /* alias list */
76 int s_port; /* port # */
77 char *s_proto; /* protocol to use */
79 #endif /* ACE_LACKS_SERVENT */
81 #ifdef ACE_LACKS_ADDRINFO
82 struct addrinfo {
83 int ai_flags;
84 int ai_family;
85 int ai_socktype;
86 int ai_protocol;
87 ACE_SOCKET_LEN ai_addrlen;
88 sockaddr *ai_addr;
89 char *ai_canonname;
90 addrinfo *ai_next;
92 #endif
94 #ifndef AI_V4MAPPED
95 # define AI_V4MAPPED 0x8
96 #endif
98 #ifndef AI_ADDRCONFIG
99 # define AI_ADDRCONFIG 0x20
100 #endif
102 #ifndef EAI_NONAME
103 # define EAI_NONAME -2 /* Error result from getaddrinfo(): no addr for name */
104 #endif
106 #ifndef EAI_AGAIN
107 # define EAI_AGAIN -3 /* Error result from getaddrinfo(): try again later */
108 #endif
110 #ifndef EAI_FAIL
111 # define EAI_FAIL -4 /* Error result from getaddrinfo(): non-recoverable */
112 #endif
114 #ifndef EAI_FAMILY
115 # define EAI_FAMILY -6 /* Error result from getaddrinfo(): family not supp. */
116 #endif
118 #ifndef EAI_MEMORY
119 # define EAI_MEMORY -10 /* Error result from getaddrinfo(): out of memory */
120 #endif
122 #ifndef EAI_SYSTEM
123 # define EAI_SYSTEM -11 /* Error result from getaddrinfo(): see errno */
124 #endif
126 #ifndef EAI_OVERFLOW
127 # define EAI_OVERFLOW -12 /* Error result from getaddrinfo(): buffer overflow */
128 #endif
130 #if !defined ACE_HOSTENT_DATA_SIZE
131 # define ACE_HOSTENT_DATA_SIZE (4*1024)
132 #endif /*ACE_HOSTENT_DATA_SIZE */
133 #if !defined ACE_SERVENT_DATA_SIZE
134 # define ACE_SERVENT_DATA_SIZE (4*1024)
135 #endif /*ACE_SERVENT_DATA_SIZE */
136 #if !defined ACE_PROTOENT_DATA_SIZE
137 # define ACE_PROTOENT_DATA_SIZE (2*1024)
138 #endif /*ACE_PROTOENT_DATA_SIZE */
140 typedef char ACE_HOSTENT_DATA[ACE_HOSTENT_DATA_SIZE];
141 typedef char ACE_SERVENT_DATA[ACE_SERVENT_DATA_SIZE];
142 typedef char ACE_PROTOENT_DATA[ACE_PROTOENT_DATA_SIZE];
144 # if !defined(MAXHOSTNAMELEN)
145 # define MAXHOSTNAMELEN HOST_NAME_MAX
146 # endif /* MAXHOSTNAMELEN */
148 #ifdef __cplusplus
150 #endif /* __cplusplus */
152 #include /**/ "ace/post.h"
153 #endif /* ACE_OS_INCLUDE_OS_NETDB_H */