00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DNS_RESOLVER_H
00021 #define DNS_RESOLVER_H 1
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 #include <isc/lang.h>
00056 #include <isc/socket.h>
00057
00058 #include <dns/types.h>
00059 #include <dns/fixedname.h>
00060
00061 ISC_LANG_BEGINDECLS
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 typedef struct dns_fetchevent {
00073 ISC_EVENT_COMMON(struct dns_fetchevent);
00074 dns_fetch_t * fetch;
00075 isc_result_t result;
00076 dns_rdatatype_t qtype;
00077 dns_db_t * db;
00078 dns_dbnode_t * node;
00079 dns_rdataset_t * rdataset;
00080 dns_rdataset_t * sigrdataset;
00081 dns_fixedname_t foundname;
00082 isc_sockaddr_t * client;
00083 dns_messageid_t id;
00084 isc_result_t vresult;
00085 } dns_fetchevent_t;
00086
00087
00088
00089
00090 #define DNS_FETCHOPT_TCP 0x001
00091 #define DNS_FETCHOPT_UNSHARED 0x002
00092 #define DNS_FETCHOPT_RECURSIVE 0x004
00093 #define DNS_FETCHOPT_NOEDNS0 0x008
00094 #define DNS_FETCHOPT_FORWARDONLY 0x010
00095 #define DNS_FETCHOPT_NOVALIDATE 0x020
00096 #define DNS_FETCHOPT_EDNS512 0x040
00097
00098 #define DNS_FETCHOPT_WANTNSID 0x080
00099 #define DNS_FETCHOPT_PREFETCH 0x100
00100 #define DNS_FETCHOPT_NOCDFLAG 0x200
00101 #define DNS_FETCHOPT_NONTA 0x400
00102
00103
00104 #define DNS_FETCHOPT_EDNSVERSIONSET 0x00800000
00105 #define DNS_FETCHOPT_EDNSVERSIONMASK 0xff000000
00106 #define DNS_FETCHOPT_EDNSVERSIONSHIFT 24
00107
00108
00109
00110
00111
00112 #define DNS_RESOLVER_QRYRTTCLASS0 10
00113 #define DNS_RESOLVER_QRYRTTCLASS0STR "10"
00114 #define DNS_RESOLVER_QRYRTTCLASS1 100
00115 #define DNS_RESOLVER_QRYRTTCLASS1STR "100"
00116 #define DNS_RESOLVER_QRYRTTCLASS2 500
00117 #define DNS_RESOLVER_QRYRTTCLASS2STR "500"
00118 #define DNS_RESOLVER_QRYRTTCLASS3 800
00119 #define DNS_RESOLVER_QRYRTTCLASS3STR "800"
00120 #define DNS_RESOLVER_QRYRTTCLASS4 1600
00121 #define DNS_RESOLVER_QRYRTTCLASS4STR "1600"
00122
00123
00124
00125
00126
00127
00128 #define DNS_RESOLVER_CHECKNAMES 0x01
00129 #define DNS_RESOLVER_CHECKNAMESFAIL 0x02
00130
00131 isc_result_t
00132 dns_resolver_create(dns_view_t *view,
00133 isc_taskmgr_t *taskmgr,
00134 unsigned int ntasks, unsigned int ndisp,
00135 isc_socketmgr_t *socketmgr,
00136 isc_timermgr_t *timermgr,
00137 unsigned int options,
00138 dns_dispatchmgr_t *dispatchmgr,
00139 dns_dispatch_t *dispatchv4,
00140 dns_dispatch_t *dispatchv6,
00141 dns_resolver_t **resp);
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 void
00179 dns_resolver_freeze(dns_resolver_t *res);
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 void
00198 dns_resolver_prime(dns_resolver_t *res);
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 void
00216 dns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task,
00217 isc_event_t **eventp);
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 void
00240 dns_resolver_shutdown(dns_resolver_t *res);
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 void
00254 dns_resolver_attach(dns_resolver_t *source, dns_resolver_t **targetp);
00255
00256 void
00257 dns_resolver_detach(dns_resolver_t **resp);
00258
00259 isc_result_t
00260 dns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
00261 dns_rdatatype_t type,
00262 dns_name_t *domain, dns_rdataset_t *nameservers,
00263 dns_forwarders_t *forwarders,
00264 unsigned int options, isc_task_t *task,
00265 isc_taskaction_t action, void *arg,
00266 dns_rdataset_t *rdataset,
00267 dns_rdataset_t *sigrdataset,
00268 dns_fetch_t **fetchp);
00269
00270 isc_result_t
00271 dns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name,
00272 dns_rdatatype_t type,
00273 dns_name_t *domain, dns_rdataset_t *nameservers,
00274 dns_forwarders_t *forwarders,
00275 isc_sockaddr_t *client, isc_uint16_t id,
00276 unsigned int options, isc_task_t *task,
00277 isc_taskaction_t action, void *arg,
00278 dns_rdataset_t *rdataset,
00279 dns_rdataset_t *sigrdataset,
00280 dns_fetch_t **fetchp);
00281 isc_result_t
00282 dns_resolver_createfetch3(dns_resolver_t *res, dns_name_t *name,
00283 dns_rdatatype_t type,
00284 dns_name_t *domain, dns_rdataset_t *nameservers,
00285 dns_forwarders_t *forwarders,
00286 isc_sockaddr_t *client, isc_uint16_t id,
00287 unsigned int options, unsigned int depth,
00288 isc_counter_t *qc, isc_task_t *task,
00289 isc_taskaction_t action, void *arg,
00290 dns_rdataset_t *rdataset,
00291 dns_rdataset_t *sigrdataset,
00292 dns_fetch_t **fetchp);
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 void
00354 dns_resolver_cancelfetch(dns_fetch_t *fetch);
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368 void
00369 dns_resolver_destroyfetch(dns_fetch_t **fetchp);
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 void
00386 dns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx,
00387 isc_logcategory_t *category, isc_logmodule_t *module,
00388 int level, isc_boolean_t duplicateok);
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 dns_dispatchmgr_t *
00403 dns_resolver_dispatchmgr(dns_resolver_t *resolver);
00404
00405 dns_dispatch_t *
00406 dns_resolver_dispatchv4(dns_resolver_t *resolver);
00407
00408 dns_dispatch_t *
00409 dns_resolver_dispatchv6(dns_resolver_t *resolver);
00410
00411 isc_socketmgr_t *
00412 dns_resolver_socketmgr(dns_resolver_t *resolver);
00413
00414 isc_taskmgr_t *
00415 dns_resolver_taskmgr(dns_resolver_t *resolver);
00416
00417 isc_uint32_t
00418 dns_resolver_getlamettl(dns_resolver_t *resolver);
00419
00420
00421
00422
00423
00424
00425
00426 void
00427 dns_resolver_setlamettl(dns_resolver_t *resolver, isc_uint32_t lame_ttl);
00428
00429
00430
00431
00432
00433
00434
00435 unsigned int
00436 dns_resolver_nrunning(dns_resolver_t *resolver);
00437
00438
00439
00440
00441
00442
00443
00444
00445 isc_result_t
00446 dns_resolver_addalternate(dns_resolver_t *resolver, isc_sockaddr_t *alt,
00447 dns_name_t *name, in_port_t port);
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457 void
00458 dns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize);
00459
00460
00461
00462
00463 isc_uint16_t
00464 dns_resolver_getudpsize(dns_resolver_t *resolver);
00465
00466
00467
00468
00469 void
00470 dns_resolver_reset_algorithms(dns_resolver_t *resolver);
00471
00472
00473
00474
00475 void
00476 dns_resolver_reset_ds_digests(dns_resolver_t *resolver);
00477
00478
00479
00480
00481 isc_result_t
00482 dns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
00483 unsigned int alg);
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 isc_result_t
00495 dns_resolver_disable_ds_digest(dns_resolver_t *resolver, dns_name_t *name,
00496 unsigned int digest_type);
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507 isc_boolean_t
00508 dns_resolver_algorithm_supported(dns_resolver_t *resolver, dns_name_t *name,
00509 unsigned int alg);
00510
00511
00512
00513
00514
00515
00516
00517 isc_boolean_t
00518 dns_resolver_ds_digest_supported(dns_resolver_t *resolver, dns_name_t *name,
00519 unsigned int digest_type);
00520
00521
00522
00523
00524
00525
00526
00527 void
00528 dns_resolver_resetmustbesecure(dns_resolver_t *resolver);
00529
00530 isc_result_t
00531 dns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name,
00532 isc_boolean_t value);
00533
00534 isc_boolean_t
00535 dns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name);
00536
00537
00538 void
00539 dns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds);
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549 unsigned int
00550 dns_resolver_gettimeout(dns_resolver_t *resolver);
00551
00552
00553
00554
00555
00556
00557
00558 void
00559 dns_resolver_setclientsperquery(dns_resolver_t *resolver,
00560 isc_uint32_t min, isc_uint32_t max);
00561
00562 void
00563 dns_resolver_getclientsperquery(dns_resolver_t *resolver, isc_uint32_t *cur,
00564 isc_uint32_t *min, isc_uint32_t *max);
00565
00566 isc_boolean_t
00567 dns_resolver_getzeronosoattl(dns_resolver_t *resolver);
00568
00569 void
00570 dns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state);
00571
00572 unsigned int
00573 dns_resolver_getoptions(dns_resolver_t *resolver);
00574
00575 void
00576 dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
00577 dns_rdatatype_t type, isc_time_t *expire);
00578
00579
00580
00581
00582
00583
00584
00585
00586 isc_boolean_t
00587 dns_resolver_getbadcache(dns_resolver_t *resolver, dns_name_t *name,
00588 dns_rdatatype_t type, isc_time_t *now);
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598 void
00599 dns_resolver_flushbadcache(dns_resolver_t *resolver, dns_name_t *name);
00600
00601
00602
00603
00604
00605
00606
00607
00608 void
00609 dns_resolver_flushbadnames(dns_resolver_t *resolver, dns_name_t *name);
00610
00611
00612
00613
00614
00615
00616
00617
00618 void
00619 dns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp);
00620
00621
00622
00623
00624
00625
00626
00627 void
00628 dns_resolver_setquerydscp4(dns_resolver_t *resolver, isc_dscp_t dscp);
00629 isc_dscp_t
00630 dns_resolver_getquerydscp4(dns_resolver_t *resolver);
00631
00632 void
00633 dns_resolver_setquerydscp6(dns_resolver_t *resolver, isc_dscp_t dscp);
00634 isc_dscp_t
00635 dns_resolver_getquerydscp6(dns_resolver_t *resolver);
00636
00637
00638
00639
00640
00641
00642
00643
00644 void
00645 dns_resolver_setmaxdepth(dns_resolver_t *resolver, unsigned int maxdepth);
00646 unsigned int
00647 dns_resolver_getmaxdepth(dns_resolver_t *resolver);
00648
00649
00650
00651
00652
00653
00654
00655
00656 void
00657 dns_resolver_setmaxqueries(dns_resolver_t *resolver, unsigned int queries);
00658 unsigned int
00659 dns_resolver_getmaxqueries(dns_resolver_t *resolver);
00660
00661
00662
00663
00664
00665
00666
00667
00668 ISC_LANG_ENDDECLS
00669
00670 #endif