f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley/*
af0d9b770594ece695cc9a7325ed42abb728a5f7Tinderbox User * Copyright (C) 1999-2017 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#ifndef DNS_VIEW_H
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#define DNS_VIEW_H 1
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley/*****
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley ***** Module Info
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *****/
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews/*! \file dns/view.h
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \brief
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * DNS View
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * A "view" is a DNS namespace, together with an optional resolver and a
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * forwarding policy. A "DNS namespace" is a (possibly empty) set of
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * authoritative zones together with an optional cache and optional
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * "hints" information.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Views start out "unfrozen". In this state, core attributes like
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * the cache, set of zones, and forwarding policy may be set. While
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * "unfrozen", the caller (e.g. nameserver configuration loading
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * code), must ensure exclusive access to the view. When the view is
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * "frozen", the core attributes become immutable, and the view module
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * will ensure synchronization. Freezing allows the view's core attributes
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * to be accessed without locking.
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * MP:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li Before the view is frozen, the caller must ensure synchronization.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li After the view is frozen, the module guarantees appropriate
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * synchronization of any data structures it creates and manipulates.
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * Reliability:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li No anticipated impact.
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * Resources:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li TBS
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * Security:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li No anticipated impact.
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley *
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley * Standards:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li None.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
ee10d3de1801d564356af201aa7941d67e1ed85dBrian Wellington#include <stdio.h>
ee10d3de1801d564356af201aa7941d67e1ed85dBrian Wellington
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#include <isc/lang.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <isc/magic.h>
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#include <isc/event.h>
0a88c09dc9cbd75a37cc278d8da0f1fd09768856Brian Wellington#include <isc/mutex.h>
4831695ebef7aab249d77628c12ee4920c177459Andreas Gustafsson#include <isc/net.h>
63ca494e7e9aba8dc6740443fdab69620c7a7523Brian Wellington#include <isc/refcount.h>
143c2d39fafc0e36e0fa291b7708b60309e5a1b6Andreas Gustafsson#include <isc/rwlock.h>
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley#include <isc/stdtime.h>
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington#include <dns/acl.h>
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki#include <dns/catz.h>
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt#include <dns/clientinfo.h>
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt#include <dns/dnstap.h>
50105afc551903541608b11851d73278b23579a3Mark Andrews#include <dns/fixedname.h>
55e5c51e661e23e24573db84114a3837817745c9Evan Hunt#include <dns/rrl.h>
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews#include <dns/rdatastruct.h>
87708bde16713bc02ff2598f4a82f98c699a2f2dMark Andrews#include <dns/rpz.h>
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#include <dns/types.h>
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt#include <dns/zt.h>
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob HalleyISC_LANG_BEGINDECLS
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleystruct dns_view {
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley /* Unlocked. */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley unsigned int magic;
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley isc_mem_t * mctx;
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley dns_rdataclass_t rdclass;
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley char * name;
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrews dns_zt_t * zonetable;
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley dns_resolver_t * resolver;
726290e9d5b720b736fa39d9f7d92c2efb7d1f24Bob Halley dns_adb_t * adb;
9e53cbca72767d0c91962b7a01650ea07d7398ddMark Andrews dns_requestmgr_t * requestmgr;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 dns_acache_t * acache;
fd15c8e32ed0c1cfd3ed737858a81966e7fbaeacAndreas Gustafsson dns_cache_t * cache;
2504b0a58600c1156a6b829c816d13c58a069453Bob Halley dns_db_t * cachedb;
38980568375a6505452550b5677104ab44291b66Bob Halley dns_db_t * hints;
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt /*
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * security roots and negative trust anchors.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * internal use only; access via * dns_view_getsecroots()
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt */
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt dns_keytable_t * secroots_priv;
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt dns_ntatable_t * ntatable_priv;
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley isc_mutex_t lock;
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley isc_boolean_t frozen;
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley isc_task_t * task;
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley isc_event_t resevent;
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley isc_event_t adbevent;
9e53cbca72767d0c91962b7a01650ea07d7398ddMark Andrews isc_event_t reqevent;
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt isc_stats_t * adbstats;
d9059b0c38bd630c367d81424d72b1308cd74b04Tatuya JINMEI 神明達哉 isc_stats_t * resstats;
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews dns_stats_t * resquerystats;
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 isc_boolean_t cacheshared;
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews
65a66336a6e2ce2032f68139ef9c8afe18d08c14Andreas Gustafsson /* Configurable data. */
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington dns_tsig_keyring_t * statickeys;
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington dns_tsig_keyring_t * dynamickeys;
03ccfda9ec9fde56c83b381eccbac44071b36143Andreas Gustafsson dns_peerlist_t * peers;
2dd99c098ca162f985b7ef3c8142a964ad8281aeMark Andrews dns_order_t * order;
30e6ea9dedbe0738f9729833b1b59042dbebc4dfBrian Wellington dns_fwdtable_t * fwdtable;
66e2dd5001f249bc5e2c89074df41f769f13bf07Andreas Gustafsson isc_boolean_t recursion;
66e2dd5001f249bc5e2c89074df41f769f13bf07Andreas Gustafsson isc_boolean_t auth_nxdomain;
6d3496c045bbf35514b4697ff20741975083e125Michael Graff isc_boolean_t additionalfromcache;
6d3496c045bbf35514b4697ff20741975083e125Michael Graff isc_boolean_t additionalfromauth;
0cbe448914be61d0f92b1e9d3adaeba87d25639dEvan Hunt isc_boolean_t minimal_any;
2fb6d3782b548ba678cfb8ff09e0d1e49fafb84dMark Andrews dns_minimaltype_t minimalresponses;
89783da064f4f9bf2e82d2b3941ddeffe2a8c30dMark Andrews isc_boolean_t enablednssec;
cfe92110ce4eaf19f7f3255d2961710879bdc9ddMark Andrews isc_boolean_t enablevalidation;
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrews isc_boolean_t acceptexpired;
c631ff56bfe13f7b47ff01950364f4db423bf21aMark Andrews isc_boolean_t requireservercookie;
b7161f9898405faee05ba72a63ad10e4541f1346Mark Andrews isc_boolean_t trust_anchor_telemetry;
66e2dd5001f249bc5e2c89074df41f769f13bf07Andreas Gustafsson dns_transfer_format_t transfer_format;
ed83fa75f5657ab2394a701f7ccc169dd9ef48fcMark Andrews dns_acl_t * cacheacl;
ed83fa75f5657ab2394a701f7ccc169dd9ef48fcMark Andrews dns_acl_t * cacheonacl;
a672bfbee46c261729811405685db409bd7c9285Andreas Gustafsson dns_acl_t * queryacl;
819b98479eff49ed93f57f4d65eb0ffe72136adcMark Andrews dns_acl_t * queryonacl;
a672bfbee46c261729811405685db409bd7c9285Andreas Gustafsson dns_acl_t * recursionacl;
819b98479eff49ed93f57f4d65eb0ffe72136adcMark Andrews dns_acl_t * recursiononacl;
febaa091847ab004f40500cc475a819f2c73fcddAndreas Gustafsson dns_acl_t * sortlist;
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt dns_acl_t * notifyacl;
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt dns_acl_t * transferacl;
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt dns_acl_t * updateacl;
5a17fe2916ce37793c12b243ab08c16095a59cf7Evan Hunt dns_acl_t * upfwdacl;
40d0f115a64595aa83cfe0b760587d3d1efa0385Tatuya JINMEI 神明達哉 dns_acl_t * denyansweracl;
166341d55424ca522eb456a1c7d0211e391f1ac8Evan Hunt dns_acl_t * nocasecompress;
bfd4b9e11aa9e8c2b43022a6b7a896b26bd5d7a0Witold Krecicki isc_boolean_t msgcompression;
40d0f115a64595aa83cfe0b760587d3d1efa0385Tatuya JINMEI 神明達哉 dns_rbt_t * answeracl_exclude;
40d0f115a64595aa83cfe0b760587d3d1efa0385Tatuya JINMEI 神明達哉 dns_rbt_t * denyanswernames;
40d0f115a64595aa83cfe0b760587d3d1efa0385Tatuya JINMEI 神明達哉 dns_rbt_t * answernames_exclude;
55e5c51e661e23e24573db84114a3837817745c9Evan Hunt dns_rrl_t * rrl;
edcb93b49c763709ead9374a15ec3b7c4d904383Andreas Gustafsson isc_boolean_t provideixfr;
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews isc_boolean_t requestnsid;
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews isc_boolean_t sendcookie;
7cd4c3ddd1baf5f2b204562fdba3da37c716cc78Andreas Gustafsson dns_ttl_t maxcachettl;
7cd4c3ddd1baf5f2b204562fdba3da37c716cc78Andreas Gustafsson dns_ttl_t maxncachettl;
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt isc_uint32_t nta_lifetime;
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt isc_uint32_t nta_recheck;
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman char *nta_file;
fb756ba3047770957173ba546257ca43af7ba3e4Mark Andrews dns_ttl_t prefetch_trigger;
fb756ba3047770957173ba546257ca43af7ba3e4Mark Andrews dns_ttl_t prefetch_eligible;
d98c74e2ec5b96bd22aa4ed6d893e8993787493bMichael Graff in_port_t dstport;
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington dns_aclenv_t aclenv;
c4a9ce445c48a57eed5aa16582b1964cf8cedf87Mark Andrews dns_rdatatype_t preferred_glue;
de4976142190ae84ed3e4099f3e0fc07781748a3Mark Andrews isc_boolean_t flush;
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews dns_namelist_t * delonly;
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews isc_boolean_t rootdelonly;
f4fb3dc516024599e8ffdda35461d4f22ab591c7Mark Andrews dns_namelist_t * rootexclude;
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews isc_boolean_t checknames;
50105afc551903541608b11851d73278b23579a3Mark Andrews dns_name_t * dlv;
50105afc551903541608b11851d73278b23579a3Mark Andrews dns_fixedname_t dlv_fixed;
08c90261660649ca7d92065f6f13a61ec5a9a86dMark Andrews isc_uint16_t maxudp;
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews isc_uint16_t nocookieudp;
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews unsigned int maxbits;
d878b8d87c3f46a25ccae9f5cfe6e39af67562e0Evan Hunt dns_aaaa_t v4_aaaa;
d878b8d87c3f46a25ccae9f5cfe6e39af67562e0Evan Hunt dns_aaaa_t v6_aaaa;
d878b8d87c3f46a25ccae9f5cfe6e39af67562e0Evan Hunt dns_acl_t * aaaa_acl;
e334405421979688f2d838805ac67ee47bd62976Mark Andrews dns_dns64list_t dns64;
e334405421979688f2d838805ac67ee47bd62976Mark Andrews unsigned int dns64cnt;
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt dns_rpz_zones_t *rpzs;
7a00d69909ace5dc11bcff9c1e07c311f92a7f8eWitold Krecicki dns_catz_zones_t *catzs;
2b8bed6681d1541474f022586cbe728dfce36880Evan Hunt dns_dlzdblist_t dlz_searched;
2b8bed6681d1541474f022586cbe728dfce36880Evan Hunt dns_dlzdblist_t dlz_unsearched;
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt isc_uint32_t fail_ttl;
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt dns_badcache_t *failcache;
edcb93b49c763709ead9374a15ec3b7c4d904383Andreas Gustafsson
76ec142174aca78f1c476559b4a0b54efa9c3863Andreas Gustafsson /*
76ec142174aca78f1c476559b4a0b54efa9c3863Andreas Gustafsson * Configurable data for server use only,
76ec142174aca78f1c476559b4a0b54efa9c3863Andreas Gustafsson * locked by server configuration lock.
76ec142174aca78f1c476559b4a0b54efa9c3863Andreas Gustafsson */
76ec142174aca78f1c476559b4a0b54efa9c3863Andreas Gustafsson dns_acl_t * matchclients;
ee3ab6063dd13b5947d3fbe88b9ce8f38d65df9dBrian Wellington dns_acl_t * matchdestinations;
ee3ab6063dd13b5947d3fbe88b9ce8f38d65df9dBrian Wellington isc_boolean_t matchrecursiveonly;
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence
63ca494e7e9aba8dc6740443fdab69620c7a7523Brian Wellington /* Locked by themselves. */
63ca494e7e9aba8dc6740443fdab69620c7a7523Brian Wellington isc_refcount_t references;
63ca494e7e9aba8dc6740443fdab69620c7a7523Brian Wellington
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley /* Locked by lock. */
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson unsigned int weakrefs;
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley unsigned int attributes;
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley /* Under owner's locking control. */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley ISC_LINK(struct dns_view) link;
cfb1587eb9a6dc6d1d36ea0344e1b20068b81e88Evan Hunt dns_viewlist_t * viewlist;
515c7f3c43f76d7b439905b18009105364b36100Automatic Updater
778a01b1aa76273d4a28c7559a509edc7a00ec95Mark Andrews dns_zone_t * managed_keys;
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews dns_zone_t * redirect;
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt dns_name_t * redirectzone; /* points to
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt * redirectfixed
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt * when valid */
c82b3781158672e8308b53a8b6289e432ceb48d0Mark Andrews dns_fixedname_t redirectfixed;
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
12253af3465f150a3b2f2cdaf15f396a5c060c21Tinderbox User /*
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * File and configuration data for zones added at runtime
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * (only used in BIND9).
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * XXX: This should be a pointer to an opaque type that
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * named implements.
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt */
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt char * new_zone_file;
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt char * new_zone_db;
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt void * new_zone_dbenv;
214b53880b6d77359f60feccb91bd2589059300aEvan Hunt isc_uint64_t new_zone_mapsize;
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt void * new_zone_config;
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt void (*cfg_destroy)(void **);
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt isc_mutex_t new_zone_lock;
b5f6271f4daf1e54501af2cb7dd278d7e8003d65Mark Andrews
79bd3cf027811a91b1e9a40fd7f17bf7eeec0406Mark Andrews unsigned char secret[32]; /* Client secret */
98a7f8c7ae44bb98d5469cb3a4240c59abceba7fMark Andrews unsigned int v6bias;
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt dns_dtenv_t *dtenv; /* Dnstap environment */
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt dns_dtmsgtype_t dttypes; /* Dnstap message types
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt to log */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley};
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
28fc90e6c81338c5f34e065fdda49d320e362583Mark Andrews#define DNS_VIEW_MAGIC ISC_MAGIC('V','i','e','w')
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#define DNS_VIEW_VALID(view) ISC_MAGIC_VALID(view, DNS_VIEW_MAGIC)
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley#define DNS_VIEWATTR_RESSHUTDOWN 0x01
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley#define DNS_VIEWATTR_ADBSHUTDOWN 0x02
9e53cbca72767d0c91962b7a01650ea07d7398ddMark Andrews#define DNS_VIEWATTR_REQSHUTDOWN 0x04
205790a755849f9b9ec12dd7836dcd87ca580d89Bob Halley
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#ifdef HAVE_LMDB
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#include <lmdb.h>
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień/*
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień * MDB_NOTLS is used to prevent problems after configuration is reloaded, due
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień * to the way LMDB's use of thread-local storage (TLS) interacts with the BIND9
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień * thread model.
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień */
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#define DNS_LMDB_COMMON_FLAGS (MDB_CREATE | MDB_NOSUBDIR | MDB_NOTLS)
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#ifndef __OpenBSD__
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS)
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#else /* __OpenBSD__ */
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień/*
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień * OpenBSD does not have a unified buffer cache, which requires both reads and
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień * writes to be performed using mmap().
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień */
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP)
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#endif /* __OpenBSD__ */
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień#endif /* HAVE_LMDB */
81e3e3084980afcd61416f572c6e72d38a3808abMichał Kępień
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleyisc_result_t
6f44af1c8320e84d6b0c0c42bacadfe3020d9a91Mark Andrewsdns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
6f44af1c8320e84d6b0c0c42bacadfe3020d9a91Mark Andrews const char *name, dns_view_t **viewp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Create a view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Notes:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li The newly created view has no cache, no resolver, and an empty
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * zone table. The view is not frozen.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'mctx' is a valid memory context.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'rdclass' is a valid class.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is a valid C string.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li viewp != NULL && *viewp == NULL
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Returns:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOMEMORY
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li Other errors are possible.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleyvoid
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleydns_view_attach(dns_view_t *source, dns_view_t **targetp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Attach '*targetp' to 'source'.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'source' is a valid, frozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'targetp' points to a NULL dns_view_t *.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li *targetp is attached to source.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li While *targetp is attached, the view will not shut down.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleyvoid
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halleydns_view_detach(dns_view_t **viewp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Detach '*viewp' from its view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'viewp' points to a valid dns_view_t *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li *viewp is NULL.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson */
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrewsvoid
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrewsdns_view_flushanddetach(dns_view_t **viewp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews * Detach '*viewp' from its view. If this was the last reference
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont * uncommitted changed in zones will be flushed to disk.
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews *
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews * Requires:
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'viewp' points to a valid dns_view_t *
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews *
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews * Ensures:
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li *viewp is NULL.
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews */
2a37aa188c2297e0c0856c3e5740c43dd426a432Mark Andrews
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafssonvoid
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafssondns_view_weakattach(dns_view_t *source, dns_view_t **targetp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Weakly attach '*targetp' to 'source'.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Requires:
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'source' is a valid, frozen view.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'targetp' points to a NULL dns_view_t *.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li *targetp is attached to source.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li While *targetp is attached, the view will not be freed.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson */
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafssonvoid
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafssondns_view_weakdetach(dns_view_t **targetp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Detach '*viewp' from its view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Requires:
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'viewp' points to a valid dns_view_t *.
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson * Ensures:
22608315e8e08b1fef12bce6e123c9ff6fe7a17cAndreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li *viewp is NULL.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Huntisc_result_t
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Huntdns_view_createzonetable(dns_view_t *view);
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt/*%<
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * Create a zonetable for the view.
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * Requires:
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *\li 'view' is a valid, unfrozen view.
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *\li 'view' does not have a zonetable already.
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt * Returns:
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *\li #ISC_R_SUCCESS
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt *\li Any error that dns_zt_create() can return.
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt */
b99bfa184bc9375421b5df915eea7dfac6a68a99Evan Hunt
38980568375a6505452550b5677104ab44291b66Bob Halleyisc_result_t
e3027d397f237ff018174fd17bf377a4a1890c6bBob Halleydns_view_createresolver(dns_view_t *view,
4e8fe357a619ae2b789b15df7e3d6abf782b4a71Evan Hunt isc_taskmgr_t *taskmgr,
4e8fe357a619ae2b789b15df7e3d6abf782b4a71Evan Hunt unsigned int ntasks, unsigned int ndisp,
e3027d397f237ff018174fd17bf377a4a1890c6bBob Halley isc_socketmgr_t *socketmgr,
e3027d397f237ff018174fd17bf377a4a1890c6bBob Halley isc_timermgr_t *timermgr,
0df20c101eea3ffa57d9554ec20a1b710fa63064Bob Halley unsigned int options,
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff dns_dispatchmgr_t *dispatchmgr,
0df20c101eea3ffa57d9554ec20a1b710fa63064Bob Halley dns_dispatch_t *dispatchv4,
0df20c101eea3ffa57d9554ec20a1b710fa63064Bob Halley dns_dispatch_t *dispatchv6);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
726290e9d5b720b736fa39d9f7d92c2efb7d1f24Bob Halley * Create a resolver and address database for the view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, unfrozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' does not have a resolver already.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li The requirements of dns_resolver_create() apply to 'taskmgr',
0df20c101eea3ffa57d9554ec20a1b710fa63064Bob Halley * 'ntasks', 'socketmgr', 'timermgr', 'options', 'dispatchv4', and
0df20c101eea3ffa57d9554ec20a1b710fa63064Bob Halley * 'dispatchv6'.
38980568375a6505452550b5677104ab44291b66Bob Halley *
38980568375a6505452550b5677104ab44291b66Bob Halley * Returns:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
38980568375a6505452550b5677104ab44291b66Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li Any error that dns_resolver_create() can return.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halley
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halleyvoid
fd15c8e32ed0c1cfd3ed737858a81966e7fbaeacAndreas Gustafssondns_view_setcache(dns_view_t *view, dns_cache_t *cache);
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉void
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * Set the view's cache database. If 'shared' is true, this means the cache
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * is created by another view and is shared with that view. dns_view_setcache()
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * is a backward compatible version equivalent to setcache2(..., ISC_FALSE).
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, unfrozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'cache' is a valid cache.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li The cache of 'view' is 'cached.
726290e9d5b720b736fa39d9f7d92c2efb7d1f24Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If this is not the first call to dns_view_setcache() for this
fd15c8e32ed0c1cfd3ed737858a81966e7fbaeacAndreas Gustafsson * view, then previously set cache is detached.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halley
38980568375a6505452550b5677104ab44291b66Bob Halleyvoid
38980568375a6505452550b5677104ab44291b66Bob Halleydns_view_sethints(dns_view_t *view, dns_db_t *hints);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
38980568375a6505452550b5677104ab44291b66Bob Halley * Set the view's hints database.
38980568375a6505452550b5677104ab44291b66Bob Halley *
38980568375a6505452550b5677104ab44291b66Bob Halley * Requires:
38980568375a6505452550b5677104ab44291b66Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, unfrozen view, whose hints database has not been
38980568375a6505452550b5677104ab44291b66Bob Halley * set.
38980568375a6505452550b5677104ab44291b66Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'hints' is a valid zone database.
38980568375a6505452550b5677104ab44291b66Bob Halley *
38980568375a6505452550b5677104ab44291b66Bob Halley * Ensures:
38980568375a6505452550b5677104ab44291b66Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li The hints database of 'view' is 'hints'.
38980568375a6505452550b5677104ab44291b66Bob Halley */
38980568375a6505452550b5677104ab44291b66Bob Halley
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellingtonvoid
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellingtondns_view_setkeyring(dns_view_t *view, dns_tsig_keyring_t *ring);
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsvoid
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsdns_view_setdynamickeyring(dns_view_t *view, dns_tsig_keyring_t *ring);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Set the view's static TSIG keys
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Requires:
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li 'view' is a valid, unfrozen view, whose static TSIG keyring has not
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * been set.
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'ring' is a valid TSIG keyring
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Ensures:
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li The static TSIG keyring of 'view' is 'ring'.
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington */
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsvoid
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsdns_view_getdynamickeyring(dns_view_t *view, dns_tsig_keyring_t **ringp);
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews/*%<
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews * Return the views dynamic keys.
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews *
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews * \li 'view' is a valid, unfrozen view.
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews * \li 'ringp' != NULL && ringp == NULL.
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews */
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafssonvoid
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafssondns_view_setdstport(dns_view_t *view, in_port_t dstport);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * Set the view's destination port. This is the port to
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * which outgoing queries are sent. The default is 53,
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * the standard DNS port.
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson *
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * Requires:
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid view.
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'dstport' is a valid TCP/UDP port number.
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson *
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * Ensures:
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont *\li External name servers will be assumed to be listening
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * on 'dstport'. For servers whose address has already
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * obtained obtained at the time of the call, the view may
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * continue to use the previously set port until the address
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson * times out from the view's address database.
f1f2f8bd47370a231c5c700ef918bd6ad6c7d042Andreas Gustafsson */
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halleyisc_result_t
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrewsdns_view_addzone(dns_view_t *view, dns_zone_t *zone);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrews * Add zone 'zone' to 'view'.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, unfrozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'zone' is a valid zone.
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrews */
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halley
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halleyvoid
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halleydns_view_freeze(dns_view_t *view);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * Freeze view. No changes can be made to view configuration while frozen.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, unfrozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is frozen.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Huntvoid
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Huntdns_view_thaw(dns_view_t *view);
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt/*%<
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * Thaw view. This allows zones to be added or removed at runtime. This is
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * NOT thread-safe; the caller MUST have run isc_task_exclusive() prior to
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * thawing the view.
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * Requires:
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *\li 'view' is a valid, frozen view.
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt * Ensures:
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt *\li 'view' is no longer frozen.
86dcc4005887f91d23d970d4574a8f6afa7e28d2Evan Hunt */
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halleyisc_result_t
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halleydns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname,
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉isc_result_t
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 isc_stdtime_t now, unsigned int options,
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 isc_boolean_t use_hints, isc_boolean_t use_static_stub,
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname,
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * Find an rdataset whose owner name is 'name', and whose type is
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * 'type'.
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * In general, this function first searches view's zone and cache DBs for the
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * best match data against 'name'. If nothing found there, and if 'use_hints'
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * is ISC_TRUE, the view's hint DB (if configured) is searched.
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * If the view is configured with a static-stub zone which gives the longest
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * match for 'name' among the zones, however, the cache DB is not consulted
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * unless 'use_static_stub' is ISC_FALSE (see below about this argument).
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 *
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * dns_view_find() is a backward compatible version equivalent to
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * dns_view_find2() with use_static_stub argument being ISC_FALSE.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * Notes:
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li See the description of dns_db_find() for information about 'options'.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * If the caller sets #DNS_DBFIND_GLUEOK, it must ensure that 'name'
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * and 'type' are appropriate for glue retrieval.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'now' is zero, then the current time will be used.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * it will be searched last. If the answer is found in the hints
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington * database, the result code will be DNS_R_HINT. If the name is found
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington * in the hints database but not the type, the result code will be
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * #DNS_R_HINTNXRRSET.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 *\li If 'use_static_stub' is ISC_FALSE and the longest match zone for 'name'
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * is a static-stub zone, it's ignored and the cache and/or hints will be
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * searched. In the majority of the cases this argument should be
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * ISC_FALSE. The only known usage of this argument being ISC_TRUE is
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * if this search is for a "bailiwick" glue A or AAAA RRset that may
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * best match a static-stub zone. Consider the following example:
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * this view is configured with a static-stub zone "example.com",
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * and an attempt of recursive resolution needs to send a query for the
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * zone. In this case it's quite likely that the resolver is trying to
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * find A/AAAA RRs for the apex name "example.com". And, to honor the
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * static-stub configuration it needs to return the glue RRs in the
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * static-stub zone even if that exact RRs coming from the authoritative
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * zone has been cached.
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * In other general cases, the requested data is better to be
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * authoritative, either locally configured or retrieved from an external
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 * server, and the data in the static-stub zone should better be ignored.
743bbdc18f839499862e4fb28ec32f607b1632dcTatuya JINMEI 神明達哉 *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'foundname' must meet the requirements of dns_db_find().
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * covers 'type', then 'sigrdataset' will be bound to it.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * Requires:
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, frozen view.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid name.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'type' is a valid dns_rdatatype_t, and is not a meta query type
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington * except dns_rdatatype_any.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li dbp == NULL || *dbp == NULL
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li nodep == NULL || *nodep == NULL. If nodep != NULL, dbp != NULL.
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'foundname' is a valid name with a dedicated buffer or NULL.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'rdataset' is a valid, disassociated rdataset.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * Ensures:
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li In successful cases, 'rdataset', and possibly 'sigrdataset', are
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * bound to the found data.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If dbp != NULL, it points to the database containing the data.
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If nodep != NULL, it points to the database node containing the data.
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If foundname != NULL, it contains the full name of the found data.
13090db2b1c210b8386793ff0cbbb0b4348c1ecaBrian Wellington *
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley * Returns:
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li Any result that dns_db_find() can return, with the exception of
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * #DNS_R_DELEGATION.
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley */
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halleyisc_result_t
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halleydns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley isc_stdtime_t now, unsigned int options,
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley isc_boolean_t use_hints,
8f5df5f1fe5aa989dee774cbc2c37c84bfd251d8Bob Halley dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Find an rdataset whose owner name is 'name', and whose type is
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * 'type'.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Notes:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li This routine is appropriate for simple, exact-match queries of the
38980568375a6505452550b5677104ab44291b66Bob Halley * view. 'name' must be a canonical name; there is no DNAME or CNAME
38980568375a6505452550b5677104ab44291b66Bob Halley * processing.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li See the description of dns_db_find() for information about 'options'.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * If the caller sets DNS_DBFIND_GLUEOK, it must ensure that 'name'
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * and 'type' are appropriate for glue retrieval.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'now' is zero, then the current time will be used.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then
38980568375a6505452550b5677104ab44291b66Bob Halley * it will be searched last. If the answer is found in the hints
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington * database, the result code will be DNS_R_HINT. If the name is found
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington * in the hints database but not the type, the result code will be
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington * DNS_R_HINTNXRRSET.
38980568375a6505452550b5677104ab44291b66Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * covers 'type', then 'sigrdataset' will be bound to it.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Requires:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, frozen view.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid name.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'type' is a valid dns_rdatatype_t, and is not a meta query type
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews * (e.g. dns_rdatatype_any), or dns_rdatatype_rrsig.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'rdataset' is a valid, disassociated rdataset.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Ensures:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li In successful cases, 'rdataset', and possibly 'sigrdataset', are
16804ba3b7470cd5d53890f52de823cd9dd2152aBob Halley * bound to the found data.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley * Returns:
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS Success; result is desired type.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_GLUE Success; result is glue.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_HINT Success; result is a hint.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_NCACHENXDOMAIN Success; result is a ncache entry.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_NCACHENXRRSET Success; result is a ncache entry.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_NXDOMAIN The name does not exist.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li DNS_R_NXRRSET The rrset does not exist.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOTFOUND No matching data found,
16804ba3b7470cd5d53890f52de823cd9dd2152aBob Halley * or an error occurred.
c56c5586b49ccddbaf7e2b5c6c06adee1c509253Bob Halley */
19f08273e2592fa48608ec1ac5e021b4b3489030Bob Halley
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*% See dns_view_findzonecut2() */
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halleyisc_result_t
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halleydns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley isc_stdtime_t now, unsigned int options,
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley isc_boolean_t use_hints,
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews
53cf67186506f9557aaf2149898dd76715803db2Mark Andrewsisc_result_t
53cf67186506f9557aaf2149898dd76715803db2Mark Andrewsdns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews isc_stdtime_t now, unsigned int options,
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews isc_boolean_t use_hints, isc_boolean_t use_cache,
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * Find the best known zonecut containing 'name'.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
2f259b4eecb70af7a8d3ac5e4f1b3ed43f49af81Andreas Gustafsson * This uses local authority, cache, and optionally hints data.
2f259b4eecb70af7a8d3ac5e4f1b3ed43f49af81Andreas Gustafsson * No external queries are performed.
2f259b4eecb70af7a8d3ac5e4f1b3ed43f49af81Andreas Gustafsson *
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * Notes:
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'now' is zero, then the current time will be used.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * it will be searched last.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews * searched.
53cf67186506f9557aaf2149898dd76715803db2Mark Andrews *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * covers 'type', then 'sigrdataset' will be bound to it.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * (if any) will be the deepest known ancestor of 'name'.
95e7cd1ecbaa41fbeb47982566d7dfbb9af855cfAndreas Gustafsson *
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * Requires:
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid, frozen view.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid name.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'rdataset' is a valid, disassociated rdataset.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'sigrdataset' is NULL, or is a valid, disassociated rdataset.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley * Returns:
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS Success.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li Many other results are possible.
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley */
08f8af2a42ddd2b87f1d67c09c0ba057b3253f29Bob Halley
e7dbdb25475cdca583dd41f053da2d7c53622b6cBob Halleyisc_result_t
e7dbdb25475cdca583dd41f053da2d7c53622b6cBob Halleydns_viewlist_find(dns_viewlist_t *list, const char *name,
e7dbdb25475cdca583dd41f053da2d7c53622b6cBob Halley dns_rdataclass_t rdclass, dns_view_t **viewp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Search for a view with name 'name' and class 'rdclass' in 'list'.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * If found, '*viewp' is (strongly) attached to it.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Requires:
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'viewp' points to a NULL dns_view_t *.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Returns:
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS A matching view was found.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOTFOUND No matching view was found.
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrews */
800b03baba638ddb3f67cc0d2ad2e70042fe8525Mark Andrews
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrewsisc_result_t
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrewsdns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses,
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews dns_rdataclass_t rdclass, dns_zone_t **zonep);
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews/*%<
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews * Search zone with 'name' in view with 'rdclass' in viewlist 'list'
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews * If found, zone is returned in *zonep. If allclasses is set rdclass is ignored
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews *
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews * Returns:
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews *\li #ISC_R_SUCCESS A matching zone was found.
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews *\li #ISC_R_NOTFOUND No matching zone was found.
c38341ec435fb78de6d12c1001201f9ac7487b68Mark Andrews *\li #ISC_R_MULTIPLE Multiple zones with the same name were found.
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews */
40aadb6a143e0f2d351e743dce43cfc894d4d855Mark Andrews
0b16ae54f714bed65d749e3f601a29246cd98672Mark Andrewsisc_result_t
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafssondns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Search for the zone 'name' in the zone table of 'view'.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * If found, 'zonep' is (strongly) attached to it. There
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * are no partial matches.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Requires:
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'zonep' points to a NULL dns_zone_t *.
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson *
6826f014d6fdcb60a85465dc8290e6582153bbe6Andreas Gustafsson * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS A matching zone was found.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOTFOUND No matching zone was found.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li others An error occurred.
0b16ae54f714bed65d749e3f601a29246cd98672Mark Andrews */
0b16ae54f714bed65d749e3f601a29246cd98672Mark Andrews
036df8a12dc56126ada0e472c22d93d55eef9675Andreas Gustafssonisc_result_t
036df8a12dc56126ada0e472c22d93d55eef9675Andreas Gustafssondns_view_load(dns_view_t *view, isc_boolean_t stop);
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafssonisc_result_t
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafssondns_view_loadnew(dns_view_t *view, isc_boolean_t stop);
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntisc_result_t
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntdns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson * Load zones attached to this view. dns_view_load() loads
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson * all zones whose master file has changed since the last
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews * load; dns_view_loadnew() loads only zones that have never
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson * been loaded.
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson *
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt * dns_view_asyncload() loads zones asynchronously. When all zones
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt * in the view have finished loading, 'callback' is called with argument
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt * 'arg' to inform the caller.
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt *
9dafd058e3cfdd8218247811cea792588ec19052Andreas Gustafsson * If 'stop' is ISC_TRUE, stop on the first error and return it.
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt * If 'stop' is ISC_FALSE (or we are loading asynchronously), ignore errors.
0358d65e0709c6e34876ec45f914d6e4f38ec241Mark Andrews *
0358d65e0709c6e34876ec45f914d6e4f38ec241Mark Andrews * Requires:
0358d65e0709c6e34876ec45f914d6e4f38ec241Mark Andrews *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
0358d65e0709c6e34876ec45f914d6e4f38ec241Mark Andrews */
0b16ae54f714bed65d749e3f601a29246cd98672Mark Andrews
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafssonisc_result_t
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafssondns_view_gettsig(dns_view_t *view, dns_name_t *keyname,
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson dns_tsigkey_t **keyp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * Find the TSIG key configured in 'view' with name 'keyname',
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * if any.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson *
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li keyp points to a NULL dns_tsigkey_t *.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson *
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS A key was found and '*keyp' now points to it.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOTFOUND No key was found.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li others An error occurred.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson */
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafssonisc_result_t
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafssondns_view_getpeertsig(dns_view_t *view, isc_netaddr_t *peeraddr,
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson dns_tsigkey_t **keyp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * Find the TSIG key configured in 'view' for the server whose
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * address is 'peeraddr', if any.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson *
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont * Requires:
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * keyp points to a NULL dns_tsigkey_t *.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson *
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS A key was found and '*keyp' now points to it.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOTFOUND No key was found.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li others An error occurred.
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson */
e1368a7770744cbeadcdc27967f855196988eceaAndreas Gustafsson
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellingtonisc_result_t
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellingtondns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Verifies the signature of a message.
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Requires:
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is a valid view.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'source' is a valid buffer containing the message
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'msg' is a valid message
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington *
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li see dns_tsig_verify()
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington */
b984520acca2532d048eae929dc0682dd334c7a3Brian Wellington
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsvoid
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsdns_view_dialup(dns_view_t *view);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
bfb0e358c8d7f73afa7f31efb55fdabdddce3a10Andreas Gustafsson * Perform dialup-time maintenance on the zones of 'view'.
bfb0e358c8d7f73afa7f31efb55fdabdddce3a10Andreas Gustafsson */
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellingtonisc_result_t
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafssondns_view_dumpdbtostream(dns_view_t *view, FILE *fp);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * Dump the current state of the view 'view' to the stream 'fp'
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * for purposes of analysis or debugging.
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson *
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * Currently the dumped state includes the view's cache; in the future
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * it may also include other state such as the address database.
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * It will not not include authoritative data since it is voluminous and
113b8ef9731a0c4fb47f3ad41cb9d07d97e022a8Andreas Gustafsson * easily obtainable by other means.
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington *
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington * Requires:
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington *
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'fp' refers to a file open for writing.
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington *
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li ISC_R_SUCCESS The cache was successfully dumped.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \li others An error occurred (see dns_master_dump)
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington */
eb8713ed947fdf22a41dad673d561896dd6fe4a2Brian Wellington
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellingtonisc_result_t
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellingtondns_view_flushcache(dns_view_t *view);
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉isc_result_t
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉dns_view_flushcache2(dns_view_t *view, isc_boolean_t fixuponly);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * Flush the view's cache (and ADB). If 'fixuponly' is true, it only updates
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * the internal reference to the cache DB with omitting actual flush operation.
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * 'fixuponly' is intended to be used for a view that shares a cache with
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * a different view. dns_view_flushcache() is a backward compatible version
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * that always sets fixuponly to false.
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington *
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington * Requires:
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington * 'view' is valid.
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington *
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington * No other tasks are executing.
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington *
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOMEMORY
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington */
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrewsisc_result_t
9d4ec6d2c59bd5845ac8bca5a5d790be9a772862Evan Huntdns_view_flushnode(dns_view_t *view, dns_name_t *name, isc_boolean_t tree);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * Flush the given name from the view's cache (and optionally ADB/badcache).
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *
9d4ec6d2c59bd5845ac8bca5a5d790be9a772862Evan Hunt * Flush the given name from the cache, ADB, and bad cache. If 'tree'
9d4ec6d2c59bd5845ac8bca5a5d790be9a772862Evan Hunt * is true, also flush all subdomains of 'name'.
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * Requires:
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *\li 'view' is valid.
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *\li 'name' is valid.
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * Returns:
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *\li #ISC_R_SUCCESS
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * other returns are failures.
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt */
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt
01279934803dd45c007a58b61fe20c2852135b52Evan Huntisc_result_t
01279934803dd45c007a58b61fe20c2852135b52Evan Huntdns_view_flushname(dns_view_t *view, dns_name_t *name);
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt/*%<
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * Flush the given name from the view's cache, ADB and badcache.
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt * Equivalent to dns_view_flushnode(view, name, ISC_FALSE).
01279934803dd45c007a58b61fe20c2852135b52Evan Hunt *
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews *
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid.
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews *
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews * other returns are failures.
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews */
60213f2815a7e6584a2285546d05633fa7b6f5b4Mark Andrews
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrewsisc_result_t
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrewsdns_view_adddelegationonly(dns_view_t *view, dns_name_t *name);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews * Add the given name to the delegation only table.
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews *
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid.
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews *
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOMEMORY
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews */
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsisc_result_t
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsdns_view_excludedelegationonly(dns_view_t *view, dns_name_t *name);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Add the given name to be excluded from the root-delegation-only.
db30f4bdcb66afb7eb1ab0c6882cc70be9a53d79Mark Andrews *
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews *
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid.
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews *
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews * Returns:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_SUCCESS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li #ISC_R_NOMEMORY
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews */
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrewsisc_boolean_t
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrewsdns_view_isdelegationonly(dns_view_t *view, dns_name_t *name);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Check if 'name' is in the delegation only table or if
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * rootdelonly is set that name is not being excluded.
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews *
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'name' is valid.
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews *
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews * Returns:
3fb1637c9265cc593973326ae193783413f68699Tatuya JINMEI 神明達哉 *\li #ISC_TRUE if the name is the table.
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont *\li #ISC_FALSE otherwise.
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews */
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsvoid
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsdns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Set the root delegation only flag.
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews *
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews */
4607e7a9b8dfb1b41c70e51c2b603daaf22cf302Mark Andrews
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsisc_boolean_t
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrewsdns_view_getrootdelonly(dns_view_t *view);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*%<
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Get the root delegation only flag.
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews *
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews * Requires:
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein *\li 'view' is valid.
0b1da8124c817270f5dfe46cd0211b993c931a91Mark Andrews */
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrewsisc_result_t
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrewsdns_view_freezezones(dns_view_t *view, isc_boolean_t freeze);
fb827ed6df9a473770fb69a75a455b4ad0d14f52Mark Andrews/*%<
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrews * Freeze/thaw updates to master zones.
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrews *
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrews * Requires:
fb827ed6df9a473770fb69a75a455b4ad0d14f52Mark Andrews * \li 'view' is valid.
7502c6600645f120434d84d0ce3df7c3585cfe43Mark Andrews */
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Huntvoid
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Huntdns_view_setadbstats(dns_view_t *view, isc_stats_t *stats);
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt/*%<
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * Set a adb statistics set 'stats' for 'view'.
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * Requires:
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * \li 'view' is valid and is not frozen.
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *\li stats is a valid statistics supporting adb statistics
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * (see dns/stats.h).
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt */
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Huntvoid
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Huntdns_view_getadbstats(dns_view_t *view, isc_stats_t **statsp);
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt/*%<
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * Get the adb statistics counter set for 'view'. If a statistics set is
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * set '*statsp' will be attached to the set; otherwise, '*statsp' will be
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * untouched.
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * Requires:
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt * \li 'view' is valid and is not frozen.
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt *\li 'statsp' != NULL && '*statsp' != NULL
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt */
dd2a0a6d2dec1c23787351e51b434a838dec5603Evan Hunt
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsvoid
d9059b0c38bd630c367d81424d72b1308cd74b04Tatuya JINMEI 神明達哉dns_view_setresstats(dns_view_t *view, isc_stats_t *stats);
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews/*%<
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Set a general resolver statistics counter set 'stats' for 'view'.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Requires:
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * \li 'view' is valid and is not frozen.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *\li stats is a valid statistics supporting resolver statistics counters
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * (see dns/stats.h).
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews */
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsvoid
d9059b0c38bd630c367d81424d72b1308cd74b04Tatuya JINMEI 神明達哉dns_view_getresstats(dns_view_t *view, isc_stats_t **statsp);
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews/*%<
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Get the general statistics counter set for 'view'. If a statistics set is
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * set '*statsp' will be attached to the set; otherwise, '*statsp' will be
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * untouched.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Requires:
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * \li 'view' is valid and is not frozen.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
ddad35552931651426ad70912d29d9ab7d2a8d80Automatic Updater *\li 'statsp' != NULL && '*statsp' != NULL
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews */
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsvoid
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsdns_view_setresquerystats(dns_view_t *view, dns_stats_t *stats);
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews/*%<
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Set a statistics counter set of rdata type, 'stats', for 'view'. Once the
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * statistic set is installed, view's resolver will count outgoing queries
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * per rdata type.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Requires:
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * \li 'view' is valid and is not frozen.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *\li stats is a valid statistics created by dns_rdatatypestats_create().
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews */
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsvoid
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrewsdns_view_getresquerystats(dns_view_t *view, dns_stats_t **statsp);
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews/*%<
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Get the rdatatype statistics counter set for 'view'. If a statistics set is
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * set '*statsp' will be attached to the set; otherwise, '*statsp' will be
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * untouched.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * Requires:
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews * \li 'view' is valid and is not frozen.
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews *
ddad35552931651426ad70912d29d9ab7d2a8d80Automatic Updater *\li 'statsp' != NULL && '*statsp' != NULL
8907d8fa04fdaa65baf0bc6b01230b2ebde93106Mark Andrews */
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉isc_boolean_t
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉dns_view_iscacheshared(dns_view_t *view);
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉/*%<
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * Check if the view shares the cache created by another view.
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 *
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * Requires:
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * \li 'view' is valid.
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 *
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 * Returns:
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 *\li #ISC_TRUE if the cache is shared.
7d6d9c22404af9e81614e0a143f8bab65a97e8d4Francis Dupont *\li #ISC_FALSE otherwise.
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉 */
7781f25078c491a9650dec555bdc86cb0ed49861Tatuya JINMEI 神明達哉
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntisc_result_t
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Huntdns_view_initntatable(dns_view_t *view,
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr);
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt/*%<
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Initialize the negative trust anchor table for the view.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Requires:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * \li 'view' is valid.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Returns:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li ISC_R_SUCCESS
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li Any other result indicates failure
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt */
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntisc_result_t
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntdns_view_getntatable(dns_view_t *view, dns_ntatable_t **ntp);
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt/*%<
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Get the negative trust anchor table for this view. Returns
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * ISC_R_NOTFOUND if the table not been initialized for the view.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * '*ntp' is attached on success; the caller is responsible for
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * detaching it with dns_ntatable_detach().
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Requires:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * \li 'view' is valid.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * \li 'nta' is not NULL and '*nta' is NULL.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Returns:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li ISC_R_SUCCESS
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li ISC_R_NOTFOUND
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt */
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntisc_result_t
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntdns_view_initsecroots(dns_view_t *view, isc_mem_t *mctx);
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt/*%<
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Initialize security roots for the view, detaching any previously
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * existing security roots first. (Note that secroots_priv is
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * NULL until this function is called, so any function using
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * security roots must check that they have been initialized first.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * One way to do this is use dns_view_getsecroots() and check its
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * return value.)
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Requires:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * \li 'view' is valid.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Returns:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li ISC_R_SUCCESS
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li Any other result indicates failure
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt */
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntisc_result_t
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntdns_view_getsecroots(dns_view_t *view, dns_keytable_t **ktp);
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt/*%<
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Get the security roots for this view. Returns ISC_R_NOTFOUND if
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * the security roots keytable has not been initialized for the view.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * '*ktp' is attached on success; the caller is responsible for
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * detaching it with dns_keytable_detach().
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Requires:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * \li 'view' is valid.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * \li 'ktp' is not NULL and '*ktp' is NULL.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Returns:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li ISC_R_SUCCESS
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li ISC_R_NOTFOUND
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt */
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntisc_result_t
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Huntdns_view_issecuredomain(dns_view_t *view, dns_name_t *name,
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt isc_stdtime_t now, isc_boolean_t checknta,
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt isc_boolean_t *secure_domain);
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt/*%<
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Is 'name' at or beneath a trusted key, and not covered by a valid
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * negative trust anchor? Put answer in '*secure_domain'.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt * If 'checknta' is ISC_FALSE, ignore the NTA table in determining
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt * whether this is a secure domain.
b8a9632333a92d73a503afe1aaa7990016c8bee9Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Requires:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * \li 'view' is valid.
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt * Returns:
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li ISC_R_SUCCESS
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt *\li Any other value indicates failure
95f2377b4f180a564d35343c8d150e8f03c98a52Evan Hunt */
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntisc_boolean_t
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntdns_view_ntacovers(dns_view_t *view, isc_stdtime_t now,
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt dns_name_t *name, dns_name_t *anchor);
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt/*%<
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Is there a current negative trust anchor above 'name' and below 'anchor'?
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Requires:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * \li 'view' is valid.
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt * Returns:
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li ISC_R_TRUE
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt *\li ISC_R_FALSE
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt */
0cfb24736841b3e98bb25853229a0efabab88bddEvan Hunt
515c7f3c43f76d7b439905b18009105364b36100Automatic Updatervoid
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrewsdns_view_untrust(dns_view_t *view, dns_name_t *keyname,
515c7f3c43f76d7b439905b18009105364b36100Automatic Updater dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx);
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews/*%<
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * Remove keys that match 'keyname' and 'dnskey' from the views trust
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * anchors.
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews *
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt * (NOTE: If the configuration specifies that there should be a
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt * trust anchor at 'keyname', but no keys are left after this
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt * operation, that is an error. We fail closed, inserting a NULL
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt * key so as to prevent validation until a legimitate key has been
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt * provided.)
132a57117978816eebf6f8c33b39bdcfcd62fd7aEvan Hunt *
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * Requires:
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * \li 'view' is valid.
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * \li 'keyname' is valid.
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * \li 'mctx' is valid.
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews * \li 'dnskey' is valid.
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews */
44f175a90a855326725439b2f1178f0dcca8f67dMark Andrews
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntisc_result_t
cfd262045c23cadb8415f0111f56995258f17361Evan Huntdns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
3b38e4b8344cb3bb28f2b116d2e39f8371ef8e34Mukund Sivaraman void (*cfg_destroy)(void **), isc_uint64_t mapsize);
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt/*%<
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * Set whether or not to allow zones to be created or deleted at runtime.
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt *
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * If 'allow' is ISC_TRUE, determines the filename into which new zone
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * configuration will be written. Preserves the configuration context
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * (a pointer to which is passed in 'cfgctx') for use when parsing new
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * zone configuration. 'cfg_destroy' points to a callback routine to
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * destroy the configuration context when the view is destroyed. (This
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * roundabout method is used in order to avoid libdns having a dependency
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * on libisccfg and libbind9.)
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt *
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * If 'allow' is ISC_FALSE, removes any existing references to
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * configuration context and frees any memory.
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt *
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * Requires:
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt * \li 'view' is valid.
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt *
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt * Returns:
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt * \li ISC_R_SUCCESS
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt * \li ISC_R_NOSPACE
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt */
cfd262045c23cadb8415f0111f56995258f17361Evan Hunt
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsvoid
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrewsdns_view_restorekeyring(dns_view_t *view);
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews
abff0f462a758383d012887d3a97da4dac0c5a94Evan Huntisc_result_t
abff0f462a758383d012887d3a97da4dac0c5a94Evan Huntdns_view_searchdlz(dns_view_t *view, dns_name_t *name,
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt unsigned int minlabels,
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt dns_clientinfomethods_t *methods,
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt dns_clientinfo_t *clientinfo,
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt dns_db_t **dbp);
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt/*%<
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * Search through the DLZ database(s) in view->dlz_searched to find
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * one that can answer a query for 'name', using the DLZ driver's
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * findzone method. If successful, '*dbp' is set to point to the
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * DLZ database.
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt *
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * Returns:
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * \li ISC_R_SUCCESS
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * \li ISC_R_NOTFOUND
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt *
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * Requires:
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * \li 'view' is valid.
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * \li 'name' is not NULL.
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt * \li 'dbp' is not NULL and *dbp is NULL.
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt */
abff0f462a758383d012887d3a97da4dac0c5a94Evan Hunt
a8783019814daa36dd57afe3f527462822834c3bEvan Huntisc_uint32_t
a8783019814daa36dd57afe3f527462822834c3bEvan Huntdns_view_getfailttl(dns_view_t *view);
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt/*%<
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt * Get the view's servfail-ttl. zero => no servfail caching.
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt *
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt * Requires:
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt *\li 'view' to be valid.
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt */
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt
a8783019814daa36dd57afe3f527462822834c3bEvan Huntvoid
a8783019814daa36dd57afe3f527462822834c3bEvan Huntdns_view_setfailttl(dns_view_t *view, isc_uint32_t failttl);
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt/*%<
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt * Set the view's servfail-ttl. zero => no servfail caching.
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt *
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt * Requires:
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt *\li 'view' to be valid.
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt */
a8783019814daa36dd57afe3f527462822834c3bEvan Hunt
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaramanisc_result_t
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaramandns_view_saventa(dns_view_t *view);
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman/*%<
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman * Save NTA for names in this view to a file.
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman *
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman * Requires:
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman *\li 'view' to be valid.
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman */
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaramanisc_result_t
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaramandns_view_loadnta(dns_view_t *view);
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman/*%<
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman * Loads NTA for names in this view from a file.
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman *
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman * Requires:
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman *\li 'view' to be valid.
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman */
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaraman
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrewsvoid
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrewsdns_view_setviewcommit(dns_view_t *view);
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews/*%<
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * Commit dns_zone_setview() calls previously made for all zones in this
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * view.
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews *
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * Requires:
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews *\li 'view' to be valid.
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews */
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrewsvoid
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrewsdns_view_setviewrevert(dns_view_t *view);
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews/*%<
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * Revert dns_zone_setview() calls previously made for all zones in this
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * view.
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews *
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews * Requires:
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews *\li 'view' to be valid.
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews */
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews
2732d4922c2e72a399204320791acfd2fd3d6c7cMark Andrews
4f3a3fc43c6e2de62997d2378e87b4248cf771aeMark AndrewsISC_LANG_ENDDECLS
4f3a3fc43c6e2de62997d2378e87b4248cf771aeMark Andrews
f94f59d746daffc38356d0a019b64eb01d2341c0Bob Halley#endif /* DNS_VIEW_H */