Commit 07f3bb06 authored by Jan Včelák's avatar Jan Včelák 🚀

Move zone loading into separate module

- created knot/server/zone-load.{h,c}
- some API calls exposed from knot/server/zones.h

ref #255
parent 7456267a
......@@ -232,13 +232,6 @@ libknots_la_SOURCES = \
common/strtonum.h
libknotd_la_SOURCES = \
knot/stat/gatherer.c \
knot/stat/stat.c \
knot/stat/gatherer.h \
knot/stat/stat.h \
knot/stat/stat-common.h \
knot/knot.h \
knot/other/debug.h \
knot/conf/cf-lex.l \
knot/conf/cf-parse.y \
knot/conf/conf.c \
......@@ -253,35 +246,43 @@ libknotd_la_SOURCES = \
knot/ctl/process.h \
knot/ctl/remote.c \
knot/ctl/remote.h \
knot/knot.h \
knot/other/debug.h \
knot/server/dthreads.c \
knot/server/dthreads.h \
knot/server/journal.c \
knot/server/socket.c \
knot/server/journal.h \
knot/server/notify.c \
knot/server/notify.h \
knot/server/rrl.c \
knot/server/rrl.h \
knot/server/server.c \
knot/server/udp-handler.c \
knot/server/tcp-handler.c \
knot/server/xfr-handler.c \
knot/server/zones.c \
knot/server/server.h \
knot/server/socket.c \
knot/server/socket.h \
knot/server/udp-handler.h \
knot/server/tcp-handler.c \
knot/server/tcp-handler.h \
knot/server/udp-handler.c \
knot/server/udp-handler.h \
knot/server/xfr-handler.c \
knot/server/xfr-handler.h \
knot/server/dthreads.h \
knot/server/journal.h \
knot/server/zones.h \
knot/server/notify.h \
knot/server/notify.c \
knot/server/zone-load.c \
knot/server/zone-load.h \
knot/server/zones.c \
knot/server/zones.h \
knot/server/rrl.h \
knot/server/rrl.c \
knot/stat/gatherer.c \
knot/stat/gatherer.h \
knot/stat/stat-common.h \
knot/stat/stat.c \
knot/stat/stat.h \
knot/zone/estimator.c \
knot/zone/estimator.h \
knot/zone/semantic-check.c \
knot/zone/semantic-check.h \
knot/zone/zone-dump.h \
knot/zone/zone-dump.c \
knot/zone/zone-load.h \
knot/zone/zone-dump.h \
knot/zone/zone-load.c \
knot/zone/estimator.h \
knot/zone/estimator.c \
knot/server/server.h
knot/zone/zone-load.h
libknotd_la_LIBADD = libknot.la libknots.la @LIBOBJS@
libknots_la_LIBADD = zscanner/libzscanner.la @LIBOBJS@
......
This diff is collapsed.
/* Copyright (C) 2013 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file zone-load.h
*
* Zone loading functions
*
* \addtogroup server
* @{
*/
#ifndef _KNOTD_ZONE_LOAD_H_
#define _KNOTD_ZONE_LOAD_H_
#include "knot/conf/conf.h"
#include "libknot/nameserver/name-server.h"
#include "libknot/zone/zonedb.h"
/*!
* \brief Update zone database according to configuration.
*
* Creates a new database, copies references those zones from the old database
* which are still in the configuration, loads any new zones required and
* replaces the database inside the namserver.
*
* It also creates a list of deprecated zones that should be deleted once the
* function finishes.
*
* This function uses RCU mechanism to guard the access to the config and
* nameserver and to publish the new database in the nameserver.
*
* \param[in] conf Configuration.
* \param[in] ns Nameserver which holds the zone database.
* \param[out] db_old Old database, containing only zones which should be
* deleted afterwards.
*
* \retval KNOT_EOK
* \retval KNOT_EINVAL
* \retval KNOT_ERROR
*/
int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
knot_zonedb_t **db_old);
#endif // _KNOTD_ZONE_LOAD_H_
/*! @} */
This diff is collapsed.
......@@ -92,31 +92,6 @@ typedef struct zonedata_t
uint32_t zonefile_serial;
} zonedata_t;
/*!
* \brief Update zone database according to configuration.
*
* Creates a new database, copies references those zones from the old database
* which are still in the configuration, loads any new zones required and
* replaces the database inside the namserver.
*
* It also creates a list of deprecated zones that should be deleted once the
* function finishes.
*
* This function uses RCU mechanism to guard the access to the config and
* nameserver and to publish the new database in the nameserver.
*
* \param[in] conf Configuration.
* \param[in] ns Nameserver which holds the zone database.
* \param[out] db_old Old database, containing only zones which should be
* deleted afterwards.
*
* \retval KNOT_EOK
* \retval KNOT_EINVAL
* \retval KNOT_ERROR
*/
int zones_update_db_from_config(const conf_t *conf, knot_nameserver_t *ns,
knot_zonedb_t **db_old);
/*!
* \brief Sync zone data back to text zonefile.
*
......@@ -327,7 +302,6 @@ int zones_schedule_refresh(knot_zone_t *zone, int64_t time);
*/
int zones_schedule_notify(knot_zone_t *zone);
/*!
* \brief Cancel DNSSEC event.
*
......@@ -347,6 +321,14 @@ int zones_cancel_dnssec(knot_zone_t *zone);
*/
int zones_schedule_dnssec(knot_zone_t *zone, int64_t time, bool force);
/*!
* \brief Schedule IXFR sync for given zone.
*
* \param zone Zone to scheduler IXFR sync for.
* \param dbsync_timeout Sync time in seconds.
*/
void zones_schedule_ixfr_sync(knot_zone_t *zone, int dbsync_timeout);
/*!
* \brief Processes forwarded UPDATE response packet.
* \todo #1291 move to appropriate section (DDNS).
......@@ -369,6 +351,32 @@ int zones_verify_tsig_query(const knot_packet_t *query,
knot_rcode_t *rcode, uint16_t *tsig_rcode,
uint64_t *tsig_prev_time_signed);
/*!
* \brief Apply changesets to zone from journal.
*
* \param zone Specified zone.
*
* \retval KNOT_EOK if successful.
* \retval KNOT_EINVAL on invalid parameters.
* \retval KNOT_ENOENT if zone has no contents.
* \retval KNOT_ERROR on unspecified error.
*/
int zones_journal_apply(knot_zone_t *zone);
/*!
* \brief Creates diff and DNSSEC changesets and stores them to journal.
*
* \param z Zone configuration.
* \param zone Zone to sign.
* \param ns Name server structure.
* \param zone_changed The zone was loaded or modified.
*
* \return Error code, KNOT_OK if successful.
*/
int zones_do_diff_and_sign(const conf_zone_t *z, knot_zone_t *zone,
const knot_nameserver_t *ns, bool zone_changed);
#endif // _KNOTD_ZONES_H_
/*! @} */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment