/*
* Copyright (C) 2000, 2001, 2004, 2005, 2007-2009, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: stats.c,v 1.18 2009/01/27 23:47:54 tbox Exp $ */
/*! \file */
#include <config.h>
#include <dns/rdatatype.h>
/*%
* Statistics types.
*/
typedef enum {
/*%
* It doesn't make sense to have 2^16 counters for all possible types since
* most of them won't be used. We have counters for the first 256 types and
* those explicitly supported in the rdata implementation.
* XXXJT: this introduces tight coupling with the rdata implementation.
* Ideally, we should have rdata handle this type of details.
*/
/*
* types, !types, nxdomain, stale types, stale !types, stale nxdomain
*/
enum {
/* For 0-255, we use the rdtype value as counter indices */
/* The following are used for rdataset */
/* stale counters offset */
};
struct dns_stats {
/*% Unlocked */
unsigned int magic;
/*% Locked by lock */
unsigned int references;
};
typedef struct rdatadumparg {
void *arg;
typedef struct opcodedumparg {
void *arg;
typedef struct rcodedumparg {
void *arg;
void
stats->references++;
}
void
stats->references--;
if (stats->references == 0) {
}
}
/*%
* Create methods
*/
static isc_result_t
{
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
goto clean_stats;
if (result != ISC_R_SUCCESS)
goto clean_mutex;
return (ISC_R_SUCCESS);
return (result);
}
}
statsp));
}
}
}
}
/*%
*/
void
}
void
int counter;
if (type == dns_rdatatype_dlv)
else if (type > dns_rdatatype_any)
else
}
static inline void
{
int counter;
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) != 0) {
} else {
if (rdtype == dns_rdatatype_dlv)
counter = (int)rdtypecounter_dlv;
else if (rdtype > dns_rdatatype_any)
counter = (int)rdtypecounter_others;
else
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
}
if (increment) {
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
DNS_RDATASTATSTYPE_ATTR_STALE) != 0) {
}
} else {
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
}
}
void
{
}
void
{
}
void
}
void
if (code <= dns_rcode_badcookie)
}
/*%
* Dump methods
*/
void
{
}
static void
{
if (rdcounter == rdtypecounter_others)
else {
if (rdcounter == rdtypecounter_dlv)
else
}
}
static void
}
void
{
}
static void
unsigned int attributes;
if (counter < rdtypecounter_max) {
rdatadumparg->arg);
} else if (counter < rdtypecounter_nxdomain) {
rdatadumparg->arg);
} else if (counter == rdtypecounter_nxdomain) {
rdatadumparg->arg);
rdatadumparg->arg);
} else {
rdatadumparg->arg);
}
}
void
{
}
static void
}
static void
}
void
{
}
void
{
}
/***
*** Obsolete variables and functions follow:
***/
{
"success",
"referral",
"nxrrset",
"nxdomain",
"recursion",
"failure",
"duplicate",
"dropped"
};
int i;
isc_uint64_t *p =
if (p == NULL)
return (ISC_R_NOMEMORY);
for (i = 0; i < DNS_STATS_NCOUNTERS; i++)
p[i] = 0;
*ctrp = p;
return (ISC_R_SUCCESS);
}
void
}