00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DNS_STATS_H
00021 #define DNS_STATS_H 1
00022
00023
00024
00025 #include <dns/types.h>
00026
00027
00028
00029
00030 enum {
00031
00032
00033
00034 dns_resstatscounter_queryv4 = 0,
00035 dns_resstatscounter_queryv6 = 1,
00036 dns_resstatscounter_responsev4 = 2,
00037 dns_resstatscounter_responsev6 = 3,
00038 dns_resstatscounter_nxdomain = 4,
00039 dns_resstatscounter_servfail = 5,
00040 dns_resstatscounter_formerr = 6,
00041 dns_resstatscounter_othererror = 7,
00042 dns_resstatscounter_edns0fail = 8,
00043 dns_resstatscounter_mismatch = 9,
00044 dns_resstatscounter_truncated = 10,
00045 dns_resstatscounter_lame = 11,
00046 dns_resstatscounter_retry = 12,
00047 dns_resstatscounter_gluefetchv4 = 13,
00048 dns_resstatscounter_gluefetchv6 = 14,
00049 dns_resstatscounter_gluefetchv4fail = 15,
00050 dns_resstatscounter_gluefetchv6fail = 16,
00051 dns_resstatscounter_val = 17,
00052 dns_resstatscounter_valsuccess = 18,
00053 dns_resstatscounter_valnegsuccess = 19,
00054 dns_resstatscounter_valfail = 20,
00055 dns_resstatscounter_dispabort = 21,
00056 dns_resstatscounter_dispsockfail = 22,
00057 dns_resstatscounter_querytimeout = 23,
00058 dns_resstatscounter_queryrtt0 = 24,
00059 dns_resstatscounter_queryrtt1 = 25,
00060 dns_resstatscounter_queryrtt2 = 26,
00061 dns_resstatscounter_queryrtt3 = 27,
00062 dns_resstatscounter_queryrtt4 = 28,
00063 dns_resstatscounter_queryrtt5 = 29,
00064 dns_resstatscounter_nfetch = 30,
00065 dns_resstatscounter_disprequdp = 31,
00066 dns_resstatscounter_dispreqtcp = 32,
00067 dns_resstatscounter_buckets = 33,
00068 dns_resstatscounter_refused = 34,
00069 #ifdef ISC_PLATFORM_USESIT
00070 dns_resstatscounter_sitcc = 35,
00071 dns_resstatscounter_sitout = 36,
00072 dns_resstatscounter_sitin = 37,
00073 dns_resstatscounter_sitok = 38,
00074
00075 dns_resstatscounter_badvers = 39,
00076 dns_resstatscounter_max = 40,
00077 #else
00078 dns_resstatscounter_badvers = 35,
00079 dns_resstatscounter_max = 36,
00080 #endif
00081
00082
00083
00084
00085 dns_dnssecstats_asis = 0,
00086 dns_dnssecstats_downcase = 1,
00087 dns_dnssecstats_wildcard = 2,
00088 dns_dnssecstats_fail = 3,
00089
00090 dns_dnssecstats_max = 4,
00091
00092
00093
00094
00095 dns_zonestatscounter_notifyoutv4 = 0,
00096 dns_zonestatscounter_notifyoutv6 = 1,
00097 dns_zonestatscounter_notifyinv4 = 2,
00098 dns_zonestatscounter_notifyinv6 = 3,
00099 dns_zonestatscounter_notifyrej = 4,
00100 dns_zonestatscounter_soaoutv4 = 5,
00101 dns_zonestatscounter_soaoutv6 = 6,
00102 dns_zonestatscounter_axfrreqv4 = 7,
00103 dns_zonestatscounter_axfrreqv6 = 8,
00104 dns_zonestatscounter_ixfrreqv4 = 9,
00105 dns_zonestatscounter_ixfrreqv6 = 10,
00106 dns_zonestatscounter_xfrsuccess = 11,
00107 dns_zonestatscounter_xfrfail = 12,
00108
00109 dns_zonestatscounter_max = 13,
00110
00111
00112
00113
00114 dns_adbstats_nentries = 0,
00115 dns_adbstats_entriescnt = 1,
00116 dns_adbstats_nnames = 2,
00117 dns_adbstats_namescnt = 3,
00118
00119 dns_adbstats_max = 4,
00120
00121
00122
00123
00124 dns_cachestatscounter_hits = 1,
00125 dns_cachestatscounter_misses = 2,
00126 dns_cachestatscounter_queryhits = 3,
00127 dns_cachestatscounter_querymisses = 4,
00128 dns_cachestatscounter_deletelru = 5,
00129 dns_cachestatscounter_deletettl = 6,
00130
00131 dns_cachestatscounter_max = 7,
00132
00133
00134
00135
00136 dns_statscounter_success = 0,
00137 dns_statscounter_referral = 1,
00138 dns_statscounter_nxrrset = 2,
00139 dns_statscounter_nxdomain = 3,
00140 dns_statscounter_recursion = 4,
00141 dns_statscounter_failure = 5,
00142 dns_statscounter_duplicate = 6,
00143 dns_statscounter_dropped = 7
00144 };
00145
00146 #define DNS_STATS_NCOUNTERS 8
00147
00148 #if 0
00149
00150
00151
00152
00153
00154 #define DNS_STATSDUMP_VERBOSE 0x00000001
00155 #endif
00156
00157
00158
00159
00160 LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[];
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 #define DNS_RDATASTATSTYPE_ATTR_OTHERTYPE 0x0001
00185 #define DNS_RDATASTATSTYPE_ATTR_NXRRSET 0x0002
00186 #define DNS_RDATASTATSTYPE_ATTR_NXDOMAIN 0x0004
00187 #define DNS_RDATASTATSTYPE_ATTR_STALE 0x0008
00188
00189
00190
00191
00192 #define DNS_RDATASTATSTYPE_BASE(type) ((dns_rdatatype_t)((type) & 0xFFFF))
00193 #define DNS_RDATASTATSTYPE_ATTR(type) ((type) >> 16)
00194 #define DNS_RDATASTATSTYPE_VALUE(b, a) (((a) << 16) | (b))
00195
00196
00197
00198
00199 typedef void (*dns_generalstats_dumper_t)(isc_statscounter_t, isc_uint64_t,
00200 void *);
00201 typedef void (*dns_rdatatypestats_dumper_t)(dns_rdatastatstype_t, isc_uint64_t,
00202 void *);
00203 typedef void (*dns_opcodestats_dumper_t)(dns_opcode_t, isc_uint64_t, void *);
00204
00205 ISC_LANG_BEGINDECLS
00206
00207 isc_result_t
00208 dns_generalstats_create(isc_mem_t *mctx, dns_stats_t **statsp, int ncounters);
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 isc_result_t
00227 dns_rdatatypestats_create(isc_mem_t *mctx, dns_stats_t **statsp);
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 isc_result_t
00243 dns_rdatasetstats_create(isc_mem_t *mctx, dns_stats_t **statsp);
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 isc_result_t
00259 dns_opcodestats_create(isc_mem_t *mctx, dns_stats_t **statsp);
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 void
00275 dns_stats_attach(dns_stats_t *stats, dns_stats_t **statsp);
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 void
00286 dns_stats_detach(dns_stats_t **statsp);
00287
00288
00289
00290
00291
00292
00293
00294 void
00295 dns_generalstats_increment(dns_stats_t *stats, isc_statscounter_t counter);
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 void
00308 dns_rdatatypestats_increment(dns_stats_t *stats, dns_rdatatype_t type);
00309
00310
00311
00312
00313
00314
00315
00316 void
00317 dns_rdatasetstats_increment(dns_stats_t *stats, dns_rdatastatstype_t rrsettype);
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 void
00329 dns_rdatasetstats_decrement(dns_stats_t *stats, dns_rdatastatstype_t rrsettype);
00330
00331
00332
00333
00334
00335
00336
00337 void
00338 dns_opcodestats_increment(dns_stats_t *stats, dns_opcode_t code);
00339
00340
00341
00342
00343
00344
00345
00346 void
00347 dns_generalstats_dump(dns_stats_t *stats, dns_generalstats_dumper_t dump_fn,
00348 void *arg, unsigned int options);
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 void
00363 dns_rdatatypestats_dump(dns_stats_t *stats, dns_rdatatypestats_dumper_t dump_fn,
00364 void *arg, unsigned int options);
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376 void
00377 dns_rdatasetstats_dump(dns_stats_t *stats, dns_rdatatypestats_dumper_t dump_fn,
00378 void *arg, unsigned int options);
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390 void
00391 dns_opcodestats_dump(dns_stats_t *stats, dns_opcodestats_dumper_t dump_fn,
00392 void *arg, unsigned int options);
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404 isc_result_t
00405 dns_stats_alloccounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
00406
00407
00408
00409
00410
00411
00412
00413 void
00414 dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
00415
00416
00417
00418
00419
00420
00421
00422 ISC_LANG_ENDDECLS
00423
00424 #endif