stats.h 3.14 KB
Newer Older
1
/*
Automatic Updater's avatar
Automatic Updater committed
2
 * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
Brian Wellington's avatar
Brian Wellington committed
3
 * Copyright (C) 2000, 2001  Internet Software Consortium.
4
 *
Automatic Updater's avatar
Automatic Updater committed
5
 * Permission to use, copy, modify, and/or distribute this software for any
6 7 8
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
Mark Andrews's avatar
Mark Andrews committed
9 10 11 12 13 14 15
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
16 17
 */

18
/* $Id: stats.h,v 1.14 2008/01/24 02:00:44 jinmei Exp $ */
19 20 21 22

#ifndef DNS_STATS_H
#define DNS_STATS_H 1

23
/*! \file dns/stats.h */
24

25 26
#include <dns/types.h>

27
/*%
28 29 30
 * Query statistics counter types.
 */
typedef enum {
31 32 33 34 35
	dns_statscounter_success = 0,    /*%< Successful lookup */
	dns_statscounter_referral = 1,   /*%< Referral result */
	dns_statscounter_nxrrset = 2,    /*%< NXRRSET result */
	dns_statscounter_nxdomain = 3,   /*%< NXDOMAIN result */
	dns_statscounter_recursion = 4,  /*%< Recursion was used */
36
	dns_statscounter_failure = 5,    /*%< Some other failure */
37 38
	dns_statscounter_duplicate = 6,  /*%< Duplicate query */
	dns_statscounter_dropped = 7     /*%< Duplicate query */
39 40
} dns_statscounter_t;

41
#define DNS_STATS_NCOUNTERS 8
42

Danny Mayer's avatar
Danny Mayer committed
43
LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[];
44

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
isc_result_t
dns_stats_create(isc_mem_t *mctx, dns_stats_t **statsp);
/*%<
 * Create a statistics counter structure.
 *
 * Requires:
 *
 *\li	'mctx' must be a valid memory context.
 *
 *\li	'statsp' != NULL && '*statsp' == NULL.
 */

void
dns_stats_destroy(isc_mem_t *mctx, dns_stats_t **statsp);
/*%<
 * Destroy a statistics counter structure.
 *
 * Requires:
 *
 *\li	'mctx' must be a valid memory context.
 *
 *\li	'statsp' != NULL and '*statsp' be valid dns_stats_t.
 *
 * Ensures:
 *
 *\li	'*statsp' == NULL
 */

void
dns_stats_incrementcounter(dns_stats_t *stat, dns_statscounter_t counter);
/*%<
 * Increment a counter field of 'stat' specified by 'counter'.
 *
 * Requires:
 *
 *\li	'stat' be a valid dns_stats_t.
 *
 *\li	counter < DNS_STATS_NCOUNTERS
 */

void
dns_stats_copy(dns_stats_t *src, isc_uint64_t *dst);
/*%<
 * Copy statistics counter fields of 'src' to the 'dst' array.
 *
 * Requires:
 *
 *\li	'src' be a valid dns_stats_t.
 *
 *\li	'dst' be sufficiently large to store DNS_STATS_NCOUNTERS 64-bit
 *	integers.
 */

98 99
isc_result_t
dns_stats_alloccounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
100
/*%<
101 102
 * Allocate an array of query statistics counters from the memory
 * context 'mctx'.
103 104
 *
 * This function is obsoleted.  Use dns_stats_create() instead.
105 106 107 108
 */

void
dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
109
/*%<
110 111
 * Free an array of query statistics counters allocated from the memory
 * context 'mctx'.
112 113
 *
 * This function is obsoleted.  Use dns_stats_destroy() instead.
114 115 116 117 118
 */

ISC_LANG_ENDDECLS

#endif /* DNS_STATS_H */