68 auto range = object_type_idx.equal_range(
"dhcp4_subnet");
69 if (std::distance(range.first, range.second)) {
89 int result =
impl->repopulateCache(cfg->getCfgSubnets4());
92 const string error(
"Errors were detected in the ddns tuning hooks library configuration.");
141 string calc_hostname =
impl->calculateHostname(query, subnet);
142 if (!calc_hostname.empty() && (calc_hostname != hostname)) {
148 if (label_count == 2) {
150 calc_hostname = d2_mgr.
qualifyName(calc_hostname, *ddns_params,
false);
156 .arg(query->getLabel());
161 }
catch (
const exception& ex) {
163 .arg(query->getLabel()).arg(ex.what());
168 if (query->inClass(
"SKIP_DDNS")) {
170 .arg(query->getLabel());
197 handle.
getArgument(
"audit_entries", audit_entries);
200 auto range = object_type_idx.equal_range(
"dhcp6_subnet");
201 if (std::distance(range.first, range.second)) {
221 int result =
impl->repopulateCache(cfg->getCfgSubnets6());
224 const string error(
"Errors were detected in the ddns tuning hooks library configuration.");
273 string calc_hostname =
impl->calculateHostname(query, subnet);
274 if (!calc_hostname.empty() && (calc_hostname != hostname)) {
280 if (label_count == 2) {
282 calc_hostname = d2_mgr.
qualifyName(calc_hostname, *ddns_params,
true);
288 .arg(query->getLabel());
293 }
catch (
const exception& ex) {
295 .arg(query->getLabel()).arg(ex.what());
300 if (query->inClass(
"SKIP_DDNS")) {
302 .arg(query->getLabel());
319 if (family == AF_INET) {
320 if (proc_name !=
"kea-dhcp4") {
322 <<
", expected kea-dhcp4");
325 if (proc_name !=
"kea-dhcp6") {
327 <<
", expected kea-dhcp6");
333 impl->configure(json);
334 }
catch (
const exception& ex) {
CalloutNextStep
Specifies allowed next steps.
@ NEXT_STEP_DROP
drop the packet
A generic exception that is thrown when an unexpected error condition occurs.
DDNS Tuning implementation.
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
D2ClientMgr isolates Kea from the details of being a D2 client.
std::string qualifyName(const std::string &partial_name, const DdnsParams &ddns_params, const bool trailing_dot) const
Adds a qualifying suffix to a given domain name.
static unsigned int getLabelCount(const std::string &text_name)
Return the number of labels in the Name.
Per-packet callout handle.
@ NEXT_STEP_DROP
drop the packet
CalloutNextStep getStatus() const
Returns the next processing step.
void setStatus(const CalloutNextStep next)
Sets the next processing step.
void getArgument(const std::string &name, T &value) const
Get argument.
void setArgument(const std::string &name, T value)
Set argument.
isc::data::ConstElementPtr getParameters()
Get configuration parameter common code.
static std::string getProcName()
returns the process name This value is used as when forming the default PID file name
This file contains several functions and constants that are used for handling commands and responses ...
int dhcp4_srv_configured(CalloutHandle &handle)
This callout is called at the "dhcp4_srv_configured" hook.
int ddns4_update(CalloutHandle &handle)
This callout is called at the "ddns4_update" hook.
int multi_threading_compatible()
This function is called to retrieve the multi-threading compatibility.
int unload()
This function is called when the library is unloaded.
int dhcp6_srv_configured(CalloutHandle &handle)
This callout is called at the "dhcp6_srv_configured" hook.
int ddns6_update(CalloutHandle &handle)
This callout is called at the "ddns6_update" hook.
int cb4_updated(CalloutHandle &handle)
This callout is called at the "cb4_updated" hook.
int cb6_updated(CalloutHandle &handle)
This callout is called at the "cb6_updated" hook.
int load(LibraryHandle &handle)
This function is called when the library is loaded.
const isc::log::MessageID DDNS_TUNING_LOAD_ERROR
const isc::log::MessageID DDNS_TUNING_UNLOAD
const isc::log::MessageID DDNS_TUNING4_CALCULATED_HOSTNAME
const isc::log::MessageID DDNS_TUNING6_SKIPPING_DDNS
const isc::log::MessageID DDNS_TUNING4_PROCESS_ERROR
const isc::log::MessageID DDNS_TUNING4_SKIPPING_DDNS
const isc::log::MessageID DDNS_TUNING6_PROCESS_ERROR
const isc::log::MessageID DDNS_TUNING_LOAD_OK
const isc::log::MessageID DDNS_TUNING6_CALCULATED_HOSTNAME
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< AuditEntryCollection > AuditEntryCollectionPtr
isc::log::Logger ddns_tuning_logger("ddns-tuning-hooks")
boost::shared_ptr< DdnsTuningImpl > DdnsTuningImplPtr
The type of shared pointers to DDNS Tuning implementations.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
Defines the logger used by the top-level component of kea-lfc.
Tag used to access index by object type.