#ifndef __NETDB_LOADED #define __NETDB_LOADED 1 /**************************************************************************** ** ** - Network database library info ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq required for ** possession, use or copying. Consistent with FAR 12.211 and 12.212, ** Commercial Computer Software, Computer Software Documentation, and ** Technical Data for Commercial Items are licensed to the U.S. Government ** under vendor's standard commercial license. ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** All includes of other header files must be done prior to altering ** the pointer size mode. */ #include #include #include /* ** IPv6: Include these here for now so res_init() and RES_USE_INET6 will ** be available for gethostbyname() users. */ #include #include #include /* ** Start processing in 32-bit addressing mode */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Those socket structures allocated by the DEC C RTL or the underlying tcp/ip ** layer are always 32 bit pointers. Declare typedefs which are pointers to ** these structures while in 32 bit pointer context. We will then use these ** typedefs in the function prototypes when in 64 bit pointer context. */ typedef struct hostent * __struct_hostent_ptr32; typedef struct servent * __struct_servent_ptr32; typedef struct netent * __struct_netent_ptr32; typedef struct protoent * __struct_protoent_ptr32; /* ** The OpenVMS V7.0 release added a second implementation of the socket ** functions which is compatible with BSD 4.4. Define a local to be ** used throughout the remaining header file which reflects which ** implementation is being used. ** ** An application program enables this support by defining _SOCKADDR_LEN ** prior to including this header file. */ #ifdef _SOCKADDR_LEN # if (__CRTL_VER < 70000000) # error " BSD 4.4 Socket package not available before OpenVMS V7.0" # undef _SOCKADDR_LEN # endif #endif /* ** All structures should be member aligned on natural boundaries */ #pragma __member_alignment __save #pragma __member_alignment /* ** Conditionally define in_addr_t and size_t structures */ #if !defined __IN_ADDR_T && !defined _DECC_V4_SOURCE # define __IN_ADDR_T typedef __in_addr_t in_addr_t; #endif #ifndef __SIZE_T # define __SIZE_T 1 typedef __size_t size_t; #endif /* ** Internal Constants for Reentrant Socket Functions */ #define _MAXALIASES 35 #define _MAXLINELEN 1024 #define _MAXADDRS 35 #define _HOSTBUFSIZE (BUFSIZ + 1) #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" /* Internal constants */ #define _MAXALIASES 35 #define _MAXLINELEN 1024 #define _MAXADDRS 35 #define _HOSTBUFSIZE (BUFSIZ + 1) /* ** Structures returned by network data base library. All addresses are ** supplied in host order, and returned in network order (suitable for ** use in system calls). **/ /* ** Hostent Structure ** ** This structure specifies or obtains a host name, a list of aliases ** associated with the host, and the host's number specified ** as an Internet address from the host database. An entry in the host ** database is created with the following command: ** ** TCPIP> SET HOST XXXX ** ** See the DEC TCP/IP Services for OpenVMS System Management manual for ** a description of the host database. */ /* ** Netent Structure ** ** This structure specifies or obtains a network name, a list of aliases ** associated with the network, and the network's number specified ** as an Internet address from the network database. An entry in the network ** database is created with the following command: ** ** UCX > SET NETWORK XXXX ** ** See the DEC TCP/IP Services for OpenVMS System Management manual for ** a description of the network database. */ struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses from name server */ #define h_addr h_addr_list[0] /* address, for backward compatiblity */ }; /* ** Netent Structure ** ** This structure specifies or obtains a network name, a list of aliases ** associated with the network, and the network's number specified ** as an Internet address from the network database. An entry in the network ** database is created with the following command: ** ** TCPIP> SET NETWORK XXXX ** ** See the DEC TCP/IP Services for OpenVMS System Management manual for ** a description of the network database. ** */ /* * Assumption here is that a network number * fits in 32 bits -- probably a poor one. */ struct netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ __in_addr_t n_net; /* network # */ }; /* ** Servent Structure ** ** This structure specifies or obtains a service name, a list of aliases ** associated with the service, and the service's number specified ** as an Internet address from the services database. An entry in the services ** database is created with the following command: ** ** TCPIP> SET SERV XXXX ** ** See the DEC TCP/IP Services for OpenVMS System Management manual for ** a description of the services database. */ struct servent { char *s_name; /* official service name */ char **s_aliases; /* alias list */ int s_port; /* port # */ char *s_proto; /* protocol to use */ }; struct protoent { char *p_name; /* official protocol name */ char **p_aliases; /* alias list */ int p_proto; /* protocol # */ }; /* * addrinfo structure */ struct addrinfo { int ai_flags; /* input flags */ int ai_family; /* protofamily for socket */ int ai_socktype; /* socket type */ int ai_protocol; /* protocol for socket */ size_t ai_addrlen; /* length of socket-address */ char *ai_canonname; /* service location canonical name */ struct sockaddr *ai_addr; /* socket-address for socket */ struct addrinfo *ai_next; /* pointer to next in list */ }; #ifndef _SOCKADDR_LEN # ifdef getaddrinfo # undef getaddrinfo # endif # define getaddrinfo getaddrinfo_compat43 #endif /* * Flag values for getaddrinfo() */ #define AI_PASSIVE 0x00000001 /* socket address intended for bind() */ #define AI_CANONNAME 0x00000002 /* request for canonical name */ /* * Flag values for getnameinfo() */ #define NI_DGRAM 0x00000001 #define NI_NAMEREQD 0x00000002 #define NI_NOFQDN 0x00000004 #define NI_NUMERICHOST 0x00000008 #define NI_NUMERICSERV 0x00000010 #define NI_MAXHOST 1025 #define NI_MAXSERV 32 /* ** DEC C extensions */ #if !defined _XOPEN_SOURCE_EXTENDED /* ** Rpcent Structures */ struct rpcent { char *r_name; /* name of server for rpc program */ char **r_aliases; /* alias list */ int r_number; /* rpc program number */ }; #endif /* ** Error return codes from gethostbyname and gethostbyaddr (left in h_errno) */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ #define TRY_AGAIN 2 /* Non-Authoritive Host not fnd, or SERVERFAIL */ #define NO_RECOVERY 3 /* Non recoverable errors */ #define NO_DATA 4 /* Valid name, no data rec of requested type */ #define NO_ADDRESS NO_DATA /* No address, look for MX record */ #if defined __TCPIP_ALLOCATE_RES__ extern int h_errno; #else # if __CRTL_VER >= 70000000 /* ** As of OpenVMS V7.0, the DEC C RTL supports h_errno. */ int *decc$h_errno_get_addr(void); # define h_errno (*decc$h_errno_get_addr()) # else /* ** If the user has defined a feature test macro, __TCPIP_GLOBALS, ** we will define these functions as globals which are resolved by ** a TCPIP object library. */ # ifdef __TCPIP_GLOBALS int *TCPIP$GET_H_ERRNO_ADDR(void); # define h_errno *TCPIP$GET_H_ERRNO_ADDR() # endif # endif #endif /* * Error values for getaddrinfo() */ #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ #define EAI_AGAIN 2 /* temporary failure in name resolution */ #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ #define EAI_FAMILY 5 /* ai_family not supported */ #define EAI_MEMORY 6 /* memory allocation failure */ #define EAI_NODATA 7 /* no address associated with hostname */ #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ #define EAI_SYSTEM 11 /* system error returned in errno */ /* ** If the user has used /pointer_size=32 or /pointer_size=64, we will allow 64 ** bit pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** The following functions return pointers to memory allocated by the DEC C ** RTL or the underlying tcp/ip layer. These pointers are always 32 bit ** pointers, while the pointer parameters may be 32 or 64 bits. */ __struct_netent_ptr32 getnetbyaddr (__in_addr_t __net, int __type); __struct_netent_ptr32 getnetent (void); __struct_protoent_ptr32 getprotobynumber (int __proto); __struct_protoent_ptr32 getprotoent (void); __struct_netent_ptr32 getnetbyname (const char *__name); __struct_servent_ptr32 getservbyname (const char *__name, const char *__proto); __struct_servent_ptr32 getservbyport (int __port, const char *__proto); __struct_protoent_ptr32 getprotobyname (const char *__name); #if __CRTL_VER >= 70000000 __struct_hostent_ptr32 gethostent (void); __struct_servent_ptr32 getservent (void); void endnetent (void); void endprotoent (void); void endhostent (void); void endservent (void); void sethostent (int __stayopen); void setservent (int __stayopen); void setnetent (int __stayopen); void setprotoent (int __stayopen); #endif /* ** These functions have new semantics for BSD 4.4 */ #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__bsd44_" # else # define gethostbyaddr(__p1,__p2,__p3) __bsd44_gethostbyaddr(__p1,__p2,__p3) # define gethostbyname(__p1) __bsd44_gethostbyname(__p1) # endif #endif __struct_hostent_ptr32 gethostbyaddr (const void *__addr, size_t __len, int __type); __struct_hostent_ptr32 gethostbyname (const char *__name); __struct_hostent_ptr32 gethostbyname2 (const char *, int); void freeaddrinfo (struct addrinfo *); int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **); int getnameinfo (const struct sockaddr *, size_t, char *, size_t, char *, size_t, int); char *gai_strerror (int); #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif /* ** DEC C Extensions */ #if !defined _XOPEN_SOURCE_EXTENDED && __CRTL_VER >= 70000000 void herror (const char *__s1); /* ** The hstrerror function always returns a 32 bit pointer */ __char_ptr32 hstrerror (int __n); #endif #define NETDB_INTERNAL -1 /* see errno */ #define NETDB_SUCCESS 0 /* no problem */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __NETDB_LOADED */