2023-01-23 09:49:20 -08:00
|
|
|
// Copyright (C) 2019-2023 Internet Systems Consortium, Inc. ("ISC")
|
2019-03-06 09:10:19 +01:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
#ifndef BASE_NETWORK_PARSER_H
|
|
|
|
#define BASE_NETWORK_PARSER_H
|
|
|
|
|
|
|
|
#include <cc/data.h>
|
|
|
|
#include <cc/simple_parser.h>
|
2021-11-26 15:31:35 +01:00
|
|
|
#include <dhcpsrv/cfg_globals.h>
|
2019-03-06 09:10:19 +01:00
|
|
|
#include <dhcpsrv/network.h>
|
|
|
|
|
|
|
|
namespace isc {
|
|
|
|
namespace dhcp {
|
|
|
|
|
|
|
|
/// @brief Common configuration parser for shared networks
|
|
|
|
/// and subnets.
|
|
|
|
class BaseNetworkParser : public data::SimpleParser {
|
2020-11-11 19:06:06 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/// @brief Moves deprecated reservation-mode parameter to
|
|
|
|
/// new reservations flags.
|
|
|
|
///
|
|
|
|
/// @param config [in/out] configuration to alter.
|
|
|
|
/// @throw DhcpConfigError on error e.g. when both reservation-mode
|
|
|
|
/// and a flag are specified.
|
2020-11-17 15:26:10 +02:00
|
|
|
static void moveReservationMode(isc::data::ElementPtr config);
|
2020-11-11 19:06:06 +02:00
|
|
|
|
2021-11-26 15:31:35 +01:00
|
|
|
/// @brief Moves deprecated reservation-mode parameter to
|
|
|
|
/// new reservations flags.
|
|
|
|
///
|
|
|
|
/// @param config [in/out] global parameters to alter.
|
|
|
|
/// @throw DhcpConfigError on error e.g. when both reservation-mode
|
|
|
|
/// and a flag are specified.
|
|
|
|
static void moveReservationMode(CfgGlobalsPtr config);
|
|
|
|
|
2019-03-06 09:10:19 +01:00
|
|
|
protected:
|
|
|
|
|
2020-03-31 16:17:43 -04:00
|
|
|
/// @brief Parses common parameters
|
2019-03-06 09:10:19 +01:00
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - renew-timer,
|
|
|
|
/// - rebind-timer,
|
2020-04-02 22:02:38 +02:00
|
|
|
/// - valid-lifetime,
|
2020-03-31 16:17:43 -04:00
|
|
|
/// - store-extended-info
|
2020-11-11 19:06:06 +02:00
|
|
|
/// - reservations-global
|
|
|
|
/// - reservations-in-subnet
|
|
|
|
/// - reservations-out-of-pool
|
2019-03-06 09:10:19 +01:00
|
|
|
///
|
2019-05-24 15:30:29 -04:00
|
|
|
/// @param network_data Data element holding shared network
|
2019-03-06 09:10:19 +01:00
|
|
|
/// configuration to be parsed.
|
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
2020-03-31 16:17:43 -04:00
|
|
|
void parseCommon(const data::ConstElementPtr& network_data,
|
|
|
|
NetworkPtr& network);
|
2019-03-06 09:10:19 +01:00
|
|
|
|
2020-09-25 16:48:15 +02:00
|
|
|
/// @brief Parses parameters related to "percent" timers settings.
|
2019-03-06 09:10:19 +01:00
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - calculate-tee-times,
|
|
|
|
/// - t1-percent,
|
|
|
|
/// - t2-percent.
|
|
|
|
///
|
2020-09-25 16:48:15 +02:00
|
|
|
/// @param network_data Data element holding network configuration
|
|
|
|
/// to be parsed.
|
2019-03-06 09:10:19 +01:00
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
|
|
|
///
|
|
|
|
/// @throw DhcpConfigError if configuration of these parameters is
|
|
|
|
/// invalid.
|
2019-03-06 16:44:29 +01:00
|
|
|
void parseTeePercents(const data::ConstElementPtr& network_data,
|
2019-03-06 09:10:19 +01:00
|
|
|
NetworkPtr& network);
|
2019-04-12 11:27:49 +02:00
|
|
|
|
2020-09-25 16:48:15 +02:00
|
|
|
/// @brief Parses parameters related to lease cache settings.
|
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - cache-threshold,
|
2020-10-02 17:10:31 +02:00
|
|
|
/// - cache-max-age.
|
2020-09-25 16:48:15 +02:00
|
|
|
///
|
|
|
|
/// @param network_data Data element holding network configuration
|
|
|
|
/// to be parsed.
|
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
|
|
|
///
|
|
|
|
/// @throw DhcpConfigError if configuration of these parameters is
|
|
|
|
/// invalid.
|
|
|
|
void parseCacheParams(const data::ConstElementPtr& network_data,
|
2022-11-21 17:30:31 +01:00
|
|
|
NetworkPtr& network);
|
2020-09-25 16:48:15 +02:00
|
|
|
|
2019-09-26 08:33:41 -04:00
|
|
|
/// @brief Parses parameters pertaining to DDNS behavior.
|
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - ddns-send-updates
|
|
|
|
/// - ddns-override-no-update
|
|
|
|
/// - ddns-override-client-update
|
|
|
|
/// - ddns-replace-client-name
|
|
|
|
/// - ddns-generated-prefix
|
|
|
|
/// - ddns-qualifying-suffix
|
|
|
|
///
|
|
|
|
/// @param network_data Data element holding shared network
|
|
|
|
/// configuration to be parsed.
|
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
|
|
|
void parseDdnsParams(const data::ConstElementPtr& network_data,
|
|
|
|
NetworkPtr& network);
|
2022-11-21 17:30:31 +01:00
|
|
|
|
|
|
|
/// @brief Parses parameters pertaining to allocator selection.
|
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - allocator
|
|
|
|
///
|
|
|
|
/// @param network_data Data element holding shared network
|
|
|
|
/// configuration to be parsed.
|
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
|
|
|
void parseAllocatorParams(const data::ConstElementPtr& network_data,
|
|
|
|
NetworkPtr& network);
|
|
|
|
|
|
|
|
/// @brief Parses parameters pertaining to prefix delegation allocator
|
|
|
|
/// selection.
|
|
|
|
///
|
|
|
|
/// The parsed parameters are:
|
|
|
|
/// - pd-allocator
|
|
|
|
///
|
|
|
|
/// @param network_data Data element holding shared network
|
|
|
|
/// configuration to be parsed.
|
|
|
|
/// @param [out] network Pointer to a network in which parsed data is
|
|
|
|
/// to be stored.
|
|
|
|
void parsePdAllocatorParams(const data::ConstElementPtr& network_data,
|
|
|
|
Network6Ptr& network);
|
2019-03-06 09:10:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace isc::dhcp
|
|
|
|
} // end of namespace isc
|
|
|
|
|
|
|
|
#endif
|