1570af302Sopenharmony_ci#ifndef _RESOLV_H 2570af302Sopenharmony_ci#define _RESOLV_H 3570af302Sopenharmony_ci 4570af302Sopenharmony_ci#include <stdint.h> 5570af302Sopenharmony_ci#include <arpa/nameser.h> 6570af302Sopenharmony_ci#include <netinet/in.h> 7570af302Sopenharmony_ci 8570af302Sopenharmony_ci#ifdef __cplusplus 9570af302Sopenharmony_ciextern "C" { 10570af302Sopenharmony_ci#endif 11570af302Sopenharmony_ci 12570af302Sopenharmony_ci#define MAXNS 3 13570af302Sopenharmony_ci#define MAXDFLSRCH 3 14570af302Sopenharmony_ci#define MAXDNSRCH 6 15570af302Sopenharmony_ci#define LOCALDOMAINPARTS 2 16570af302Sopenharmony_ci 17570af302Sopenharmony_ci#define RES_TIMEOUT 5 18570af302Sopenharmony_ci#define MAXRESOLVSORT 10 19570af302Sopenharmony_ci#define RES_MAXNDOTS 15 20570af302Sopenharmony_ci#define RES_MAXRETRANS 30 21570af302Sopenharmony_ci#define RES_MAXRETRY 5 22570af302Sopenharmony_ci#define RES_DFLRETRY 2 23570af302Sopenharmony_ci#define RES_MAXTIME 65535 24570af302Sopenharmony_ci 25570af302Sopenharmony_ci/* unused; purely for broken apps */ 26570af302Sopenharmony_citypedef struct __res_state { 27570af302Sopenharmony_ci int retrans; 28570af302Sopenharmony_ci int retry; 29570af302Sopenharmony_ci unsigned long options; 30570af302Sopenharmony_ci int nscount; 31570af302Sopenharmony_ci struct sockaddr_in nsaddr_list[MAXNS]; 32570af302Sopenharmony_ci# define nsaddr nsaddr_list[0] 33570af302Sopenharmony_ci unsigned short id; 34570af302Sopenharmony_ci char *dnsrch[MAXDNSRCH+1]; 35570af302Sopenharmony_ci char defdname[256]; 36570af302Sopenharmony_ci unsigned long pfcode; 37570af302Sopenharmony_ci unsigned ndots:4; 38570af302Sopenharmony_ci unsigned nsort:4; 39570af302Sopenharmony_ci unsigned ipv6_unavail:1; 40570af302Sopenharmony_ci unsigned unused:23; 41570af302Sopenharmony_ci struct { 42570af302Sopenharmony_ci struct in_addr addr; 43570af302Sopenharmony_ci uint32_t mask; 44570af302Sopenharmony_ci } sort_list[MAXRESOLVSORT]; 45570af302Sopenharmony_ci void *qhook; 46570af302Sopenharmony_ci void *rhook; 47570af302Sopenharmony_ci int res_h_errno; 48570af302Sopenharmony_ci int _vcsock; 49570af302Sopenharmony_ci unsigned _flags; 50570af302Sopenharmony_ci union { 51570af302Sopenharmony_ci char pad[52]; 52570af302Sopenharmony_ci struct { 53570af302Sopenharmony_ci uint16_t nscount; 54570af302Sopenharmony_ci uint16_t nsmap[MAXNS]; 55570af302Sopenharmony_ci int nssocks[MAXNS]; 56570af302Sopenharmony_ci uint16_t nscount6; 57570af302Sopenharmony_ci uint16_t nsinit; 58570af302Sopenharmony_ci struct sockaddr_in6 *nsaddrs[MAXNS]; 59570af302Sopenharmony_ci unsigned int _initstamp[2]; 60570af302Sopenharmony_ci } _ext; 61570af302Sopenharmony_ci } _u; 62570af302Sopenharmony_ci} *res_state; 63570af302Sopenharmony_ci 64570af302Sopenharmony_ci#define __RES 19960801 65570af302Sopenharmony_ci 66570af302Sopenharmony_ci#ifndef _PATH_RESCONF 67570af302Sopenharmony_ci#define _PATH_RESCONF "/etc/resolv.conf" 68570af302Sopenharmony_ci#endif 69570af302Sopenharmony_ci 70570af302Sopenharmony_cistruct res_sym { 71570af302Sopenharmony_ci int number; 72570af302Sopenharmony_ci char *name; 73570af302Sopenharmony_ci char *humanname; 74570af302Sopenharmony_ci}; 75570af302Sopenharmony_ci 76570af302Sopenharmony_ci#define RES_F_VC 0x00000001 77570af302Sopenharmony_ci#define RES_F_CONN 0x00000002 78570af302Sopenharmony_ci#define RES_F_EDNS0ERR 0x00000004 79570af302Sopenharmony_ci 80570af302Sopenharmony_ci#define RES_EXHAUSTIVE 0x00000001 81570af302Sopenharmony_ci 82570af302Sopenharmony_ci#define RES_INIT 0x00000001 83570af302Sopenharmony_ci#define RES_DEBUG 0x00000002 84570af302Sopenharmony_ci#define RES_AAONLY 0x00000004 85570af302Sopenharmony_ci#define RES_USEVC 0x00000008 86570af302Sopenharmony_ci#define RES_PRIMARY 0x00000010 87570af302Sopenharmony_ci#define RES_IGNTC 0x00000020 88570af302Sopenharmony_ci#define RES_RECURSE 0x00000040 89570af302Sopenharmony_ci#define RES_DEFNAMES 0x00000080 90570af302Sopenharmony_ci#define RES_STAYOPEN 0x00000100 91570af302Sopenharmony_ci#define RES_DNSRCH 0x00000200 92570af302Sopenharmony_ci#define RES_INSECURE1 0x00000400 93570af302Sopenharmony_ci#define RES_INSECURE2 0x00000800 94570af302Sopenharmony_ci#define RES_NOALIASES 0x00001000 95570af302Sopenharmony_ci#define RES_USE_INET6 0x00002000 96570af302Sopenharmony_ci#define RES_ROTATE 0x00004000 97570af302Sopenharmony_ci#define RES_NOCHECKNAME 0x00008000 98570af302Sopenharmony_ci#define RES_KEEPTSIG 0x00010000 99570af302Sopenharmony_ci#define RES_BLAST 0x00020000 100570af302Sopenharmony_ci#define RES_USEBSTRING 0x00040000 101570af302Sopenharmony_ci#define RES_NOIP6DOTINT 0x00080000 102570af302Sopenharmony_ci#define RES_USE_EDNS0 0x00100000 103570af302Sopenharmony_ci#define RES_SNGLKUP 0x00200000 104570af302Sopenharmony_ci#define RES_SNGLKUPREOP 0x00400000 105570af302Sopenharmony_ci#define RES_USE_DNSSEC 0x00800000 106570af302Sopenharmony_ci 107570af302Sopenharmony_ci#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) 108570af302Sopenharmony_ci 109570af302Sopenharmony_ci#define RES_PRF_STATS 0x00000001 110570af302Sopenharmony_ci#define RES_PRF_UPDATE 0x00000002 111570af302Sopenharmony_ci#define RES_PRF_CLASS 0x00000004 112570af302Sopenharmony_ci#define RES_PRF_CMD 0x00000008 113570af302Sopenharmony_ci#define RES_PRF_QUES 0x00000010 114570af302Sopenharmony_ci#define RES_PRF_ANS 0x00000020 115570af302Sopenharmony_ci#define RES_PRF_AUTH 0x00000040 116570af302Sopenharmony_ci#define RES_PRF_ADD 0x00000080 117570af302Sopenharmony_ci#define RES_PRF_HEAD1 0x00000100 118570af302Sopenharmony_ci#define RES_PRF_HEAD2 0x00000200 119570af302Sopenharmony_ci#define RES_PRF_TTLID 0x00000400 120570af302Sopenharmony_ci#define RES_PRF_HEADX 0x00000800 121570af302Sopenharmony_ci#define RES_PRF_QUERY 0x00001000 122570af302Sopenharmony_ci#define RES_PRF_REPLY 0x00002000 123570af302Sopenharmony_ci#define RES_PRF_INIT 0x00004000 124570af302Sopenharmony_ci 125570af302Sopenharmony_cistruct __res_state *__res_state(void); 126570af302Sopenharmony_ci#define _res (*__res_state()) 127570af302Sopenharmony_ci 128570af302Sopenharmony_ciint res_init(void); 129570af302Sopenharmony_ciint res_query(const char *, int, int, unsigned char *, int); 130570af302Sopenharmony_ciint res_querydomain(const char *, const char *, int, int, unsigned char *, int); 131570af302Sopenharmony_ciint res_search(const char *, int, int, unsigned char *, int); 132570af302Sopenharmony_ciint res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int); 133570af302Sopenharmony_ciint res_send(const unsigned char *, int, unsigned char *, int); 134570af302Sopenharmony_ciint dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **); 135570af302Sopenharmony_ciint dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int); 136570af302Sopenharmony_ciint dn_skipname(const unsigned char *, const unsigned char *); 137570af302Sopenharmony_ci 138570af302Sopenharmony_ci#ifdef __cplusplus 139570af302Sopenharmony_ci} 140570af302Sopenharmony_ci#endif 141570af302Sopenharmony_ci 142570af302Sopenharmony_ci#endif 143