#ifndef __RESOLV_LOADED #define __RESOLV_LOADED 1 #pragma __nostandard #include #if __CRTL_VER >= 70000000 /* Only OpenVMS V7.0 or later */ /**************************************************************************** ** ** - Resolver configuration file ** ***************************************************************************** ** Header is nonstandard ***************************************************************************** ** ** Copyright 2005 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries 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. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include /* ** Set __nomember_alignment to avoid internal and tail ** padding in structures; default base alignment. ** Required for consistency across programming languages. */ #pragma __member_alignment __save #pragma __nomember_alignment /* ** Enable 64 bit pointers for the prototype when the ** user has specified the /pointer_size qualifier. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 64 #endif /* ** Function prototype */ __char_ptr32 hostalias (const char *); /* ** Rest of the functions and data structures declared in this file ** currently require 32 bit pointers. */ #if __INITIAL_POINTER_SIZE #pragma __pointer_size 32 #endif /* * Revision information. This is the release date in YYYYMMDD format. * It can change every day so the right thing to do with it is use it * in preprocessor commands such as "#if (__RES > 19931104)". Do not * compare for equality; rather, use it to determine whether your resolver * is new enough to contain a certain feature. */ #define __RES 20030124 /* * This used to be defined in res_query.c, now it's in herror.c. * [XXX no it's not. It's in irs/irs_data.c] * It was * never extern'd by any *.h file before it was placed here. For thread * aware programs, the last h_errno value set is stored in res->h_errno. * * XXX: There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO * (and __h_errno_set) to the public via . * XXX: __h_errno_set is really part of IRS, not part of the resolver. * If somebody wants to build and use a resolver that doesn't use IRS, * what do they do? Perhaps something like * #ifdef WANT_IRS * # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) * #else * # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x)) * #endif */ #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) struct __res_state; /* forward */ void __h_errno_set(struct __res_state *res, int err); /* * Resolver configuration file. * Normally not present, but may contain the address of the * initial name server(s) to query and the domain search list. */ #ifndef _PATH_RESCONF #define _PATH_RESCONF "tcpip$etc:resolv.conf" #endif typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } res_sendhookact; typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns, const u_char **query, int *querylen, u_char *ans, int anssiz, int *resplen); typedef res_sendhookact (*res_send_rhook) (const struct sockaddr *ns, const u_char *query, int querylen, u_char *ans, int anssiz, int *resplen); struct res_sym { int number; /* Identifying number, like T_MX */ const char * name; /* Its symbolic name, like "MX" */ const char * humanname; /* Its fun name, like "mail exchanger" */ }; /* * Global defines and variables for resolver stub. */ #define MAXNS 3 /* max # name servers we'll track */ #define MAXDFLSRCH 3 /* # default domain levels to try */ #define MAXDNSRCH 6 /* max # domains in search path */ #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ #define RES_TIMEOUT 5 /* min. seconds between retries */ #define MAXRESOLVSORT 10 /* number of net to sort on */ #define RES_MAXNDOTS 15 /* should reflect bit field size */ #define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ #define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ #define RES_DFLRETRY 2 /* Default #/tries. */ #define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ struct __res_state_ext; struct __res_state { int retrans; /* retransmission time interval */ int retry; /* number of times to retransmit */ u_long options; /* option flags - see below. */ int nscount; /* number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ #define nsaddr nsaddr_list[0] /* for backward compatibility */ u_short id; /* current message id */ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ char defdname[256]; /* default domain (deprecated) */ u_long pfcode; /* RES_PRF_ flags - see below. */ unsigned ndots:4; /* threshold for initial abs. query */ unsigned nsort:4; /* number of elements in sort_list[] */ char unused[3]; struct { struct in_addr addr; u_int32_t mask; } sort_list[MAXRESOLVSORT]; res_send_qhook qhook; /* query hook */ res_send_rhook rhook; /* response hook */ int res_h_errno; /* last one set for this context */ int _vcsock; /* PRIVATE: for res_send VC i/o */ __u_int _flags; /* PRIVATE: see below */ __u_int _pad; /* make _u 64 bit aligned */ union { /* On an 32-bit arch this means 512b total. */ char pad[72 - 4*sizeof (int) - 2*sizeof (void *)]; struct { u_int16_t nscount; u_int16_t nstimes[MAXNS]; /* ms. */ int nssocks[MAXNS]; struct __res_state_ext *ext; /* extention for IPv6 */ /* the server we just talked to */ struct sockaddr_in last_nsaddr; } _ext; } _u; #define last_ns _u._ext.last_nsaddr }; typedef struct __res_state *res_state; union res_sockaddr_union { struct sockaddr_in sin; #ifdef IN6ADDR_ANY_INIT struct sockaddr_in6 sin6; #endif #ifdef ISC_ALIGN64 int64_t __align64; /* 64bit alignment */ #else int32_t __align32; /* 32bit alignment */ #endif char __space[128]; /* max size */ }; /* * Resolver flags (used to be discrete per-module statics ints). */ #define RES_F_VC 0x00000001 /* socket is TCP */ #define RES_F_CONN 0x00000002 /* socket is connected */ #define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ #define RES_F__UNUSED 0x00000008 /* (unused) */ #define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */ #define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */ #define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT) /* res_findzonecut2() options */ #define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ #define RES_IPV4ONLY 0x00000002 /* IPv4 only */ #define RES_IPV6ONLY 0x00000004 /* IPv6 only */ /* * Resolver options (keep these in synch with res_debug.c, please) */ #define RES_INIT 0x00000001 /* address initialized */ #define RES_DEBUG 0x00000002 /* print debug messages */ #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ #define RES_USEVC 0x00000008 /* use virtual circuit */ #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ #define RES_IGNTC 0x00000020 /* ignore trucation errors */ #define RES_RECURSE 0x00000040 /* recursion desired */ #define RES_DEFNAMES 0x00000080 /* use default domain name */ #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ #define RES_DNSRCH 0x00000200 /* search up local domain tree */ #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ #define RES_ROTATE 0x00004000 /* rotate ns list after each query */ #define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ #define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ #define RES_BLAST 0x00020000 /* blast all recursive servers */ #define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */ #define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */ /* KAME extensions: use higher bit to avoid conflict with ISC use */ #define RES_USE_DNAME 0x10000000 /* use DNAME */ #define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */ #define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */ #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \ RES_DNSRCH | RES_NO_NIBBLE2) /* * Resolver "pfcode" values. Used by dig. */ #define RES_PRF_STATS 0x00000001 #define RES_PRF_UPDATE 0x00000002 #define RES_PRF_CLASS 0x00000004 #define RES_PRF_CMD 0x00000008 #define RES_PRF_QUES 0x00000010 #define RES_PRF_ANS 0x00000020 #define RES_PRF_AUTH 0x00000040 #define RES_PRF_ADD 0x00000080 #define RES_PRF_HEAD1 0x00000100 #define RES_PRF_HEAD2 0x00000200 #define RES_PRF_TTLID 0x00000400 #define RES_PRF_HEADX 0x00000800 #define RES_PRF_QUERY 0x00001000 #define RES_PRF_REPLY 0x00002000 #define RES_PRF_INIT 0x00004000 #define RES_PRF_TRUNC 0x00008000 /* 0x00010000 */ #ifdef _REENTRANT #ifdef __TCPIP_NO_RES_TRANSLITERATIONS extern struct __res_state *__res_state(void); #define _res (*__res_state()) #else extern struct __res_state *TCPIP$__RES_STATE(void); #define _res (*TCPIP$__RES_STATE()) #endif /* __TCPIP_NO_RES_TRANSLITERATIONS */ #else #ifndef __BIND_NOSTATIC extern struct __res_state _res; #endif #endif /* _REENTRANT */ /* ** The following functions are not defined in the DECC$SHR image, but ** instead must be resolved with the TCPIP images. ** ** If the user has not defined __TCPIP_NO_RES_TRANSLITERATIONS, ** we will define these functions as their TCPIP$ replacements. */ #if defined __TCPIP_NO_RES_TRANSLITERATIONS extern const struct res_sym __p_class_syms[]; extern const struct res_sym __p_type_syms[]; #else extern const struct res_sym *TCPIP$P_CLASS_SYMS(); extern const struct res_sym *TCPIP$P_TYPE_SYMS(); #define res_hnok TCPIP$RES_HNOK #define res_ownok TCPIP$RES_OWNOK #define res_mailok TCPIP$RES_MAILOK #define res_dnok TCPIP$RES_DNOK #define sym_ston TCPIP$SYM_STON #define sym_ntos TCPIP$SYM_NTOS #define sym_ntop TCPIP$SYM_NTOP #define b64_ntop TCPIP$B64_NTOP #define b64_pton TCPIP$B64_PTON #define loc_ntoa TCPIP$LOC_NTOA #define loc_aton TCPIP$LOC_ATON #define fp_resstat TCPIP$FP_RESSTAT #define p_query TCPIP$P_QUERY #define dn_skipname TCPIP$DN_SKIPNAME #define fp_resstat TCPIP$FP_RESSTAT #define fp_query TCPIP$FP_QUERY #define fp_nquery TCPIP$FP_NQUERY #define putlong TCPIP$PUTLONG #define putshort TCPIP$PUTSHORT #define p_class TCPIP$P_CLASS #define p_time TCPIP$P_TIME #define p_type TCPIP$P_TYPE #define p_query TCPIP$P_QUERY #define p_cdnname TCPIP$P_CDNNAME #define p_section TCPIP$P_SECTION #define p_cdname TCPIP$P_CDNAME #define p_fqnname TCPIP$P_FQNNAME #define p_fqname TCPIP$P_FQNAME #define p_option TCPIP$P_OPTION #define p_secstodate TCPIP$P_SECSTODATE #define dn_count_labels TCPIP$DN_COUNT_LABELS #define dn_comp TCPIP$DN_COMP #define dn_expand TCPIP$DN_EXPAND #define res_init TCPIP$RES_INIT #define res_init_access TCPIP$RES_INIT_ACCESS #define res_randomid TCPIP$RES_RANDOMID #define res_query TCPIP$RES_QUERY #define res_search TCPIP$RES_SEARCH #define res_querydomain TCPIP$RES_QUERYDOMAIN #define res_mkquery TCPIP$RES_MKQUERY #define res_send TCPIP$RES_SEND #define res_isourserver TCPIP$RES_ISOURSERVER #define res_nameinquery TCPIP$RES_NAMEINQUERY #define res_queriesmatch TCPIP$RES_QUERIESMATCH #define res_close TCPIP$RES_CLOSE #define res_update TCPIP$RES_UPDATE #define res_mkupdate TCPIP$RES_MKUPDATE #define res_mkupdrec TCPIP$RES_MKUPDREC #define res_freeupdrec TCPIP$RES_FREEUPDREC #define res_alloc_updrec TCPIP$RES_ALLOC_UPDREC #define res_zone_update TCPIP$RES_ZONE_UPDATE #define __p_class_syms (TCPIP$P_CLASS_SYMS()) #define __p_type_syms (TCPIP$P_TYPE_SYMS()) #define _res_opcodes TCPIP$RES_OPCODES #define _res_sectioncodes TCPIP$RES_SECTION_CODES /* hostalias defined in decc rtl */ #endif /* __TCPIP_NO_RES_TRANSLITERATIONS */ /* ** Function prototypes */ int res_hnok (const char *); int res_ownok (const char *); int res_mailok (const char *); int res_dnok (const char *); int sym_ston (const struct res_sym *, const char *, int *); __const_char_ptr32 sym_ntos (const struct res_sym *, int, int *); __const_char_ptr32 sym_ntop (const struct res_sym *, int, int *); int b64_ntop (u_char const *, size_t, char *, size_t); int b64_pton (char const *, u_char *, size_t); int loc_aton (const char *ascii, u_char *binary); __const_char_ptr32 loc_ntoa (const u_char *binary, char *ascii); int dn_skipname (const u_char *, const u_char *); void fp_resstat (struct __res_state *, FILE *); void fp_query (const u_char *, FILE *); void fp_nquery (const u_char *, int, FILE *); void putlong (u_int32_t, u_char *); void putshort (u_int16_t, u_char *); __char_ptr32 p_class (int); __char_ptr32 p_time (u_int32_t); __char_ptr32 p_type (int); void p_query (const u_char *); __u_char_ptr32 p_cdnname (const u_char *, const u_char *, int, FILE *); __u_char_ptr32 p_cdname (const u_char *, const u_char *, FILE *); __u_char_ptr32 p_fqnname (const u_char *cp, const u_char *msg, int, char *, int); __const_u_char_ptr32 p_fqname (const u_char *, const u_char *, FILE *); __char_ptr32 p_option (u_long option); __char_ptr32 p_secstodate (u_long); int dn_count_labels (const char *); int dn_comp (const char *, u_char *, int, u_char **, u_char **); int dn_expand (const u_char *, const u_char *, const u_char *, char *, int); int res_init (void); __u_int res_randomid (void); int res_query (const char *, int, int, u_char *, int); int res_search (const char *, int, int, u_char *, int); int res_querydomain (const char *, const char *, int, int, u_char *, int); int res_mkquery (int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int); int res_send (const u_char *, int, u_char *, int); int res_isourserver (const struct sockaddr_in *); int res_nameinquery (const char *, int, int, const u_char *, const u_char *); int res_queriesmatch (const u_char *, const u_char *, const u_char *, const u_char *); void res_close (void); __char_ptr32 p_section (int section, int opcode); int res_update (ns_updrec *); int res_mkupdate (ns_updrec *, u_char *, int); ns_updrec * res_mkupdrec (int, const char *, __u_int, __u_int, u_long); void res_freeupdrec (ns_updrec *); ns_updrec * res_alloc_updrec (__u_int, __u_int, const char *, __u_int, __u_int, u_long, __u_int, char *); int res_zone_update (ns_updrec *); /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #endif /* __CRTL_VER */ #pragma __standard #endif /* __RESOLV_LOADED */