4:24
  +   ˆl–äY>”ËmJq@³p/\h
bÑ¿Á„e¶Z_†I|¥�+ÁÀ ?÷     /*
 * Copyright (C) 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 https://mozilla.org/MPL/2.0/.
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
 */

#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1

/*****
***** Module Info
*****/

/*! \file dns/view.h
 * \brief
 * DNS View
 *
 * A "view" is a DNS namespace, together with an optional resolver and a
 * forwarding policy.  A "DNS namespace" is a (possibly empty) set of
 * authoritative zones together with an optional cache and optional
 * "hints" information.
 *
 * Views start out "unfrozen".  In this state, core attributes like
 * the cache, set of zones, and forwarding policy may be set.  While
 * "unfrozen", the caller (e.g. nameserver configuration loading
 * code), must ensure exclusive access to the view.  When the view is
 * "frozen", the core attributes become immutable, and the view module
 * will ensure synchronization.  Freezing allows the view's core attributes
 * to be accessed without locking.
 *
 * MP:
 *\li	Before the view is frozen, the caller must ensure synchronization.
 *
 *\li	After the view is frozen, the module guarantees appropriate
 *	synchronization of any data structures it creates and manipulates.
 *
 * Reliability:
 *\li	No anticipated impact.
 *
 * Resources:
 *\li	TBS
 *
 * Security:
 *\li	No anticipated impact.
 *
 * Standards:
 *\li	None.
 */

#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>

#include <isc/event.h>
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/mutex.h>
#include <isc/net.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
#include <isc/stdtime.h>

#include <dns/acl.h>
#include <dns/catz.h>
#include <dns/clientinfo.h>
#include <dns/dnstap.h>
#include <dns/fixedname.h>
#include <dns/rdatastruct.h>
#include <dns/rpz.h>
#include <dns/rrl.h>
#include <dns/types.h>
#include <dns/zt.h>

ISC_LANG_BEGINDECLS

struct dns_view {
	/* Unlocked. */
	unsigned int	  magic;
	isc_mem_t	  *mctx;
	dns_rdataclass_t  rdclass;
	char	     *name;
	dns_zt_t	 *zonetable;
	dns_resolver_t   *resolver;
	dns_adb_t	  *adb;
	dns_requestmgr_t *requestmgr;
	dns_cache_t	    *cache;
	dns_db_t	 *cachedb;
	dns_db_t	 *hints;

	/*
	 * security roots and negative trust anchors.
	 * internal use only; access via * dns_view_getsecroots()
	 */
	dns_keytable_t *secroots_priv;
	dns_ntatable_t *ntatable_priv;

	isc_mutex_t  lock;
	bool	     frozen;
	isc_task_t  *task;
	isc_event_t  resevent;
	isc_event_t  adbevent;
	isc_event_t  reqevent;
	isc_stats_t *adbstats;
	isc_stats_t *resstats;
	dns_stats_t *resquerystats;
	bool	     cacheshared;

	/* Configurable data. */
	dns_tsig_keyring_t   *statickeys;
	dns_tsig_keyring_t   *dynamickeys;
	dns_peerlist_t       *peers;
	dns_order_t	    *order;
	dns_fwdtable_t       *fwdtable;
	bool		      recursion;
	bool		      qminimization;
	bool		      qmin_strict;
	bool		      auth_nxdomain;
	bool		      use_glue_cache;
	bool		      minimal_any;
	dns_minimaltype_t     minimalresponses;
	bool		      enablevalidation;
	bool		      acceptexpired;
	bool		      requireservercookie;
	bool		      synthfromdnssec;
	bool		      trust_anchor_telemetry;
	bool		      root_key_sentinel;
	dns_transfer_format_t transfer_format;
	dns_acl_t		  *cacheacl;
	dns_acl_t		  *cacheonacl;
	dns_acl_t		  *queryacl;
	dns_acl_t		  *queryonacl;
	dns_acl_t		  *recursionacl;
	dns_acl_t		  *recursiononacl;
	dns_acl_t		  *sortlist;
	dns_acl_t		  *notifyacl;
	dns_acl_t		  *transferacl;
	dns_acl_t		  *updateacl;
	dns_acl_t		  *upfwdacl;
	dns_acl_t		  *denyansweracl;
	dns_acl_t		  *nocasecompress;
	bool		      msgcompression;
	dns_rbt_t		  *answeracl_exclude;
	dns_rbt_t		  *denyanswernames;
	dns_rbt_t		  *answernames_exclude;
	dns_rrl_t		  *rrl;
	bool		      provideixfr;
	bool		      requestnsid;
	bool		      sendcookie;
	dns_ttl_t	      maxcachettl;
	dns_t