00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #ifndef _RESOLV_H_
00059 #define _RESOLV_H_
00060
00061 #include <sys/param.h>
00062 #include <sys/types.h>
00063 #include <sys/cdefs.h>
00064 #include <sys/socket.h>
00065 #include <stdio.h>
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #define __RES 19960801
00076
00077
00078
00079
00080
00081
00082
00083 #ifndef _PATH_RESCONF
00084 #define _PATH_RESCONF "/etc/resolv.conf"
00085 #endif
00086
00087
00088
00089
00090 #define MAXNS 3
00091 #define MAXDFLSRCH 3
00092 #define MAXDNSRCH 6
00093 #define LOCALDOMAINPARTS 2
00094
00095 #define RES_TIMEOUT 5
00096 #define RES_DFLRETRY 4
00097 #define MAXRESOLVSORT 10
00098 #define RES_MAXNDOTS 15
00099 #define RES_MAXRETRANS 30
00100 #define RES_MAXRETRY 5
00101
00102 struct __res_state {
00103 int retrans;
00104 int retry;
00105 u_long options;
00106 int nscount;
00107 struct sockaddr_in
00108 nsaddr_list[MAXNS];
00109 #define nsaddr nsaddr_list[0]
00110 u_short id;
00111 char *dnsrch[MAXDNSRCH+1];
00112 char defdname[256];
00113 u_long pfcode;
00114 unsigned ndots:4;
00115 unsigned nsort:4;
00116 char unused[3];
00117 struct {
00118 struct in_addr addr;
00119 u_int32_t mask;
00120 } sort_list[MAXRESOLVSORT];
00121 char pad[72];
00122 };
00123
00124
00125
00126
00127
00128 struct __res_state_ext {
00129 struct sockaddr_storage nsaddr_list[MAXNS];
00130 struct {
00131 int af;
00132 union {
00133 struct in_addr ina;
00134 struct in6_addr in6a;
00135 } addr, mask;
00136 } sort_list[MAXRESOLVSORT];
00137 };
00138
00139
00140
00141
00142 #define RES_INIT 0x00000001
00143 #define RES_DEBUG 0x00000002
00144 #define RES_AAONLY 0x00000004
00145 #define RES_USEVC 0x00000008
00146 #define RES_PRIMARY 0x00000010
00147 #define RES_IGNTC 0x00000020
00148 #define RES_RECURSE 0x00000040
00149 #define RES_DEFNAMES 0x00000080
00150 #define RES_STAYOPEN 0x00000100
00151 #define RES_DNSRCH 0x00000200
00152 #define RES_INSECURE1 0x00000400
00153 #define RES_INSECURE2 0x00000800
00154 #define RES_NOALIASES 0x00001000
00155 #define RES_USE_INET6 0x00002000
00156 #define RES_NOTLDQUERY 0x00004000
00157
00158 #define RES_USE_EDNS0 0x40000000
00159
00160 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
00161
00162
00163
00164
00165 #define RES_PRF_STATS 0x00000001
00166 #define RES_PRF_UPDATE 0x00000002
00167 #define RES_PRF_CLASS 0x00000004
00168 #define RES_PRF_CMD 0x00000008
00169 #define RES_PRF_QUES 0x00000010
00170 #define RES_PRF_ANS 0x00000020
00171 #define RES_PRF_AUTH 0x00000040
00172 #define RES_PRF_ADD 0x00000080
00173 #define RES_PRF_HEAD1 0x00000100
00174 #define RES_PRF_HEAD2 0x00000200
00175 #define RES_PRF_TTLID 0x00000400
00176 #define RES_PRF_HEADX 0x00000800
00177 #define RES_PRF_QUERY 0x00001000
00178 #define RES_PRF_REPLY 0x00002000
00179 #define RES_PRF_INIT 0x00004000
00180
00181
00182 typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
00183 res_sendhookact;
00184
00185 typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *ns,
00186 const u_char **query,
00187 int *querylen,
00188 u_char *ans,
00189 int anssiz,
00190 int *resplen);
00191
00192 typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *ns,
00193 const u_char *query,
00194 int querylen,
00195 u_char *ans,
00196 int anssiz,
00197 int *resplen);
00198
00199 struct res_sym {
00200 int number;
00201 char * name;
00202 char * humanname;
00203 };
00204
00205 __BEGIN_DECLS
00206 extern struct __res_state *___res(void);
00207 extern struct __res_state_ext *___res_ext(void);
00208 __END_DECLS
00209 #define _res (*___res())
00210 #define _res_ext (*___res_ext())
00211
00212 extern struct __res_state_ext _res_ext;
00213
00214 extern const struct res_sym __p_class_syms[];
00215 extern const struct res_sym __p_type_syms[];
00216
00217
00218 #define res_hnok __res_hnok
00219 #define res_ownok __res_ownok
00220 #define res_mailok __res_mailok
00221 #define res_dnok __res_dnok
00222 #define sym_ston __sym_ston
00223 #define sym_ntos __sym_ntos
00224 #define sym_ntop __sym_ntop
00225 #define b64_ntop __b64_ntop
00226 #define b64_pton __b64_pton
00227 #define loc_ntoa __loc_ntoa
00228 #define loc_aton __loc_aton
00229 #define fp_resstat __fp_resstat
00230 #define p_query __p_query
00231 #define dn_skipname __dn_skipname
00232 #define fp_resstat __fp_resstat
00233 #define fp_query __fp_query
00234 #define fp_nquery __fp_nquery
00235 #define hostalias __hostalias
00236 #define putlong __putlong
00237 #define putshort __putshort
00238 #define p_class __p_class
00239 #define p_time __p_time
00240 #define p_type __p_type
00241 #define p_query __p_query
00242 #define p_cdnname __p_cdnname
00243 #define p_section __p_section
00244 #define p_cdname __p_cdname
00245 #define p_fqnname __p_fqnname
00246 #define p_fqname __p_fqname
00247 #define p_option __p_option
00248 #define p_secstodate __p_secstodate
00249 #define dn_count_labels __dn_count_labels
00250 #define dn_comp __dn_comp
00251 #define dn_expand __dn_expand
00252 #define res_init __res_init
00253 #define res_randomid __res_randomid
00254 #define res_query __res_query
00255 #define res_search __res_search
00256 #define res_querydomain __res_querydomain
00257 #define res_mkquery __res_mkquery
00258 #define res_send __res_send
00259 #define res_isourserver __res_isourserver
00260 #define res_nameinquery __res_nameinquery
00261 #define res_queriesmatch __res_queriesmatch
00262 #define res_close __res_close
00263 #define res_opt __res_opt
00264 #define res_mkupdate __res_mkupdate
00265 #define res_mkupdrec __res_mkupdrec
00266 #define res_freeupdrec __res_freeupdrec
00267
00268
00269 #endif