log.h revision f16a6bfb6cb4559cce89943f9427d4ec054fbdc4
9bff67898d55cddfcec9ce30cc2b1bb6211ec691David Lawrence/*
9bff67898d55cddfcec9ce30cc2b1bb6211ec691David Lawrence * Copyright (C) 2004-2007, 2009, 2011-2015 Internet Systems Consortium, Inc. ("ISC")
9bff67898d55cddfcec9ce30cc2b1bb6211ec691David Lawrence * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Permission to use, copy, modify, and/or distribute this software for any
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * purpose with or without fee is hereby granted, provided that the above
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * copyright notice and this permission notice appear in all copies.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * PERFORMANCE OF THIS SOFTWARE.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence/*! \file dns/log.h
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * \author Principal Authors: DCL */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#ifndef DNS_LOG_H
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOG_H 1
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#include <isc/lang.h>
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#include <isc/log.h>
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David LawrenceLIBDNS_EXTERNAL_DATA extern isc_log_t *dns_lctx;
bf668d00172e2308da0e01048284d7efa85495b1David LawrenceLIBDNS_EXTERNAL_DATA extern isc_logcategory_t dns_categories[];
bf668d00172e2308da0e01048284d7efa85495b1David LawrenceLIBDNS_EXTERNAL_DATA extern isc_logmodule_t dns_modules[];
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_NOTIFY (&dns_categories[0])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_DATABASE (&dns_categories[1])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_SECURITY (&dns_categories[2])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence/* DNS_LOGCATEGORY_CONFIG superseded by CFG_LOGCATEGORY_CONFIG */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_DNSSEC (&dns_categories[4])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_RESOLVER (&dns_categories[5])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_XFER_IN (&dns_categories[6])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_XFER_OUT (&dns_categories[7])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_DISPATCH (&dns_categories[8])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_LAME_SERVERS (&dns_categories[9])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_DELEGATION_ONLY (&dns_categories[10])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_EDNS_DISABLED (&dns_categories[11])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_RPZ (&dns_categories[12])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_RRL (&dns_categories[13])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_CNAME (&dns_categories[14])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_SPILL (&dns_categories[15])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence/* Backwards compatibility. */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_DB (&dns_modules[0])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_RBTDB (&dns_modules[1])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_RBTDB64 (&dns_modules[2])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_RBT (&dns_modules[3])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_RDATA (&dns_modules[4])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_MASTER (&dns_modules[5])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_MESSAGE (&dns_modules[6])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_CACHE (&dns_modules[7])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_CONFIG (&dns_modules[8])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_RESOLVER (&dns_modules[9])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_ZONE (&dns_modules[10])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_JOURNAL (&dns_modules[11])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_ADB (&dns_modules[12])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_XFER_IN (&dns_modules[13])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_XFER_OUT (&dns_modules[14])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_ACL (&dns_modules[15])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_VALIDATOR (&dns_modules[16])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_DISPATCH (&dns_modules[17])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_REQUEST (&dns_modules[18])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_MASTERDUMP (&dns_modules[19])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_TSIG (&dns_modules[20])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_TKEY (&dns_modules[21])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_SDB (&dns_modules[22])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_DIFF (&dns_modules[23])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_HINTS (&dns_modules[24])
1641377cbaa7aac054bfa6b5c6172ed64044e020David Lawrence#define DNS_LOGMODULE_ACACHE (&dns_modules[25])
1641377cbaa7aac054bfa6b5c6172ed64044e020David Lawrence#define DNS_LOGMODULE_DLZ (&dns_modules[26])
1641377cbaa7aac054bfa6b5c6172ed64044e020David Lawrence#define DNS_LOGMODULE_DNSSEC (&dns_modules[27])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_CRYPTO (&dns_modules[28])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_PACKETS (&dns_modules[29])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#define DNS_LOGMODULE_NTA (&dns_modules[30])
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David LawrenceISC_LANG_BEGINDECLS
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrencevoid
bf668d00172e2308da0e01048284d7efa85495b1David Lawrencedns_log_init(isc_log_t *lctx);
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence/*%
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Make the libdns categories and modules available for use with the
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * ISC logging library.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Requires:
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *\li lctx is a valid logging context.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *\li dns_log_init() is called only once.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Ensures:
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * \li The categories and modules defined above are available for
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * use by isc_log_usechannnel() and isc_log_write().
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrencevoid
bf668d00172e2308da0e01048284d7efa85495b1David Lawrencedns_log_setcontext(isc_log_t *lctx);
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence/*%
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Make the libdns library use the provided context for logging internal
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * messages.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence * Requires:
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence *\li lctx is a valid logging context.
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David LawrenceISC_LANG_ENDDECLS
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence#endif /* DNS_LOG_H */
bf668d00172e2308da0e01048284d7efa85495b1David Lawrence