00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef NAMED_SERVER_H
00021 #define NAMED_SERVER_H 1
00022
00023
00024
00025 #include <isc/log.h>
00026 #include <isc/magic.h>
00027 #include <isc/quota.h>
00028 #include <isc/sockaddr.h>
00029 #include <isc/types.h>
00030 #include <isc/xml.h>
00031
00032 #include <dns/acl.h>
00033 #include <dns/types.h>
00034
00035 #include <named/types.h>
00036
00037 #define NS_EVENTCLASS ISC_EVENTCLASS(0x4E43)
00038 #define NS_EVENT_RELOAD (NS_EVENTCLASS + 0)
00039 #define NS_EVENT_CLIENTCONTROL (NS_EVENTCLASS + 1)
00040
00041
00042
00043
00044 struct ns_server {
00045 unsigned int magic;
00046 isc_mem_t * mctx;
00047
00048 isc_task_t * task;
00049
00050
00051 isc_quota_t xfroutquota;
00052 isc_quota_t tcpquota;
00053 isc_quota_t recursionquota;
00054 dns_acl_t *blackholeacl;
00055 dns_acl_t *keepresporder;
00056 char * statsfile;
00057 char * dumpfile;
00058 char * secrootsfile;
00059 char * bindkeysfile;
00060 char * recfile;
00061 isc_boolean_t version_set;
00062 char * version;
00063 isc_boolean_t hostname_set;
00064 char * hostname;
00065
00066 isc_boolean_t server_usehostname;
00067 char * server_id;
00068
00069
00070
00071
00072
00073
00074 dns_aclenv_t aclenv;
00075
00076
00077 dns_loadmgr_t * loadmgr;
00078 dns_zonemgr_t * zonemgr;
00079 dns_viewlist_t viewlist;
00080 ns_interfacemgr_t * interfacemgr;
00081 dns_db_t * in_roothints;
00082 dns_tkeyctx_t * tkeyctx;
00083
00084 isc_timer_t * interface_timer;
00085 isc_timer_t * heartbeat_timer;
00086 isc_timer_t * pps_timer;
00087
00088 isc_uint32_t interface_interval;
00089 isc_uint32_t heartbeat_interval;
00090
00091 isc_mutex_t reload_event_lock;
00092 isc_event_t * reload_event;
00093
00094 isc_boolean_t flushonshutdown;
00095 isc_boolean_t log_queries;
00096
00097 ns_cachelist_t cachelist;
00098 isc_stats_t * nsstats;
00099 dns_stats_t * rcvquerystats;
00100 dns_stats_t * opcodestats;
00101 isc_stats_t * zonestats;
00102 isc_stats_t * resolverstats;
00103 isc_stats_t * sockstats;
00104
00105 ns_controls_t * controls;
00106 unsigned int dispatchgen;
00107 ns_dispatchlist_t dispatches;
00108
00109 dns_acache_t *acache;
00110
00111 ns_statschannellist_t statschannels;
00112
00113 dns_tsigkey_t *sessionkey;
00114 char *session_keyfile;
00115 dns_name_t *session_keyname;
00116 unsigned int session_keyalg;
00117 isc_uint16_t session_keybits;
00118 isc_boolean_t interface_auto;
00119 unsigned char secret[32];
00120
00121 char * lockfile;
00122 };
00123
00124 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
00125 #define NS_SERVER_VALID(s) ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
00126
00127
00128
00129
00130 enum {
00131 dns_nsstatscounter_requestv4 = 0,
00132 dns_nsstatscounter_requestv6 = 1,
00133 dns_nsstatscounter_edns0in = 2,
00134 dns_nsstatscounter_badednsver = 3,
00135 dns_nsstatscounter_tsigin = 4,
00136 dns_nsstatscounter_sig0in = 5,
00137 dns_nsstatscounter_invalidsig = 6,
00138 dns_nsstatscounter_requesttcp = 7,
00139
00140 dns_nsstatscounter_authrej = 8,
00141 dns_nsstatscounter_recurserej = 9,
00142 dns_nsstatscounter_xfrrej = 10,
00143 dns_nsstatscounter_updaterej = 11,
00144
00145 dns_nsstatscounter_response = 12,
00146 dns_nsstatscounter_truncatedresp = 13,
00147 dns_nsstatscounter_edns0out = 14,
00148 dns_nsstatscounter_tsigout = 15,
00149 dns_nsstatscounter_sig0out = 16,
00150
00151 dns_nsstatscounter_success = 17,
00152 dns_nsstatscounter_authans = 18,
00153 dns_nsstatscounter_nonauthans = 19,
00154 dns_nsstatscounter_referral = 20,
00155 dns_nsstatscounter_nxrrset = 21,
00156 dns_nsstatscounter_servfail = 22,
00157 dns_nsstatscounter_formerr = 23,
00158 dns_nsstatscounter_nxdomain = 24,
00159 dns_nsstatscounter_recursion = 25,
00160 dns_nsstatscounter_duplicate = 26,
00161 dns_nsstatscounter_dropped = 27,
00162 dns_nsstatscounter_failure = 28,
00163
00164 dns_nsstatscounter_xfrdone = 29,
00165
00166 dns_nsstatscounter_updatereqfwd = 30,
00167 dns_nsstatscounter_updaterespfwd = 31,
00168 dns_nsstatscounter_updatefwdfail = 32,
00169 dns_nsstatscounter_updatedone = 33,
00170 dns_nsstatscounter_updatefail = 34,
00171 dns_nsstatscounter_updatebadprereq = 35,
00172
00173 dns_nsstatscounter_recursclients = 36,
00174
00175 dns_nsstatscounter_dns64 = 37,
00176
00177 dns_nsstatscounter_ratedropped = 38,
00178 dns_nsstatscounter_rateslipped = 39,
00179
00180 dns_nsstatscounter_rpz_rewrites = 40,
00181
00182 dns_nsstatscounter_udp = 41,
00183 dns_nsstatscounter_tcp = 42,
00184
00185 dns_nsstatscounter_nsidopt = 43,
00186 dns_nsstatscounter_expireopt = 44,
00187 dns_nsstatscounter_otheropt = 45,
00188 dns_nsstatscounter_ecsopt = 46,
00189
00190 #ifdef ISC_PLATFORM_USESIT
00191 dns_nsstatscounter_sitopt = 47,
00192 dns_nsstatscounter_sitbadsize = 48,
00193 dns_nsstatscounter_sitbadtime = 49,
00194 dns_nsstatscounter_sitnomatch = 50,
00195 dns_nsstatscounter_sitmatch = 51,
00196 dns_nsstatscounter_sitnew = 52,
00197
00198 dns_nsstatscounter_max = 53
00199 #else
00200 dns_nsstatscounter_max = 47
00201 #endif
00202 };
00203
00204 void
00205 ns_server_create(isc_mem_t *mctx, ns_server_t **serverp);
00206
00207
00208
00209
00210
00211
00212 void
00213 ns_server_destroy(ns_server_t **serverp);
00214
00215
00216
00217
00218 void
00219 ns_server_reloadwanted(ns_server_t *server);
00220
00221
00222
00223
00224
00225
00226
00227 void
00228 ns_server_scan_interfaces(ns_server_t *server);
00229
00230
00231
00232
00233
00234 void
00235 ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
00236
00237
00238
00239
00240 isc_result_t
00241 ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t **text);
00242
00243
00244
00245
00246 isc_result_t
00247 ns_server_reconfigcommand(ns_server_t *server, char *args);
00248
00249
00250
00251
00252 isc_result_t
00253 ns_server_notifycommand(ns_server_t *server, char *args, isc_buffer_t **text);
00254
00255
00256
00257
00258 isc_result_t
00259 ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t **text);
00260
00261
00262
00263
00264 isc_result_t
00265 ns_server_retransfercommand(ns_server_t *server, char *args,
00266 isc_buffer_t **text);
00267
00268
00269
00270
00271 isc_result_t
00272 ns_server_togglequerylog(ns_server_t *server, char *args);
00273
00274
00275
00276
00277
00278
00279
00280
00281 isc_result_t
00282 ns_server_saventa(ns_server_t *server);
00283
00284
00285
00286
00287 isc_result_t
00288 ns_server_loadnta(ns_server_t *server);
00289
00290
00291
00292
00293 isc_result_t
00294 ns_server_dumpstats(ns_server_t *server);
00295
00296
00297
00298
00299 isc_result_t
00300 ns_server_dumpdb(ns_server_t *server, char *args);
00301
00302
00303
00304
00305 isc_result_t
00306 ns_server_dumpsecroots(ns_server_t *server, char *args, isc_buffer_t **text);
00307
00308
00309
00310
00311 isc_result_t
00312 ns_server_setdebuglevel(ns_server_t *server, char *args);
00313
00314
00315
00316
00317 isc_result_t
00318 ns_server_flushcache(ns_server_t *server, char *args);
00319
00320
00321
00322
00323
00324
00325 isc_result_t
00326 ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree);
00327
00328
00329
00330
00331 isc_result_t
00332 ns_server_status(ns_server_t *server, isc_buffer_t **text);
00333
00334
00335
00336
00337 isc_result_t
00338 ns_server_tsiglist(ns_server_t *server, isc_buffer_t **text);
00339
00340
00341
00342
00343 isc_result_t
00344 ns_server_tsigdelete(ns_server_t *server, char *command, isc_buffer_t **text);
00345
00346
00347
00348
00349 isc_result_t
00350 ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args,
00351 isc_buffer_t **text);
00352
00353
00354
00355
00356 isc_result_t
00357 ns_server_sync(ns_server_t *server, char *args, isc_buffer_t **text);
00358
00359
00360
00361
00362
00363
00364
00365
00366 isc_result_t
00367 ns_server_rekey(ns_server_t *server, char *args, isc_buffer_t **text);
00368
00369
00370
00371
00372 isc_result_t
00373 ns_server_dumprecursing(ns_server_t *server);
00374
00375
00376
00377
00378 void
00379 ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr);
00380
00381
00382
00383
00384 isc_result_t
00385 ns_server_validation(ns_server_t *server, char *args, isc_buffer_t **text);
00386
00387
00388
00389
00390 isc_result_t
00391 ns_server_changezone(ns_server_t *server, char *args, isc_buffer_t **text);
00392
00393
00394
00395
00396 isc_result_t
00397 ns_server_delzone(ns_server_t *server, char *args, isc_buffer_t **text);
00398
00399
00400
00401
00402 isc_result_t
00403 ns_server_showzone(ns_server_t *server, char *args, isc_buffer_t **text);
00404
00405
00406
00407
00408 isc_result_t
00409 ns_server_signing(ns_server_t *server, char *args, isc_buffer_t **text);
00410
00411
00412
00413
00414
00415 isc_result_t
00416 ns_server_zonestatus(ns_server_t *server, char *args, isc_buffer_t **text);
00417
00418
00419
00420
00421
00422 isc_result_t
00423 ns_server_nta(ns_server_t *server, char *args, isc_buffer_t **text);
00424
00425
00426
00427
00428
00429 isc_result_t
00430 ns_server_testgen(char *args, isc_buffer_t **text);
00431
00432
00433
00434
00435 isc_result_t
00436 ns_server_mkeys(ns_server_t *server, char *args, isc_buffer_t **text);
00437
00438 #endif