sl@0: /*- sl@0: * Copyright (c) 1983, 1987, 1989, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: */ sl@0: sl@0: /* sl@0: * Portions Copyright (c) 1996 by Internet Software Consortium. sl@0: * sl@0: * Permission to use, copy, modify, and distribute this software for any sl@0: * purpose with or without fee is hereby granted, provided that the above sl@0: * copyright notice and this permission notice appear in all copies. sl@0: * sl@0: * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS sl@0: * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES sl@0: * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE sl@0: * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL sl@0: * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR sl@0: * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS sl@0: * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS sl@0: * SOFTWARE. sl@0: * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: */ sl@0: sl@0: /* sl@0: * @(#)resolv.h 8.1 (Berkeley) 6/2/93 sl@0: * From Id: resolv.h,v 8.12 1998/04/28 19:36:46 halley Exp $ sl@0: * $FreeBSD: src/include/resolv.h,v 1.26 2004/09/09 17:39:47 yar Exp $ sl@0: */ sl@0: sl@0: #ifndef _RESOLV_H_ sl@0: #define _RESOLV_H_ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /* sl@0: * Revision information. This is the release date in YYYYMMDD format. sl@0: * It can change every day so the right thing to do with it is use it sl@0: * in preprocessor commands such as "#if (__RES > 19931104)". Do not sl@0: * compare for equality; rather, use it to determine whether your resolver sl@0: * is new enough to contain a certain feature. sl@0: */ sl@0: sl@0: #define __RES 19960801 sl@0: sl@0: /* sl@0: * Resolver configuration file. sl@0: * Normally not present, but may contain the address of the sl@0: * inital name server(s) to query and the domain search list. sl@0: */ sl@0: sl@0: #ifndef _PATH_RESCONF sl@0: #define _PATH_RESCONF "/etc/resolv.conf" sl@0: #endif sl@0: sl@0: /* sl@0: * Global defines and variables for resolver stub. sl@0: */ sl@0: #define MAXNS 3 /* max # name servers we'll track */ sl@0: #define MAXDFLSRCH 3 /* # default domain levels to try */ sl@0: #define MAXDNSRCH 6 /* max # domains in search path */ sl@0: #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ sl@0: sl@0: #define RES_TIMEOUT 5 /* min. seconds between retries */ sl@0: #define RES_DFLRETRY 4 /* retries per each name server */ sl@0: #define MAXRESOLVSORT 10 /* number of net to sort on */ sl@0: #define RES_MAXNDOTS 15 /* should reflect bit field size */ sl@0: #define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ sl@0: #define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ sl@0: sl@0: struct __res_state { sl@0: int retrans; /* retransmition time interval */ sl@0: int retry; /* number of times to retransmit */ sl@0: u_long options; /* option flags - see below. */ sl@0: int nscount; /* number of name servers */ sl@0: struct sockaddr_in sl@0: nsaddr_list[MAXNS]; /* address of name server */ sl@0: #define nsaddr nsaddr_list[0] /* for backward compatibility */ sl@0: u_short id; /* current message id */ sl@0: char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ sl@0: char defdname[256]; /* default domain (deprecated) */ sl@0: u_long pfcode; /* RES_PRF_ flags - see below. */ sl@0: unsigned ndots:4; /* threshold for initial abs. query */ sl@0: unsigned nsort:4; /* number of elements in sort_list[] */ sl@0: char unused[3]; sl@0: struct { sl@0: struct in_addr addr; sl@0: u_int32_t mask; sl@0: } sort_list[MAXRESOLVSORT]; sl@0: char pad[72]; /* on an i386 this means 512b total */ sl@0: }; sl@0: sl@0: /* for INET6 */ sl@0: /* sl@0: * replacement of __res_state, separated to keep binary compatibility. sl@0: */ sl@0: struct __res_state_ext { sl@0: struct sockaddr_storage nsaddr_list[MAXNS]; sl@0: struct { sl@0: int af; /* address family for addr, mask */ sl@0: union { sl@0: struct in_addr ina; sl@0: struct in6_addr in6a; sl@0: } addr, mask; sl@0: } sort_list[MAXRESOLVSORT]; sl@0: }; sl@0: sl@0: /* sl@0: * Resolver options (keep these in synch with res_debug.c, please) sl@0: */ sl@0: #define RES_INIT 0x00000001 /* address initialized */ sl@0: #define RES_DEBUG 0x00000002 /* print debug messages */ sl@0: #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ sl@0: #define RES_USEVC 0x00000008 /* use virtual circuit */ sl@0: #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ sl@0: #define RES_IGNTC 0x00000020 /* ignore truncation errors */ sl@0: #define RES_RECURSE 0x00000040 /* recursion desired */ sl@0: #define RES_DEFNAMES 0x00000080 /* use default domain name */ sl@0: #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ sl@0: #define RES_DNSRCH 0x00000200 /* search up local domain tree */ sl@0: #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ sl@0: #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ sl@0: #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ sl@0: #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ sl@0: #define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */ sl@0: /* KAME extensions: use higher bit to avoid conflict with ISC use */ sl@0: #define RES_USE_EDNS0 0x40000000 /* use EDNS0 */ sl@0: sl@0: #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) sl@0: sl@0: /* sl@0: * Resolver "pfcode" values. Used by dig. sl@0: */ sl@0: #define RES_PRF_STATS 0x00000001 sl@0: #define RES_PRF_UPDATE 0x00000002 sl@0: #define RES_PRF_CLASS 0x00000004 sl@0: #define RES_PRF_CMD 0x00000008 sl@0: #define RES_PRF_QUES 0x00000010 sl@0: #define RES_PRF_ANS 0x00000020 sl@0: #define RES_PRF_AUTH 0x00000040 sl@0: #define RES_PRF_ADD 0x00000080 sl@0: #define RES_PRF_HEAD1 0x00000100 sl@0: #define RES_PRF_HEAD2 0x00000200 sl@0: #define RES_PRF_TTLID 0x00000400 sl@0: #define RES_PRF_HEADX 0x00000800 sl@0: #define RES_PRF_QUERY 0x00001000 sl@0: #define RES_PRF_REPLY 0x00002000 sl@0: #define RES_PRF_INIT 0x00004000 sl@0: /* 0x00008000 */ sl@0: sl@0: typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } sl@0: res_sendhookact; sl@0: sl@0: typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *ns, sl@0: const u_char **query, sl@0: int *querylen, sl@0: u_char *ans, sl@0: int anssiz, sl@0: int *resplen); sl@0: sl@0: typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *ns, sl@0: const u_char *query, sl@0: int querylen, sl@0: u_char *ans, sl@0: int anssiz, sl@0: int *resplen); sl@0: sl@0: struct res_sym { sl@0: int number; /* Identifying number, like T_MX */ sl@0: char * name; /* Its symbolic name, like "MX" */ sl@0: char * humanname; /* Its fun name, like "mail exchanger" */ sl@0: }; sl@0: sl@0: __BEGIN_DECLS sl@0: extern struct __res_state *___res(void); sl@0: extern struct __res_state_ext *___res_ext(void); sl@0: __END_DECLS sl@0: #define _res (*___res()) sl@0: #define _res_ext (*___res_ext()) sl@0: /* for INET6 */ sl@0: extern struct __res_state_ext _res_ext; sl@0: sl@0: extern const struct res_sym __p_class_syms[]; sl@0: extern const struct res_sym __p_type_syms[]; sl@0: sl@0: /* Private routines shared between libc/net, named, nslookup and others. */ sl@0: #define res_hnok __res_hnok sl@0: #define res_ownok __res_ownok sl@0: #define res_mailok __res_mailok sl@0: #define res_dnok __res_dnok sl@0: #define sym_ston __sym_ston sl@0: #define sym_ntos __sym_ntos sl@0: #define sym_ntop __sym_ntop sl@0: #define b64_ntop __b64_ntop sl@0: #define b64_pton __b64_pton sl@0: #define loc_ntoa __loc_ntoa sl@0: #define loc_aton __loc_aton sl@0: #define fp_resstat __fp_resstat sl@0: #define p_query __p_query sl@0: #define dn_skipname __dn_skipname sl@0: #define fp_resstat __fp_resstat sl@0: #define fp_query __fp_query sl@0: #define fp_nquery __fp_nquery sl@0: #define hostalias __hostalias sl@0: #define putlong __putlong sl@0: #define putshort __putshort sl@0: #define p_class __p_class sl@0: #define p_time __p_time sl@0: #define p_type __p_type sl@0: #define p_query __p_query sl@0: #define p_cdnname __p_cdnname sl@0: #define p_section __p_section sl@0: #define p_cdname __p_cdname sl@0: #define p_fqnname __p_fqnname sl@0: #define p_fqname __p_fqname sl@0: #define p_option __p_option sl@0: #define p_secstodate __p_secstodate sl@0: #define dn_count_labels __dn_count_labels sl@0: #define dn_comp __dn_comp sl@0: #define dn_expand __dn_expand sl@0: #define res_init __res_init sl@0: #define res_randomid __res_randomid sl@0: #define res_query __res_query sl@0: #define res_search __res_search sl@0: #define res_querydomain __res_querydomain sl@0: #define res_mkquery __res_mkquery sl@0: #define res_send __res_send sl@0: #define res_isourserver __res_isourserver sl@0: #define res_nameinquery __res_nameinquery sl@0: #define res_queriesmatch __res_queriesmatch sl@0: #define res_close __res_close sl@0: #define res_opt __res_opt sl@0: #define res_mkupdate __res_mkupdate sl@0: #define res_mkupdrec __res_mkupdrec sl@0: #define res_freeupdrec __res_freeupdrec sl@0: sl@0: sl@0: #endif /* !_RESOLV_H_ */