/* CMS REPLACEMENT HISTORY, Element NETDB.H */ /* *8A1 11-DEC-2000 17:38:28 MYTH "V51 baselevel code freeze" */ /* *8 12-JUL-2000 15:58:34 MYTH "Update pointer return from getipnodeby*" */ /* 7A1 12-MAY-2000 00:51:54 MUGGERIDGE "V51IFT baselevel code freeze" */ /* 7B1 11-MAY-2000 15:38:56 MUGGERIDGE "V51IFT baselevel code freeze" */ /* *7 13-OCT-1999 17:36:06 FOUNTAIN "TUNIX IPV6 merge from bl6" */ /* *6 10-MAY-1999 15:43:54 FOUNTAIN "put back gethostbyname2 for backward compatibility" */ /* *5 3-MAY-1999 13:43:14 FOUNTAIN "Check-in of IPv6 related changes for the EAK" */ /* 4B1 28-OCT-1998 19:51:29 MUGGERIDGE "V50SSB baselevel code freeze" */ /* 4A1 18-JUN-1998 05:37:02 MUGGERIDGE "V50IFT baselevel code freeze" */ /* *4 1-APR-1998 16:51:48 GEMIGNANI "Direct h_errno to IPC" */ /* *3 23-MAR-1998 17:25:24 GEMIGNANI "Add ipv6 names" */ /* *2 4-FEB-1998 17:46:45 GEMIGNANI "Fix inclusions" */ /* *1 19-JAN-1998 15:24:34 GEMIGNANI "Initial population of IPv6 source" */ /* CMS REPLACEMENT HISTORY, Element NETDB.H */ #ifndef __NETDB_LOADED #define __NETDB_LOADED 1 /**************************************************************************** ** ** - Network database library info ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright Digital Equipment Corporation 1993, 1995. All rights reserved. ** ** Restricted Rights: Use, duplication, or disclosure by the U.S. ** Government is subject to restrictions as set forth in subparagraph ** (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR ** 52.227-14 Alt. III, as applicable. ** ** This software is proprietary to and embodies the confidential ** technology of Digital Equipment Corporation. Possession, use, or ** copying of this software and media is authorized only pursuant to a ** valid written license from Digital or an authorized sublicensor. ** ****************************************************************************** */ #pragma __nostandard #if (!defined(BSD)) || (BSD < 199306) # include #endif #ifdef OBSOLETE #include //OBSOLETE #endif /* OBSOLETE */ #include #include /* * IPv6: Include these here for now so res_init() and RES_USE_INET6 will * be available for gethostbyname() users. */ #include #include #include /* ** Set up feature test macros */ # if defined _XOPEN_SOURCE_EXTENDED && !defined _XOPEN_SOURCE # define _XOPEN_SOURCE # endif # if defined _XOPEN_SOURCE && _POSIX_C_SOURCE < 2 # undef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 2 # endif # if defined _POSIX_SOURCE && _POSIX_C_SOURCE < 1 # undef _POSIX_C_SOURCE /* _POSIX_SOURCE obsolete. */ # define _POSIX_C_SOURCE 1 /* #define _POSIX_C_SOURCE 1 instead */ # endif # if defined _POSIX_C_SOURCE && !defined _ANSI_C_SOURCE # define _ANSI_C_SOURCE # endif # if defined __HIDE_FORBIDDEN_NAMES && !defined _ANSI_C_SOURCE # define _ANSI_C_SOURCE # endif #ifdef __cplusplus extern "C" { #endif #ifndef __CRTL_VER # define __CRTL_VER __VMS_VER #endif /* ** Ensure that regardless of user /pointer_size usage, we begin processing ** using a 32 bit pointer context. */ #if __INITIAL_POINTER_SIZE # if (__CRTL_VER < 70000000) || !defined __ALPHA # error " Pointer size usage not permitted before OpenVMS Alpha V7.0" # endif # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** The DEC C RTL relies on the use of extern_prefix support in the compilers. ** The scenario of a customer getting these new headers via DEC C++, while at ** the same time using a compiler before DEC C V5.2 is still supported. ** ** Note that not having the ability to use #pragma extern_prefix may lead to ** certain restrictions in the ability to use new functionality. */ #if (__DECC_VER > 50230003) || __DECCXX # define __CAN_USE_EXTERN_PREFIX 1 #endif /* ** Create 'private' typedefs that are sensitive to pointer size and must use ** short pointers. */ #ifndef __CHAR_PTR32 # define __CHAR_PTR32 1 typedef char * __char_ptr32; typedef const char * __const_char_ptr32; #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 */ #ifndef ____IN_ADDR_T # define ____IN_ADDR_T 1 typedef unsigned int __in_addr_t; #endif #if !defined __IN_ADDR_T && !defined _DECC_V4_SOURCE # define __IN_ADDR_T 1 typedef __in_addr_t in_addr_t; #endif #ifndef __SIZE_T # define __SIZE_T 1 typedef unsigned int 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. */ 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 getipnodebyname() */ #define AI_ALL 0x00000008 /* Both AAAA and A records */ #define AI_V4MAPPED 0x00000010 /* request IPV4 mapped IPV6 address */ #define AI_ADDRCONFIG 0x00000020 /* Address Family must be configured */ #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) /* Default behavior */ /* * Flag values for getaddrinfo() */ #define AI_PASSIVE 0x00000001 /* socket address intended for bind() */ #define AI_CANONNAME 0x00000002 /* request for canonical name */ #define AI_NUMERICHOST 0x00000004 /* numeric host address string */ /* * 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 */ #ifdef OBSOLETE #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 #endif /* OBSOLETE */ #ifdef BEFORE_TCPIP_V50 /* ** h_errno support -- new in OpenVMS V7.0 */ #if __CRTL_VER >= 70000000 /* ** 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 */ /* ** The address of h_errno is always a 32 bit address */ int *decc$h_errno_get_addr(void); # define h_errno (*decc$h_errno_get_addr()) #endif #else /* BEFORE_TCPIP_V50 */ /* ** 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 */ /* ** The address of h_errno is always a 32 bit address */ #if defined __TCPIP_ALLOCATE_RES__ extern int h_errno; #else int *TCPIP$GET_H_ERRNO_ADDR(void); # define h_errno *TCPIP$GET_H_ERRNO_ADDR() #endif #endif /* BEFORE_TCPIP_V50 */ /* * 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 OBSOLETE /* TEST */ #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 #endif /* OBSOLETE TEST */ __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_ptr32 gai_strerror (int); __struct_hostent_ptr32 getipnodebyname (const char *, int, int, int*); __struct_hostent_ptr32 getipnodebyaddr (const void *, size_t, int, int*); void freehostent (struct hostent *); #ifdef OBSOLETE /* TEST */ #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif #endif /* OBSOLETE TEST */ /* ** 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 */