12#include <boost/pointer_cast.hpp>
27 args->set(
"max-period",
Element::create(
static_cast<long int>(max_period)));
30 insertService(command, server_type);
37 insertService(command, server_type);
44 insertService(command, server_type);
51 insertLeaseExpireTime(lease_as_json);
61 insertLeaseExpireTime(lease_as_json);
76 const uint32_t limit) {
90 args->set(
"from", from_element);
91 args->set(
"limit", limit_element);
102 insertLeaseExpireTime(lease_as_json);
112 insertLeaseExpireTime(lease_as_json);
127 const uint32_t limit) {
141 args->set(
"from", from_element);
142 args->set(
"limit", limit_element);
151CommandCreator::insertLeaseExpireTime(
ElementPtr& lease) {
153 (!lease->contains(
"cltt") || (lease->get(
"cltt")->getType() !=
Element::integer) ||
154 (!lease->contains(
"valid-lft") ||
159 int64_t cltt = lease->get(
"cltt")->intValue();
160 int64_t valid_lifetime = lease->get(
"valid-lft")->intValue();
161 int64_t expire = cltt + valid_lifetime;
163 lease->remove(
"cltt");
178 (boost::const_pointer_cast<Element>(command))->set(
"service", service);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown when an unexpected error condition occurs.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
static data::ConstElementPtr createLease4Delete(const dhcp::Lease4 &lease4)
Creates lease4-del command.
static data::ConstElementPtr createHeartbeat(const HAServerType &server_type)
Creates ha-heartbeat command for DHCP server.
static data::ConstElementPtr createLease4Update(const dhcp::Lease4 &lease4)
Creates lease4-update command.
static data::ConstElementPtr createDHCPDisable(const unsigned int max_period, const HAServerType &server_type)
Creates dhcp-disable command for DHCP server.
static data::ConstElementPtr createLease6Update(const dhcp::Lease6 &lease6)
Creates lease6-update command.
static data::ConstElementPtr createLease6Delete(const dhcp::Lease6 &lease6)
Creates lease6-del command.
static data::ConstElementPtr createLease4GetAll()
Creates lease4-get-all command.
static data::ConstElementPtr createLease6GetPage(const dhcp::Lease6Ptr &lease6, const uint32_t limit)
Creates lease6-get-page command.
static data::ConstElementPtr createDHCPEnable(const HAServerType &server_type)
Creates dhcp-enable command for DHCP server.
static data::ConstElementPtr createLease6GetAll()
Creates lease6-get-all command.
static data::ConstElementPtr createLease4GetPage(const dhcp::Lease4Ptr &lease4, const uint32_t limit)
Creates lease4-get-page command.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" })
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
HAServerType
Lists possible server types for which HA service is created.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Structure that holds a lease for IPv4 address.
virtual isc::data::ElementPtr toElement() const
Return the JSON representation of a lease.
Structure that holds a lease for IPv6 address and/or prefix.
virtual isc::data::ElementPtr toElement() const
Return the JSON representation of a lease.