12321c474SPedro F. Giffuni /*- 26e778a7eSPedro F. Giffuni * SPDX-License-Identifier: (ISC AND BSD-3-Clause) 32321c474SPedro F. Giffuni * 4046c3635SPedro F. Giffuni * Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC") 5046c3635SPedro F. Giffuni * Portions Copyright (C) 1995-2003 Internet Software Consortium. 6046c3635SPedro F. Giffuni * 7046c3635SPedro F. Giffuni * Permission to use, copy, modify, and/or distribute this software for any 8046c3635SPedro F. Giffuni * purpose with or without fee is hereby granted, provided that the above 9046c3635SPedro F. Giffuni * copyright notice and this permission notice appear in all copies. 10046c3635SPedro F. Giffuni * 11046c3635SPedro F. Giffuni * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12046c3635SPedro F. Giffuni * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13046c3635SPedro F. Giffuni * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14046c3635SPedro F. Giffuni * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15046c3635SPedro F. Giffuni * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16046c3635SPedro F. Giffuni * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17046c3635SPedro F. Giffuni * PERFORMANCE OF THIS SOFTWARE. 18046c3635SPedro F. Giffuni */ 19046c3635SPedro F. Giffuni 20046c3635SPedro F. Giffuni /* 215342d17fSHajimu UMEMOTO * Copyright (c) 1983, 1987, 1989 2259deaec5SRodney W. Grimes * The Regents of the University of California. All rights reserved. 2359deaec5SRodney W. Grimes * 2459deaec5SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 2559deaec5SRodney W. Grimes * modification, are permitted provided that the following conditions 2659deaec5SRodney W. Grimes * are met: 2759deaec5SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 2859deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 2959deaec5SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 3059deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 3159deaec5SRodney W. Grimes * documentation and/or other materials provided with the distribution. 32f2556687SWarner Losh * 3. Neither the name of the University nor the names of its contributors 3359deaec5SRodney W. Grimes * may be used to endorse or promote products derived from this software 3459deaec5SRodney W. Grimes * without specific prior written permission. 3559deaec5SRodney W. Grimes * 3659deaec5SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 3759deaec5SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3859deaec5SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3959deaec5SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 4059deaec5SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4159deaec5SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4259deaec5SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4359deaec5SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4459deaec5SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 4559deaec5SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 4659deaec5SRodney W. Grimes * SUCH DAMAGE. 470160f9c0SPeter Wemm */ 480160f9c0SPeter Wemm 49dde4a85dSHajimu UMEMOTO /*% 50046c3635SPedro F. Giffuni * $Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp $ 5159deaec5SRodney W. Grimes */ 5259deaec5SRodney W. Grimes 5359deaec5SRodney W. Grimes #ifndef _RESOLV_H_ 5459deaec5SRodney W. Grimes #define _RESOLV_H_ 5559deaec5SRodney W. Grimes 561363f04cSPaul Traina #include <sys/param.h> 5759deaec5SRodney W. Grimes #include <sys/types.h> 581363f04cSPaul Traina #include <sys/cdefs.h> 597d56d374SYoshinobu Inoue #include <sys/socket.h> 601363f04cSPaul Traina #include <stdio.h> 61*58cf91d3SJan Beich #include <netinet/in.h> 625342d17fSHajimu UMEMOTO #include <arpa/nameser.h> 631363f04cSPaul Traina 64dde4a85dSHajimu UMEMOTO /*% 65315d6d9cSPeter Wemm * Revision information. This is the release date in YYYYMMDD format. 66315d6d9cSPeter Wemm * It can change every day so the right thing to do with it is use it 67315d6d9cSPeter Wemm * in preprocessor commands such as "#if (__RES > 19931104)". Do not 681363f04cSPaul Traina * compare for equality; rather, use it to determine whether your resolver 691363f04cSPaul Traina * is new enough to contain a certain feature. 701363f04cSPaul Traina */ 711363f04cSPaul Traina 72046c3635SPedro F. Giffuni #define __RES 20090302 735342d17fSHajimu UMEMOTO 74dde4a85dSHajimu UMEMOTO /*% 755342d17fSHajimu UMEMOTO * This used to be defined in res_query.c, now it's in herror.c. 765342d17fSHajimu UMEMOTO * [XXX no it's not. It's in irs/irs_data.c] 775342d17fSHajimu UMEMOTO * It was 785342d17fSHajimu UMEMOTO * never extern'd by any *.h file before it was placed here. For thread 795342d17fSHajimu UMEMOTO * aware programs, the last h_errno value set is stored in res->h_errno. 805342d17fSHajimu UMEMOTO * 815342d17fSHajimu UMEMOTO * XXX: There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO 825342d17fSHajimu UMEMOTO * (and __h_errno_set) to the public via <resolv.h>. 835342d17fSHajimu UMEMOTO * XXX: __h_errno_set is really part of IRS, not part of the resolver. 845342d17fSHajimu UMEMOTO * If somebody wants to build and use a resolver that doesn't use IRS, 855342d17fSHajimu UMEMOTO * what do they do? Perhaps something like 865342d17fSHajimu UMEMOTO * #ifdef WANT_IRS 875342d17fSHajimu UMEMOTO * # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) 885342d17fSHajimu UMEMOTO * #else 895342d17fSHajimu UMEMOTO * # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x)) 905342d17fSHajimu UMEMOTO * #endif 915342d17fSHajimu UMEMOTO */ 925342d17fSHajimu UMEMOTO 935342d17fSHajimu UMEMOTO #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) 94dde4a85dSHajimu UMEMOTO struct __res_state; /*%< forward */ 955342d17fSHajimu UMEMOTO __BEGIN_DECLS 965342d17fSHajimu UMEMOTO void __h_errno_set(struct __res_state *, int); 975342d17fSHajimu UMEMOTO __END_DECLS 981363f04cSPaul Traina 99dde4a85dSHajimu UMEMOTO /*% 10059deaec5SRodney W. Grimes * Resolver configuration file. 10159deaec5SRodney W. Grimes * Normally not present, but may contain the address of the 1025342d17fSHajimu UMEMOTO * initial name server(s) to query and the domain search list. 10359deaec5SRodney W. Grimes */ 10459deaec5SRodney W. Grimes 10559deaec5SRodney W. Grimes #ifndef _PATH_RESCONF 10659deaec5SRodney W. Grimes #define _PATH_RESCONF "/etc/resolv.conf" 10759deaec5SRodney W. Grimes #endif 10859deaec5SRodney W. Grimes 1095342d17fSHajimu UMEMOTO typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } 1105342d17fSHajimu UMEMOTO res_sendhookact; 1115342d17fSHajimu UMEMOTO 1125342d17fSHajimu UMEMOTO typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *, 1135342d17fSHajimu UMEMOTO const u_char **, int *, 1145342d17fSHajimu UMEMOTO u_char *, int, int *); 1155342d17fSHajimu UMEMOTO 1165342d17fSHajimu UMEMOTO typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *, 1175342d17fSHajimu UMEMOTO const u_char *, int, u_char *, 1185342d17fSHajimu UMEMOTO int, int *); 1195342d17fSHajimu UMEMOTO 1205342d17fSHajimu UMEMOTO struct res_sym { 121dde4a85dSHajimu UMEMOTO int number; /*%< Identifying number, like T_MX */ 122dde4a85dSHajimu UMEMOTO const char * name; /*%< Its symbolic name, like "MX" */ 123dde4a85dSHajimu UMEMOTO const char * humanname; /*%< Its fun name, like "mail exchanger" */ 1245342d17fSHajimu UMEMOTO }; 1255342d17fSHajimu UMEMOTO 126dde4a85dSHajimu UMEMOTO /*% 12759deaec5SRodney W. Grimes * Global defines and variables for resolver stub. 12859deaec5SRodney W. Grimes */ 129dde4a85dSHajimu UMEMOTO #define MAXNS 3 /*%< max # name servers we'll track */ 130dde4a85dSHajimu UMEMOTO #define MAXDFLSRCH 3 /*%< # default domain levels to try */ 131dde4a85dSHajimu UMEMOTO #define MAXDNSRCH 6 /*%< max # domains in search path */ 132dde4a85dSHajimu UMEMOTO #define LOCALDOMAINPARTS 2 /*%< min levels in name that is "local" */ 133dde4a85dSHajimu UMEMOTO #define RES_TIMEOUT 5 /*%< min. seconds between retries */ 134dde4a85dSHajimu UMEMOTO #define MAXRESOLVSORT 10 /*%< number of net to sort on */ 135dde4a85dSHajimu UMEMOTO #define RES_MAXNDOTS 15 /*%< should reflect bit field size */ 136dde4a85dSHajimu UMEMOTO #define RES_MAXRETRANS 30 /*%< only for resolv.conf/RES_OPTIONS */ 137dde4a85dSHajimu UMEMOTO #define RES_MAXRETRY 5 /*%< only for resolv.conf/RES_OPTIONS */ 138dde4a85dSHajimu UMEMOTO #define RES_DFLRETRY 2 /*%< Default #/tries. */ 139dde4a85dSHajimu UMEMOTO #define RES_MAXTIME 65535 /*%< Infinity, in milliseconds. */ 1405342d17fSHajimu UMEMOTO struct __res_state_ext; 14159deaec5SRodney W. Grimes 14259deaec5SRodney W. Grimes struct __res_state { 143dde4a85dSHajimu UMEMOTO int retrans; /*%< retransmission time interval */ 144dde4a85dSHajimu UMEMOTO int retry; /*%< number of times to retransmit */ 1455342d17fSHajimu UMEMOTO /* 1465342d17fSHajimu UMEMOTO * XXX: If `sun' is defined, `options' and `pfcode' are 1475342d17fSHajimu UMEMOTO * defined as u_int in original BIND9 distribution. However, 1485342d17fSHajimu UMEMOTO * it breaks binary backward compatibility against FreeBSD's 1495342d17fSHajimu UMEMOTO * resolver. So, we changed not to see `sun'. 1505342d17fSHajimu UMEMOTO */ 1515342d17fSHajimu UMEMOTO #if defined(sun) && 0 152dde4a85dSHajimu UMEMOTO u_int options; /*%< option flags - see below. */ 1535342d17fSHajimu UMEMOTO #else 154dde4a85dSHajimu UMEMOTO u_long options; /*%< option flags - see below. */ 1555342d17fSHajimu UMEMOTO #endif 156dde4a85dSHajimu UMEMOTO int nscount; /*%< number of name servers */ 1571363f04cSPaul Traina struct sockaddr_in 158dde4a85dSHajimu UMEMOTO nsaddr_list[MAXNS]; /*%< address of name server */ 159dde4a85dSHajimu UMEMOTO #define nsaddr nsaddr_list[0] /*%< for backward compatibility */ 160dde4a85dSHajimu UMEMOTO u_short id; /*%< current message id */ 161dde4a85dSHajimu UMEMOTO char *dnsrch[MAXDNSRCH+1]; /*%< components of domain to search */ 162dde4a85dSHajimu UMEMOTO char defdname[256]; /*%< default domain (deprecated) */ 1635342d17fSHajimu UMEMOTO #if defined(sun) && 0 164dde4a85dSHajimu UMEMOTO u_int pfcode; /*%< RES_PRF_ flags - see below. */ 1655342d17fSHajimu UMEMOTO #else 166dde4a85dSHajimu UMEMOTO u_long pfcode; /*%< RES_PRF_ flags - see below. */ 1675342d17fSHajimu UMEMOTO #endif 168dde4a85dSHajimu UMEMOTO unsigned ndots:4; /*%< threshold for initial abs. query */ 169dde4a85dSHajimu UMEMOTO unsigned nsort:4; /*%< number of elements in sort_list[] */ 1701363f04cSPaul Traina char unused[3]; 1711363f04cSPaul Traina struct { 1721363f04cSPaul Traina struct in_addr addr; 1731363f04cSPaul Traina u_int32_t mask; 1741363f04cSPaul Traina } sort_list[MAXRESOLVSORT]; 175dde4a85dSHajimu UMEMOTO res_send_qhook qhook; /*%< query hook */ 176dde4a85dSHajimu UMEMOTO res_send_rhook rhook; /*%< response hook */ 177dde4a85dSHajimu UMEMOTO int res_h_errno; /*%< last one set for this context */ 178dde4a85dSHajimu UMEMOTO int _vcsock; /*%< PRIVATE: for res_send VC i/o */ 179dde4a85dSHajimu UMEMOTO u_int _flags; /*%< PRIVATE: see below */ 180c70540ecSEric van Gyzen u_int _pad; /*%< make _u 64 bit aligned */ 1815342d17fSHajimu UMEMOTO union { 1825342d17fSHajimu UMEMOTO /* On an 32-bit arch this means 512b total. */ 183e4576472SHajimu UMEMOTO char pad[72 - 4*sizeof (int) - 3*sizeof (void *)]; 1845342d17fSHajimu UMEMOTO struct { 1855342d17fSHajimu UMEMOTO u_int16_t nscount; 186dde4a85dSHajimu UMEMOTO u_int16_t nstimes[MAXNS]; /*%< ms. */ 1875342d17fSHajimu UMEMOTO int nssocks[MAXNS]; 1882f98c0baSUlrich Spörlein struct __res_state_ext *ext; /*%< extension for IPv6 */ 1895342d17fSHajimu UMEMOTO } _ext; 1905342d17fSHajimu UMEMOTO } _u; 191e4576472SHajimu UMEMOTO u_char *_rnd; /*%< PRIVATE: random state */ 19259deaec5SRodney W. Grimes }; 19359deaec5SRodney W. Grimes 1945342d17fSHajimu UMEMOTO typedef struct __res_state *res_state; 1955342d17fSHajimu UMEMOTO 1965342d17fSHajimu UMEMOTO union res_sockaddr_union { 1975342d17fSHajimu UMEMOTO struct sockaddr_in sin; 1985342d17fSHajimu UMEMOTO #ifdef IN6ADDR_ANY_INIT 1995342d17fSHajimu UMEMOTO struct sockaddr_in6 sin6; 2005342d17fSHajimu UMEMOTO #endif 2015342d17fSHajimu UMEMOTO #ifdef ISC_ALIGN64 202dde4a85dSHajimu UMEMOTO int64_t __align64; /*%< 64bit alignment */ 2035342d17fSHajimu UMEMOTO #else 204dde4a85dSHajimu UMEMOTO int32_t __align32; /*%< 32bit alignment */ 2055342d17fSHajimu UMEMOTO #endif 206dde4a85dSHajimu UMEMOTO char __space[128]; /*%< max size */ 2077d56d374SYoshinobu Inoue }; 2087d56d374SYoshinobu Inoue 209dde4a85dSHajimu UMEMOTO /*% 2105342d17fSHajimu UMEMOTO * Resolver flags (used to be discrete per-module statics ints). 2115342d17fSHajimu UMEMOTO */ 212dde4a85dSHajimu UMEMOTO #define RES_F_VC 0x00000001 /*%< socket is TCP */ 213dde4a85dSHajimu UMEMOTO #define RES_F_CONN 0x00000002 /*%< socket is connected */ 214dde4a85dSHajimu UMEMOTO #define RES_F_EDNS0ERR 0x00000004 /*%< EDNS0 caused errors */ 215dde4a85dSHajimu UMEMOTO #define RES_F__UNUSED 0x00000008 /*%< (unused) */ 216dde4a85dSHajimu UMEMOTO #define RES_F_LASTMASK 0x000000F0 /*%< ordinal server of last res_nsend */ 217dde4a85dSHajimu UMEMOTO #define RES_F_LASTSHIFT 4 /*%< bit position of LASTMASK "flag" */ 2185342d17fSHajimu UMEMOTO #define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT) 2195342d17fSHajimu UMEMOTO 2205342d17fSHajimu UMEMOTO /* res_findzonecut2() options */ 221dde4a85dSHajimu UMEMOTO #define RES_EXHAUSTIVE 0x00000001 /*%< always do all queries */ 222dde4a85dSHajimu UMEMOTO #define RES_IPV4ONLY 0x00000002 /*%< IPv4 only */ 223dde4a85dSHajimu UMEMOTO #define RES_IPV6ONLY 0x00000004 /*%< IPv6 only */ 2245342d17fSHajimu UMEMOTO 225dde4a85dSHajimu UMEMOTO /*% 22659deaec5SRodney W. Grimes * Resolver options (keep these in synch with res_debug.c, please) 22759deaec5SRodney W. Grimes */ 228dde4a85dSHajimu UMEMOTO #define RES_INIT 0x00000001 /*%< address initialized */ 229dde4a85dSHajimu UMEMOTO #define RES_DEBUG 0x00000002 /*%< print debug messages */ 230dde4a85dSHajimu UMEMOTO #define RES_AAONLY 0x00000004 /*%< authoritative answers only (!IMPL)*/ 231dde4a85dSHajimu UMEMOTO #define RES_USEVC 0x00000008 /*%< use virtual circuit */ 232dde4a85dSHajimu UMEMOTO #define RES_PRIMARY 0x00000010 /*%< query primary server only (!IMPL) */ 233dde4a85dSHajimu UMEMOTO #define RES_IGNTC 0x00000020 /*%< ignore truncation errors */ 234dde4a85dSHajimu UMEMOTO #define RES_RECURSE 0x00000040 /*%< recursion desired */ 235dde4a85dSHajimu UMEMOTO #define RES_DEFNAMES 0x00000080 /*%< use default domain name */ 236dde4a85dSHajimu UMEMOTO #define RES_STAYOPEN 0x00000100 /*%< Keep TCP socket open */ 237dde4a85dSHajimu UMEMOTO #define RES_DNSRCH 0x00000200 /*%< search up local domain tree */ 238dde4a85dSHajimu UMEMOTO #define RES_INSECURE1 0x00000400 /*%< type 1 security disabled */ 239dde4a85dSHajimu UMEMOTO #define RES_INSECURE2 0x00000800 /*%< type 2 security disabled */ 240dde4a85dSHajimu UMEMOTO #define RES_NOALIASES 0x00001000 /*%< shuts off HOSTALIASES feature */ 241dde4a85dSHajimu UMEMOTO #define RES_USE_INET6 0x00002000 /*%< use/map IPv6 in gethostbyname() */ 242dde4a85dSHajimu UMEMOTO #define RES_ROTATE 0x00004000 /*%< rotate ns list after each query */ 243dde4a85dSHajimu UMEMOTO #define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */ 244dde4a85dSHajimu UMEMOTO #define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */ 245dde4a85dSHajimu UMEMOTO #define RES_BLAST 0x00020000 /*%< blast all recursive servers */ 24654ebdd63SHajimu UMEMOTO #define RES_NSID 0x00040000 /*%< request name server ID */ 247dde4a85dSHajimu UMEMOTO #define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */ 248dde4a85dSHajimu UMEMOTO #define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */ 2495342d17fSHajimu UMEMOTO /* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */ 250ce6282dbSHajimu UMEMOTO /* KAME extensions: use higher bit to avoid conflict with ISC use */ 251dde4a85dSHajimu UMEMOTO #define RES_USE_DNAME 0x10000000 /*%< use DNAME */ 252dde4a85dSHajimu UMEMOTO #define RES_USE_EDNS0 0x40000000 /*%< use EDNS0 if configured */ 253dde4a85dSHajimu UMEMOTO #define RES_NO_NIBBLE2 0x80000000 /*%< disable alternate nibble lookup */ 25459deaec5SRodney W. Grimes 2555342d17fSHajimu UMEMOTO #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \ 2565342d17fSHajimu UMEMOTO RES_DNSRCH | RES_NO_NIBBLE2) 25759deaec5SRodney W. Grimes 258dde4a85dSHajimu UMEMOTO /*% 25959deaec5SRodney W. Grimes * Resolver "pfcode" values. Used by dig. 26059deaec5SRodney W. Grimes */ 2611363f04cSPaul Traina #define RES_PRF_STATS 0x00000001 2620160f9c0SPeter Wemm #define RES_PRF_UPDATE 0x00000002 2631363f04cSPaul Traina #define RES_PRF_CLASS 0x00000004 2641363f04cSPaul Traina #define RES_PRF_CMD 0x00000008 2651363f04cSPaul Traina #define RES_PRF_QUES 0x00000010 2661363f04cSPaul Traina #define RES_PRF_ANS 0x00000020 2671363f04cSPaul Traina #define RES_PRF_AUTH 0x00000040 2681363f04cSPaul Traina #define RES_PRF_ADD 0x00000080 2691363f04cSPaul Traina #define RES_PRF_HEAD1 0x00000100 2701363f04cSPaul Traina #define RES_PRF_HEAD2 0x00000200 2711363f04cSPaul Traina #define RES_PRF_TTLID 0x00000400 2721363f04cSPaul Traina #define RES_PRF_HEADX 0x00000800 2731363f04cSPaul Traina #define RES_PRF_QUERY 0x00001000 2741363f04cSPaul Traina #define RES_PRF_REPLY 0x00002000 2751363f04cSPaul Traina #define RES_PRF_INIT 0x00004000 2765342d17fSHajimu UMEMOTO #define RES_PRF_TRUNC 0x00008000 2775342d17fSHajimu UMEMOTO /* 0x00010000 */ 27859deaec5SRodney W. Grimes 2795342d17fSHajimu UMEMOTO /* Things involving an internal (static) resolver context. */ 2805342d17fSHajimu UMEMOTO __BEGIN_DECLS 2815342d17fSHajimu UMEMOTO extern struct __res_state *__res_state(void); 2825342d17fSHajimu UMEMOTO __END_DECLS 2835342d17fSHajimu UMEMOTO #define _res (*__res_state()) 2841363f04cSPaul Traina 2855342d17fSHajimu UMEMOTO #ifndef __BIND_NOSTATIC 2865342d17fSHajimu UMEMOTO #define fp_nquery __fp_nquery 2875342d17fSHajimu UMEMOTO #define fp_query __fp_query 2885342d17fSHajimu UMEMOTO #define hostalias __hostalias 2895342d17fSHajimu UMEMOTO #define p_query __p_query 2905342d17fSHajimu UMEMOTO #define res_close __res_close 2915342d17fSHajimu UMEMOTO #define res_init __res_init 2925342d17fSHajimu UMEMOTO #define res_isourserver __res_isourserver 2935342d17fSHajimu UMEMOTO #define res_mkquery __res_mkquery 2945342d17fSHajimu UMEMOTO #define res_opt __res_opt 2955342d17fSHajimu UMEMOTO #define res_query __res_query 2965342d17fSHajimu UMEMOTO #define res_querydomain __res_querydomain 2975342d17fSHajimu UMEMOTO #define res_search __res_search 2985342d17fSHajimu UMEMOTO #define res_send __res_send 2995342d17fSHajimu UMEMOTO #define res_sendsigned __res_sendsigned 300315d6d9cSPeter Wemm 30133dee819SBrian Feldman __BEGIN_DECLS 3025342d17fSHajimu UMEMOTO void fp_nquery(const u_char *, int, FILE *); 3035342d17fSHajimu UMEMOTO void fp_query(const u_char *, FILE *); 3045342d17fSHajimu UMEMOTO const char * hostalias(const char *); 3055342d17fSHajimu UMEMOTO void p_query(const u_char *); 3065342d17fSHajimu UMEMOTO void res_close(void); 3075342d17fSHajimu UMEMOTO int res_init(void); 3085342d17fSHajimu UMEMOTO int res_isourserver(const struct sockaddr_in *); 3095342d17fSHajimu UMEMOTO int res_mkquery(int, const char *, int, int, const u_char *, 3105342d17fSHajimu UMEMOTO int, const u_char *, u_char *, int); 3115342d17fSHajimu UMEMOTO int res_opt(int, u_char *, int, int); 3125342d17fSHajimu UMEMOTO int res_query(const char *, int, int, u_char *, int); 3135342d17fSHajimu UMEMOTO int res_querydomain(const char *, const char *, int, int, 3145342d17fSHajimu UMEMOTO u_char *, int); 3155342d17fSHajimu UMEMOTO int res_search(const char *, int, int, u_char *, int); 3165342d17fSHajimu UMEMOTO int res_send(const u_char *, int, u_char *, int); 3175342d17fSHajimu UMEMOTO int res_sendsigned(const u_char *, int, ns_tsig_key *, 3185342d17fSHajimu UMEMOTO u_char *, int); 31933dee819SBrian Feldman __END_DECLS 3205342d17fSHajimu UMEMOTO #endif 3217d56d374SYoshinobu Inoue 3225342d17fSHajimu UMEMOTO #if !defined(SHARED_LIBBIND) || defined(LIB) 3235342d17fSHajimu UMEMOTO /* 3245342d17fSHajimu UMEMOTO * If libbind is a shared object (well, DLL anyway) 3255342d17fSHajimu UMEMOTO * these externs break the linker when resolv.h is 3265342d17fSHajimu UMEMOTO * included by a lib client (like named) 3275342d17fSHajimu UMEMOTO * Make them go away if a client is including this 3285342d17fSHajimu UMEMOTO * 3295342d17fSHajimu UMEMOTO */ 3305342d17fSHajimu UMEMOTO extern const struct res_sym __p_key_syms[]; 3315342d17fSHajimu UMEMOTO extern const struct res_sym __p_cert_syms[]; 332315d6d9cSPeter Wemm extern const struct res_sym __p_class_syms[]; 333315d6d9cSPeter Wemm extern const struct res_sym __p_type_syms[]; 3345342d17fSHajimu UMEMOTO extern const struct res_sym __p_rcode_syms[]; 3355342d17fSHajimu UMEMOTO #endif /* SHARED_LIBBIND */ 33659deaec5SRodney W. Grimes 337315d6d9cSPeter Wemm #define b64_ntop __b64_ntop 338315d6d9cSPeter Wemm #define b64_pton __b64_pton 3395342d17fSHajimu UMEMOTO #define dn_comp __dn_comp 3405342d17fSHajimu UMEMOTO #define dn_count_labels __dn_count_labels 3415342d17fSHajimu UMEMOTO #define dn_expand __dn_expand 34259deaec5SRodney W. Grimes #define dn_skipname __dn_skipname 343315d6d9cSPeter Wemm #define fp_resstat __fp_resstat 3445342d17fSHajimu UMEMOTO #define loc_aton __loc_aton 3455342d17fSHajimu UMEMOTO #define loc_ntoa __loc_ntoa 3461363f04cSPaul Traina #define p_cdname __p_cdname 3475342d17fSHajimu UMEMOTO #define p_cdnname __p_cdnname 3485342d17fSHajimu UMEMOTO #define p_class __p_class 3491363f04cSPaul Traina #define p_fqname __p_fqname 3505342d17fSHajimu UMEMOTO #define p_fqnname __p_fqnname 3511363f04cSPaul Traina #define p_option __p_option 352315d6d9cSPeter Wemm #define p_secstodate __p_secstodate 3535342d17fSHajimu UMEMOTO #define p_section __p_section 3545342d17fSHajimu UMEMOTO #define p_time __p_time 3555342d17fSHajimu UMEMOTO #define p_type __p_type 3565342d17fSHajimu UMEMOTO #define p_rcode __p_rcode 3575342d17fSHajimu UMEMOTO #define p_sockun __p_sockun 3585342d17fSHajimu UMEMOTO #define putlong __putlong 3595342d17fSHajimu UMEMOTO #define putshort __putshort 3605342d17fSHajimu UMEMOTO #define res_dnok __res_dnok 3615342d17fSHajimu UMEMOTO #if 0 3625342d17fSHajimu UMEMOTO #define res_findzonecut __res_findzonecut 3635342d17fSHajimu UMEMOTO #endif 364d808369aSHajimu UMEMOTO #define res_findzonecut2 __res_findzonecut2 3655342d17fSHajimu UMEMOTO #define res_hnok __res_hnok 3665342d17fSHajimu UMEMOTO #define res_hostalias __res_hostalias 3675342d17fSHajimu UMEMOTO #define res_mailok __res_mailok 368d58a9efdSPeter Wemm #define res_nameinquery __res_nameinquery 3695342d17fSHajimu UMEMOTO #define res_nclose __res_nclose 3705342d17fSHajimu UMEMOTO #define res_ninit __res_ninit 3715342d17fSHajimu UMEMOTO #define res_nmkquery __res_nmkquery 3725342d17fSHajimu UMEMOTO #define res_pquery __res_pquery 3735342d17fSHajimu UMEMOTO #define res_nquery __res_nquery 3745342d17fSHajimu UMEMOTO #define res_nquerydomain __res_nquerydomain 3755342d17fSHajimu UMEMOTO #define res_nsearch __res_nsearch 3765342d17fSHajimu UMEMOTO #define res_nsend __res_nsend 3775342d17fSHajimu UMEMOTO #if 0 3785342d17fSHajimu UMEMOTO #define res_nsendsigned __res_nsendsigned 3795342d17fSHajimu UMEMOTO #endif 3805342d17fSHajimu UMEMOTO #define res_nisourserver __res_nisourserver 3815342d17fSHajimu UMEMOTO #define res_ownok __res_ownok 382d58a9efdSPeter Wemm #define res_queriesmatch __res_queriesmatch 383046c3635SPedro F. Giffuni #define res_rndinit __res_rndinit 3845342d17fSHajimu UMEMOTO #define res_randomid __res_randomid 385046c3635SPedro F. Giffuni #define res_nrandomid __res_nrandomid 3865342d17fSHajimu UMEMOTO #define sym_ntop __sym_ntop 3875342d17fSHajimu UMEMOTO #define sym_ntos __sym_ntos 3885342d17fSHajimu UMEMOTO #define sym_ston __sym_ston 3895342d17fSHajimu UMEMOTO #define res_nopt __res_nopt 39054ebdd63SHajimu UMEMOTO #define res_nopt_rdata __res_nopt_rdata 3915342d17fSHajimu UMEMOTO #define res_ndestroy __res_ndestroy 3925342d17fSHajimu UMEMOTO #define res_nametoclass __res_nametoclass 3935342d17fSHajimu UMEMOTO #define res_nametotype __res_nametotype 3945342d17fSHajimu UMEMOTO #define res_setservers __res_setservers 3955342d17fSHajimu UMEMOTO #define res_getservers __res_getservers 3962d39807fSHajimu UMEMOTO #if 0 3975342d17fSHajimu UMEMOTO #define res_buildprotolist __res_buildprotolist 3985342d17fSHajimu UMEMOTO #define res_destroyprotolist __res_destroyprotolist 3995342d17fSHajimu UMEMOTO #define res_destroyservicelist __res_destroyservicelist 4005342d17fSHajimu UMEMOTO #define res_get_nibblesuffix __res_get_nibblesuffix 4015342d17fSHajimu UMEMOTO #define res_get_nibblesuffix2 __res_get_nibblesuffix2 4025342d17fSHajimu UMEMOTO #endif 4035342d17fSHajimu UMEMOTO #define res_ourserver_p __res_ourserver_p 4042d39807fSHajimu UMEMOTO #if 0 4055342d17fSHajimu UMEMOTO #define res_protocolname __res_protocolname 4065342d17fSHajimu UMEMOTO #define res_protocolnumber __res_protocolnumber 4072d39807fSHajimu UMEMOTO #endif 4085342d17fSHajimu UMEMOTO #define res_send_setqhook __res_send_setqhook 4095342d17fSHajimu UMEMOTO #define res_send_setrhook __res_send_setrhook 4102d39807fSHajimu UMEMOTO #if 0 4115342d17fSHajimu UMEMOTO #define res_servicename __res_servicename 4125342d17fSHajimu UMEMOTO #define res_servicenumber __res_servicenumber 4132d39807fSHajimu UMEMOTO #endif 41459deaec5SRodney W. Grimes __BEGIN_DECLS 415bb28f3c2SWarner Losh int res_hnok(const char *); 416bb28f3c2SWarner Losh int res_ownok(const char *); 417bb28f3c2SWarner Losh int res_mailok(const char *); 418bb28f3c2SWarner Losh int res_dnok(const char *); 419bb28f3c2SWarner Losh int sym_ston(const struct res_sym *, const char *, int *); 420bb28f3c2SWarner Losh const char * sym_ntos(const struct res_sym *, int, int *); 421bb28f3c2SWarner Losh const char * sym_ntop(const struct res_sym *, int, int *); 422bb28f3c2SWarner Losh int b64_ntop(u_char const *, size_t, char *, size_t); 423bb28f3c2SWarner Losh int b64_pton(char const *, u_char *, size_t); 424bb28f3c2SWarner Losh int loc_aton(const char *, u_char *); 425bb28f3c2SWarner Losh const char * loc_ntoa(const u_char *, char *); 426bb28f3c2SWarner Losh int dn_skipname(const u_char *, const u_char *); 427bb28f3c2SWarner Losh void putlong(u_int32_t, u_char *); 428bb28f3c2SWarner Losh void putshort(u_int16_t, u_char *); 4295342d17fSHajimu UMEMOTO #ifndef __ultrix__ 4305342d17fSHajimu UMEMOTO u_int16_t _getshort(const u_char *); 4315342d17fSHajimu UMEMOTO u_int32_t _getlong(const u_char *); 4325342d17fSHajimu UMEMOTO #endif 433bb28f3c2SWarner Losh const char * p_class(int); 434bb28f3c2SWarner Losh const char * p_time(u_int32_t); 435bb28f3c2SWarner Losh const char * p_type(int); 4365342d17fSHajimu UMEMOTO const char * p_rcode(int); 4375342d17fSHajimu UMEMOTO const char * p_sockun(union res_sockaddr_union, char *, size_t); 438bb28f3c2SWarner Losh const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *); 439bb28f3c2SWarner Losh const u_char * p_cdname(const u_char *, const u_char *, FILE *); 4405342d17fSHajimu UMEMOTO const u_char * p_fqnname(const u_char *, const u_char *, int, char *, int); 441bb28f3c2SWarner Losh const u_char * p_fqname(const u_char *, const u_char *, FILE *); 442bb28f3c2SWarner Losh const char * p_option(u_long); 443bb28f3c2SWarner Losh char * p_secstodate(u_long); 444bb28f3c2SWarner Losh int dn_count_labels(const char *); 445bb28f3c2SWarner Losh int dn_comp(const char *, u_char *, int, u_char **, u_char **); 446bb28f3c2SWarner Losh int dn_expand(const u_char *, const u_char *, const u_char *, 447bb28f3c2SWarner Losh char *, int); 448e4576472SHajimu UMEMOTO void res_rndinit(res_state); 449bb28f3c2SWarner Losh u_int res_randomid(void); 450e4576472SHajimu UMEMOTO u_int res_nrandomid(res_state); 4515342d17fSHajimu UMEMOTO int res_nameinquery(const char *, int, int, const u_char *, 4525342d17fSHajimu UMEMOTO const u_char *); 453bb28f3c2SWarner Losh int res_queriesmatch(const u_char *, const u_char *, 454bb28f3c2SWarner Losh const u_char *, const u_char *); 455bb28f3c2SWarner Losh const char * p_section(int, int); 4565342d17fSHajimu UMEMOTO /* Things involving a resolver context. */ 4575342d17fSHajimu UMEMOTO int res_ninit(res_state); 4585342d17fSHajimu UMEMOTO int res_nisourserver(const res_state, const struct sockaddr_in *); 4595342d17fSHajimu UMEMOTO void fp_resstat(const res_state, FILE *); 4605342d17fSHajimu UMEMOTO void res_pquery(const res_state, const u_char *, int, FILE *); 4615342d17fSHajimu UMEMOTO const char * res_hostalias(const res_state, const char *, char *, size_t); 4625342d17fSHajimu UMEMOTO int res_nquery(res_state, const char *, int, int, u_char *, int); 4635342d17fSHajimu UMEMOTO int res_nsearch(res_state, const char *, int, int, u_char *, int); 4645342d17fSHajimu UMEMOTO int res_nquerydomain(res_state, const char *, const char *, 4655342d17fSHajimu UMEMOTO int, int, u_char *, int); 4665342d17fSHajimu UMEMOTO int res_nmkquery(res_state, int, const char *, int, int, 4675342d17fSHajimu UMEMOTO const u_char *, int, const u_char *, 4685342d17fSHajimu UMEMOTO u_char *, int); 4695342d17fSHajimu UMEMOTO int res_nsend(res_state, const u_char *, int, u_char *, int); 4705342d17fSHajimu UMEMOTO #if 0 4715342d17fSHajimu UMEMOTO int res_nsendsigned(res_state, const u_char *, int, 4725342d17fSHajimu UMEMOTO ns_tsig_key *, u_char *, int); 4735342d17fSHajimu UMEMOTO int res_findzonecut(res_state, const char *, ns_class, int, 4745342d17fSHajimu UMEMOTO char *, size_t, struct in_addr *, int); 475d808369aSHajimu UMEMOTO #endif 4765342d17fSHajimu UMEMOTO int res_findzonecut2(res_state, const char *, ns_class, int, 4775342d17fSHajimu UMEMOTO char *, size_t, 4785342d17fSHajimu UMEMOTO union res_sockaddr_union *, int); 4795342d17fSHajimu UMEMOTO void res_nclose(res_state); 4805342d17fSHajimu UMEMOTO int res_nopt(res_state, int, u_char *, int, int); 48154ebdd63SHajimu UMEMOTO int res_nopt_rdata(res_state, int, u_char *, int, u_char *, 48254ebdd63SHajimu UMEMOTO u_short, u_short, u_char *); 4835342d17fSHajimu UMEMOTO void res_send_setqhook(res_send_qhook); 4845342d17fSHajimu UMEMOTO void res_send_setrhook(res_send_rhook); 4855342d17fSHajimu UMEMOTO int __res_vinit(res_state, int); 4862d39807fSHajimu UMEMOTO #if 0 4875342d17fSHajimu UMEMOTO void res_destroyservicelist(void); 4885342d17fSHajimu UMEMOTO const char * res_servicename(u_int16_t, const char *); 4895342d17fSHajimu UMEMOTO const char * res_protocolname(int); 4905342d17fSHajimu UMEMOTO void res_destroyprotolist(void); 4915342d17fSHajimu UMEMOTO void res_buildprotolist(void); 4925342d17fSHajimu UMEMOTO const char * res_get_nibblesuffix(res_state); 4935342d17fSHajimu UMEMOTO const char * res_get_nibblesuffix2(res_state); 4945342d17fSHajimu UMEMOTO #endif 4955342d17fSHajimu UMEMOTO void res_ndestroy(res_state); 4965342d17fSHajimu UMEMOTO u_int16_t res_nametoclass(const char *, int *); 4975342d17fSHajimu UMEMOTO u_int16_t res_nametotype(const char *, int *); 4985342d17fSHajimu UMEMOTO void res_setservers(res_state, const union res_sockaddr_union *, 4995342d17fSHajimu UMEMOTO int); 5005342d17fSHajimu UMEMOTO int res_getservers(res_state, union res_sockaddr_union *, int); 50159deaec5SRodney W. Grimes __END_DECLS 50259deaec5SRodney W. Grimes 50359deaec5SRodney W. Grimes #endif /* !_RESOLV_H_ */ 504dde4a85dSHajimu UMEMOTO /*! \file */ 505