3 //=============================================================================
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)
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" {}
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()
44 # define ACE_VXWORKS_HAS_GETHOSTBYNAME_REENTRANT
46 # if (ACE_VXWORKS < 0x700) || defined (GETHOSTBYADDR_REENTRANT)
47 // With VxWorks 7 hostLib.h defines GETHOSTBYADDR_REENTRANT when gethostbyaddr()
49 # define ACE_VXWORKS_HAS_GETHOSTBYADDR_REENTRANT
51 #endif /* ACE_VXWORKS */
53 #if defined (ACE_LACKS_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)
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)
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
87 ACE_SOCKET_LEN ai_addrlen
;
95 # define AI_V4MAPPED 0x8
99 # define AI_ADDRCONFIG 0x20
103 # define EAI_NONAME -2 /* Error result from getaddrinfo(): no addr for name */
107 # define EAI_AGAIN -3 /* Error result from getaddrinfo(): try again later */
111 # define EAI_FAIL -4 /* Error result from getaddrinfo(): non-recoverable */
115 # define EAI_FAMILY -6 /* Error result from getaddrinfo(): family not supp. */
119 # define EAI_MEMORY -10 /* Error result from getaddrinfo(): out of memory */
123 # define EAI_SYSTEM -11 /* Error result from getaddrinfo(): see errno */
127 # define EAI_OVERFLOW -12 /* Error result from getaddrinfo(): buffer overflow */
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 */
150 #endif /* __cplusplus */
152 #include /**/ "ace/post.h"
153 #endif /* ACE_OS_INCLUDE_OS_NETDB_H */