26#include <boost/algorithm/string.hpp> 
   27#include <boost/foreach.hpp> 
  291    void validateHostForSubnet6(
SubnetID subnet_id,
 
  292                                const std::vector<IOAddress>& addresses);
 
 
  346    string txt = 
"(missing parameters)";
 
  347    bool force_global(
false);
 
  372        if (family_ == AF_INET) {
 
  375            force_global = checkHost4(host);
 
  377                host->setIPv4SubnetID(SUBNET_ID_GLOBAL);
 
  382            force_global = checkHost6(host);
 
  384                host->setIPv6SubnetID(SUBNET_ID_GLOBAL);
 
  398        if (family_ == AF_INET) {
 
  401            validateHostForSubnet4(host->getIPv4SubnetID(),
 
  402                                   host->getIPv4Reservation());
 
  411            std::vector<IOAddress> addresses;
 
  412            BOOST_FOREACH(
auto const& address, range) {
 
  413                addresses.push_back(address.second.getPrefix());
 
  418            validateHostForSubnet6(host->getIPv6SubnetID(), addresses);
 
  422    } 
catch (
const std::exception& ex) {
 
  432    string msg(
"Host added.");
 
  434        msg += 
" subnet-id not specified, assumed global (subnet-id 0).";
 
 
  454    if (params->contains(
"subnet-id") || (!addr && !type && !ident)) {
 
  456                                                       0, dhcp::SUBNET_ID_MAX);
 
  457        x.subnet_id = 
static_cast<SubnetID>(value);
 
  458        x.has_subnet_id = 
true;
 
  460        x.has_subnet_id = 
false;
 
  463    x.operation_target = getOperationTarget(params);
 
  467            isc_throw(BadValue, 
"'ip-address' is not a string.");
 
  470        x.addr = IOAddress(addr->stringValue());
 
  471        x.query_by_addr = 
true;
 
  472        if (!x.has_subnet_id) {
 
  473            isc_throw(BadValue, 
"missing parameter 'subnet-id', use " 
  474                      "'reservation-get-by-address' with 'ip-address' set to \"" 
  475                      << addr->stringValue() << 
"\" to get the list of " 
  476                      << 
"reservations with this address");
 
  486        isc_throw(BadValue, 
"No 'ip-address' provided" 
  487                  " and 'identifier-type' is either missing or not a string.");
 
  490        isc_throw(BadValue, 
"No 'ip-address' provided" 
  491                  " and 'identifier' is either missing or not a string.");
 
  499        if (x.ident.empty()) {
 
  506        isc_throw(BadValue, 
"Unable to parse 'identifier' value.");
 
  509    if (x.ident.empty()) {
 
  510        isc_throw(BadValue, 
"Unable to query for empty 'identifier'.");
 
  516    } 
catch (
const std::exception& ex) {
 
  517        isc_throw(BadValue, 
"Value of 'identifier-type' was not recognized.");
 
  520    x.query_by_addr = 
false;
 
  521    if (!x.has_subnet_id) {
 
  522        isc_throw(BadValue, 
"missing parameter 'subnet-id', use " 
  523                  "'reservation-get-by-id' with 'identifier-type' set to \"" 
  524                  << type->stringValue() << 
"\" and 'identifier' to \"" 
  525                  << ident->stringValue() << 
"\" to get the list of " 
  526                  << 
"reservations with this identifier");
 
  532HostCmdsImpl::validateHostForSubnet4(
SubnetID subnet_id, 
const IOAddress& address) {
 
  533    if (subnet_id != 0) {
 
  535        auto subnet = cfg->getBySubnetId(subnet_id);
 
  538                      "IPv4 subnet with ID of '" << subnet_id
 
  539                      << 
"' is not configured");
 
  543            && !subnet->inRange(address)) {
 
  545                      "specified reservation '" << address
 
  546                      << 
"' is not matching the IPv4 subnet prefix '" 
  547                      << subnet->toText() << 
"'");
 
  553HostCmdsImpl::validateHostForSubnet6(
SubnetID subnet_id,
 
  554                                     const std::vector<IOAddress>& addresses) {
 
  555    if (subnet_id != 0) {
 
  557        auto subnet = cfg->getBySubnetId(subnet_id);
 
  560                      "IPv6 subnet with ID of '" << subnet_id
 
  561                      << 
"' is not configured");
 
  564        for (
auto const& address : addresses) {
 
  565            if (!subnet->inRange(address)) {
 
  567                          "specified reservation '" << address
 
  568                          << 
"' is not matching the IPv6 subnet prefix '" 
  569                          << subnet->toText() << 
"'");
 
  577    if (host->getIPv4SubnetID() != SUBNET_ID_UNUSED) {
 
  580    const IOAddress& addr = host->getIPv4Reservation();
 
  587        for (
auto const& subnet : *subnets->getAll()) {
 
  588            if (!subnet->inRange(addr)) {
 
  591            if (subnet->clientSupported(ClientClasses())) {
 
  597            } 
else if (!guarded) {
 
  603        if (guarded && candidate) {
 
  606        if (!guarded && !candidate) {
 
  607            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  608                      << 
" The address '" << addr.
toText()
 
  609                      << 
"' belongs to no configured subnet.");
 
  612            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  613                      << 
" The address '" << addr.
toText()
 
  614                      << 
"' belongs to subnet '" << candidate->toText()
 
  615                      << 
"' id " << candidate->getID()
 
  616                      << (others ? 
" and others." : 
"."));
 
  618            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  619                      << 
" The address '" << addr.
toText()
 
  620                      << 
"' belongs to guarded subnet '" << guarded->toText()
 
  621                      << 
"' id " << guarded->getID()
 
  622                      << (others ? 
" and others." : 
"."));
 
  631    if (host->getIPv6SubnetID() != SUBNET_ID_UNUSED) {
 
  634    auto const& range = host->getIPv6Reservations();
 
  635    std::vector<IOAddress> addresses;
 
  636    bool has_prefixes = 
false;
 
  637    BOOST_FOREACH(
auto const& address, range) {
 
  639            addresses.push_back(address.second.getPrefix());
 
  644    if (!addresses.empty()) {
 
  650        for (
auto const& subnet : *subnets->getAll()) {
 
  651            bool in_range = 
true;
 
  652            for (
auto const& address : addresses) {
 
  653                if (!subnet->inRange(address)) {
 
  661            if (subnet->clientSupported(ClientClasses())) {
 
  667            } 
else if (!guarded) {
 
  673        if (guarded && candidate) {
 
  676        if (!guarded && !candidate) {
 
  677            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  678                      << 
" Reserved IPv6 addresses do not belong to a" 
  679                      << 
" common configured subnet.");
 
  682            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  683                      << 
" Reserved IPv6 addresses belong to subnet '" 
  684                      << candidate->toText() << 
"' id " << candidate->getID()
 
  685                      << (others ? 
" and others." : 
"."));
 
  687            isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  688                      << 
" Reserved IPv6 addresses belong to guarded subnet '" 
  689                      << guarded->toText() << 
"' id " << guarded->getID()
 
  690                      << (others ? 
" and others." : 
"."));
 
  692    } 
else if (has_prefixes) {
 
  693        isc_throw(isc::BadValue, 
"Mandatory 'subnet-id' parameter missing." 
  694                  << 
" Prefixes are not attached to subnets so no hint is" 
  703    string txt = 
"(missing parameters)";
 
  731            if (family_ == AF_INET) {
 
  741            if (family_ == AF_INET) {
 
  742                host_json = host->toElement4();
 
  743                subnet_id = host->getIPv4SubnetID();
 
  745                host_json = host->toElement6();
 
  746                subnet_id = host->getIPv6SubnetID();
 
  750    } 
catch (
const std::exception& ex) {
 
  763                                                "Host found.", host_json);
 
 
  774    string txt = 
"(missing parameters)";
 
  794            if (family_ == AF_INET) {
 
  799                validateHostForSubnet6(p.
subnet_id, std::vector<IOAddress>());
 
  803            if (family_ == AF_INET) {
 
  814        for (
auto const& host : hosts) {
 
  816                if (family_ == AF_INET) {
 
  817                    subnet_id = host->getIPv4SubnetID();
 
  819                    subnet_id = host->getIPv6SubnetID();
 
  822                if (subnet_id == SUBNET_ID_UNUSED) {
 
  827            if (family_ == AF_INET) {
 
  828                host_json = host->toElement4();
 
  830                host_json = host->toElement6();
 
  834            hosts_json->add(host_json);
 
  836    } 
catch (
const std::exception& ex) {
 
  848    msg << hosts_json->size()
 
  849        << 
" IPv" << (family_ == AF_INET ? 
"4" : 
"6")
 
  850        << 
" host(s) found.";
 
  852    result->set(
"hosts", hosts_json);
 
 
  865    string txt = 
"(missing parameters)";
 
  887            if (family_ == AF_INET) {
 
  897    } 
catch (
const std::exception& ex) {
 
 
  928                                                 0, dhcp::SUBNET_ID_MAX);
 
  929    x.subnet_id = 
static_cast<SubnetID>(tmp);
 
  930    x.has_subnet_id = 
true;
 
  932    x.operation_target = getOperationTarget(params);
 
  937HostCmdsImpl::Parameters
 
  946                                                 numeric_limits<uint32_t>::max());
 
  947    x.page_limit = 
static_cast<size_t>(tmp);
 
  950    if (params->contains(
"subnet-id")) {
 
  952                                             0, dhcp::SUBNET_ID_MAX);
 
  953        x.subnet_id = 
static_cast<SubnetID>(tmp);
 
  954        x.has_subnet_id = 
true;
 
  958    if (params->get(
"source-index")) {
 
  960        x.source_index = 
static_cast<size_t>(tmp);
 
  964    if (params->get(
"from")) {
 
  966        x.host_id = 
static_cast<uint64_t
>(tmp);
 
  977        isc_throw(BadValue, 
"Parameters missing or are not a map.");
 
  981    x.hostname = hostname;
 
  984    if (params->contains(
"subnet-id")) {
 
  986                                                     0, dhcp::SUBNET_ID_MAX);
 
  987        x.subnet_id = 
static_cast<SubnetID>(tmp);
 
  988        x.has_subnet_id = 
true;
 
  991    x.operation_target = getOperationTarget(params);
 
 1001        isc_throw(BadValue, 
"Parameters missing or are not a map.");
 
 1007        isc_throw(BadValue, 
"'identifier-type' is either missing" 
 1008                  " or not a string.");
 
 1011        isc_throw(BadValue, 
"'identifier' is either missing or not a string.");
 
 1015    if (params->contains(
"subnet-id")) {
 
 1016        isc_throw(BadValue, 
"'subnet-id' is forbidden in reservation-get-by-id");
 
 1024        if (x.ident.empty()) {
 
 1031        isc_throw(BadValue, 
"Unable to parse 'identifier' value.");
 
 1034    if (x.ident.empty()) {
 
 1035        isc_throw(BadValue, 
"Unable to query for empty 'identifier'.");
 
 1041    } 
catch (
const std::exception& ex) {
 
 1042        isc_throw(BadValue, 
"Value of 'identifier-type' was not recognized.");
 
 1055        isc_throw(BadValue, 
"Parameters missing or are not a map.");
 
 1062    if (!addr.
isV4() && !addr.
isV6()) {
 
 1063        isc_throw(BadValue, 
"Failed to parse IP address " << addr);
 
 1067    x.query_by_addr = 
true;
 
 1069    if (params->contains(
"subnet-id")) {
 
 1071                                                     0, dhcp::SUBNET_ID_MAX);
 
 1072        x.subnet_id = 
static_cast<SubnetID>(tmp);
 
 1073        x.has_subnet_id = 
true;
 
 1076    x.operation_target = getOperationTarget(params);
 
 1084    if (!args->get(
"operation-target")) {
 
 1085        return HostMgrOperationTarget::UNSPECIFIED_SOURCE;
 
 1090    if (raw == 
"memory") {
 
 1091        return HostMgrOperationTarget::PRIMARY_SOURCE;
 
 1092    } 
else if (raw == 
"database") {
 
 1093        return HostMgrOperationTarget::ALTERNATE_SOURCES;
 
 1094    } 
else if (raw == 
"all") {
 
 1095        return HostMgrOperationTarget::ALL_SOURCES;
 
 1096    } 
else if (raw == 
"default") {
 
 1097        return HostMgrOperationTarget::UNSPECIFIED_SOURCE;
 
 1100                  "The 'operation-target' value (" << raw
 
 1101                  << 
") is not within expected set: (memory, database, all, " 
 1108    string txt = 
"(missing parameters)";
 
 1126        if (family_ == AF_INET) {
 
 1131            validateHostForSubnet6(p.
subnet_id, std::vector<IOAddress>());
 
 1134        for (
auto const& host : hosts) {
 
 1136            if (family_ == AF_INET) {
 
 1137                host_json = host->toElement4();
 
 1138                SubnetID subnet_id = host->getIPv4SubnetID();
 
 1141                host_json = host->toElement6();
 
 1142                SubnetID subnet_id = host->getIPv6SubnetID();
 
 1145            hosts_json->add(host_json);
 
 1147    } 
catch (
const std::exception& ex) {
 
 1159    msg << hosts_json->size()
 
 1160        << 
" IPv" << (family_ == AF_INET ? 
"4" : 
"6")
 
 1161        << 
" host(s) found.";
 
 1163    result->set(
"hosts", hosts_json);
 
 
 1176    string txt = 
"(missing parameters)";
 
 1180    uint64_t last_id(0);
 
 1195            if (family_ == AF_INET) {
 
 1201                validateHostForSubnet6(p.
subnet_id, std::vector<IOAddress>());
 
 1206            if (family_ == AF_INET) {
 
 1214        for (
auto const& host : hosts) {
 
 1216                if (family_ == AF_INET) {
 
 1217                    subnet_id = host->getIPv4SubnetID();
 
 1219                    subnet_id = host->getIPv6SubnetID();
 
 1221                if (subnet_id == SUBNET_ID_UNUSED) {
 
 1225            if (family_ == AF_INET) {
 
 1226                host_json = host->toElement4();
 
 1228                host_json = host->toElement6();
 
 1231            hosts_json->add(host_json);
 
 1232            last_id = host->getHostId();
 
 1234    } 
catch (
const std::exception& ex) {
 
 1246    msg << hosts_json->size()
 
 1247        << 
" IPv" << (family_ == AF_INET ? 
"4" : 
"6")
 
 1248        << 
" host(s) found.";
 
 1250    result->set(
"hosts", hosts_json);
 
 1251    result->set(
"count",
 
 1253    if (hosts_json->size() > 0) {
 
 1255        next->set(
"source-index",
 
 1258        result->set(
"next", next);
 
 
 1272    string txt = 
"(missing parameters)";
 
 1290        if (hostname.empty()) {
 
 1293        boost::algorithm::to_lower(hostname);
 
 1296            if (family_ == AF_INET) {
 
 1303                validateHostForSubnet6(p.
subnet_id, std::vector<IOAddress>());
 
 1316        for (
auto const& host : hosts) {
 
 1318                if (family_ == AF_INET) {
 
 1319                    subnet_id = host->getIPv4SubnetID();
 
 1321                    subnet_id = host->getIPv6SubnetID();
 
 1323                if (subnet_id == SUBNET_ID_UNUSED) {
 
 1327            if (family_ == AF_INET) {
 
 1328                host_json = host->toElement4();
 
 1330                host_json = host->toElement6();
 
 1333            hosts_json->add(host_json);
 
 1335    } 
catch (
const std::exception& ex) {
 
 1347    msg << hosts_json->size()
 
 1348        << 
" IPv" << (family_ == AF_INET ? 
"4" : 
"6")
 
 1349        << 
" host(s) found.";
 
 1351    result->set(
"hosts", hosts_json);
 
 
 1364    string txt = 
"(missing parameters)";
 
 1386        for (
auto const& host : hosts) {
 
 1387            if (family_ == AF_INET) {
 
 1388                subnet_id = host->getIPv4SubnetID();
 
 1390                subnet_id = host->getIPv6SubnetID();
 
 1392            if (subnet_id == SUBNET_ID_UNUSED) {
 
 1395            if (family_ == AF_INET) {
 
 1396                host_json = host->toElement4();
 
 1398                host_json = host->toElement6();
 
 1401            hosts_json->add(host_json);
 
 1403    } 
catch (
const std::exception& ex) {
 
 1415    msg << hosts_json->size()
 
 1416        << 
" IPv" << (family_ == AF_INET ? 
"4" : 
"6")
 
 1417        << 
" host(s) found.";
 
 1419    result->set(
"hosts", hosts_json);
 
 
 1432    string parameters(
"(missing parameters)");
 
 1455            isc_throw(
BadValue, 
"invalid command: expected 'reservation' as the sole parameter " 
 1456                      "inside the 'arguments' map, didn't get it instead");
 
 1470        if (family_ == AF_INET) {
 
 1488        if (family_ == AF_INET) {
 
 1491            validateHostForSubnet4(host->getIPv4SubnetID(),
 
 1492                                   host->getIPv4Reservation());
 
 1501            std::vector<IOAddress> addresses;
 
 1502            BOOST_FOREACH(
auto const& address, range) {
 
 1503                addresses.push_back(address.second.getPrefix());
 
 1508            validateHostForSubnet6(host->getIPv6SubnetID(), addresses);
 
 1513    } 
catch (exception 
const& exception) {
 
 1516            .arg(exception.what());
 
 
 1533    return (impl_->reservationAddHandler(handle));
 
 
 1538    return (impl_->reservationGetHandler(handle));
 
 
 1543    return (impl_->reservationDelHandler(handle));
 
 
 1548    return (impl_->reservationGetAllHandler(handle));
 
 
 1553    return (impl_->reservationGetPageHandler(handle));
 
 
 1558    return (impl_->reservationGetByHostnameHandler(handle));
 
 
 1563    return (impl_->reservationGetByIdHandler(handle));
 
 
 1568    return (impl_->reservationUpdateHandler(handle));
 
 
 1573    return (impl_->reservationGetByAddressHandler(handle));
 
 
 
static ElementPtr create(const Position &pos=ZERO_POSITION())
static std::string typeToName(Element::types type)
Returns the name of the given type as a string.
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.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
The IOAddress class represents an IP addresses (version agnostic)
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
bool isV4Zero() const
Convenience function to check if it is an IPv4 zero address.
std::string toText() const
Convert the address to a string.
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4() const
Convenience function to check for an IPv4 address.
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
Base class that command handler implementers may use for common tasks.
void setErrorResponse(hooks::CalloutHandle &handle, const std::string &text, int status=CONTROL_RESULT_ERROR)
Set the callout argument "response" to indicate an error.
data::ConstElementPtr cmd_args_
Stores the command arguments extracted by a call to extractCommand.
void extractCommand(hooks::CalloutHandle &handle)
Extracts the command name and arguments from a Callout handle.
void setSuccessResponse(hooks::CalloutHandle &handle, const std::string &text)
Set the callout argument "response" to indicate success.
void setResponse(hooks::CalloutHandle &handle, data::ConstElementPtr &response)
Set the callout argument "response" to the given response.
static isc::asiolink::IOAddress getAddress(const ConstElementPtr &scope, const std::string &name)
Returns a IOAddress parameter from a scope.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
ConstHostCollection getAll6(const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts in a DHCPv6 subnet.
ConstHostCollection getAll4(const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts in a DHCPv4 subnet.
virtual ConstHostCollection getPage6(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const
Returns range of hosts in a DHCPv6 subnet.
ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts with a hostname in a DHCPv4 subnet.
bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
Attempts to delete a host by (subnet4-id, identifier, identifier-type, operation-target)
ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
Attempts to delete a host by (subnet6-id, identifier, identifier-type, operation-target)
void add(const HostPtr &host, const HostMgrOperationTarget target)
Adds a new host to the alternate data source.
bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr, const HostMgrOperationTarget target)
Attempts to delete hosts by address.
ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts with a hostname in a DHCPv6 subnet.
virtual ConstHostCollection getPage4(const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const
Returns range of hosts in a DHCPv4 subnet.
HostDataSourcePtr getHostDataSource() const
Returns the first host data source.
static HostMgr & instance()
Returns a sole instance of the HostMgr.
void update(HostPtr const &host, const HostMgrOperationTarget target)
Implements BaseHostDataSource::update() for alternate sources.
ConstHostCollection getAllbyHostname(const std::string &hostname, const HostMgrOperationTarget target) const
Return all hosts with a hostname.
ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns a host connected to the IPv4 subnet.
ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
Returns a host connected to the IPv6 subnet.
Wraps value holding size of the page with host reservations.
Represents a device with IPv4 and/or IPv6 reservations.
IdentifierType
Type of the host identifier.
IdentifierType getIdentifierType() const
Returns the identifier type.
Per-packet callout handle.
Parameters specified for reservation-get and reservation-del.
HostMgrOperationTarget operation_target
Specifies the target host source (default UNSPECIFIED_SOURCE which means the default host source is c...
std::string hostname
Specifies host name (default "").
Parameters()
Default constructor.
uint64_t host_id
Specifies host identifier (default 0).
std::vector< uint8_t > ident
Specifies identifier value (used when query_by_addr is false)
SubnetID subnet_id
Specifies subnet-id.
bool query_by_addr
Specifies parameter types (true = query by address, false = query by identifier-type,...
size_t source_index
Specifies source index (default 0).
Host::IdentifierType type
Specifies identifier type (usually FLEX_ID, used when query_by_addr is false)
IOAddress addr
Specifies IPv4 or IPv6 address (used when query_by_addr is true)
bool has_subnet_id
Specifies if subnet-id is present.
size_t page_limit
Specifies page limit (no default).
Wrapper class around reservation command handlers.
HostCmdsImpl()
Constructor.
int reservationGetAllHandler(CalloutHandle &handle)
reservation-get-all command handler
int reservationAddHandler(CalloutHandle &handle)
reservation-add command handler
int reservationGetPageHandler(CalloutHandle &handle)
reservation-get-page command handler
int reservationGetHandler(CalloutHandle &handle)
reservation-get command handler
int reservationUpdateHandler(CalloutHandle &handle)
reservation-update command handler
~HostCmdsImpl()
Destructor.
int reservationGetByHostnameHandler(CalloutHandle &handle)
reservation-get-by-hostname command handler
int reservationDelHandler(CalloutHandle &handle)
reservation-del command handler
int reservationGetByAddressHandler(CalloutHandle &handle)
reservation-get-by-address command handler
int reservationGetByIdHandler(CalloutHandle &handle)
reservation-get-by-id command handler
int reservationGetPageHandler(hooks::CalloutHandle &handle)
reservation-get-page command handler
int reservationGetAllHandler(hooks::CalloutHandle &handle)
reservation-get-all command handler
int reservationGetByAddressHandler(hooks::CalloutHandle &handle)
reservation-get-by-address command handler
int reservationGetByHostnameHandler(hooks::CalloutHandle &handle)
reservation-get-by-hostname command handler
int reservationUpdateHandler(hooks::CalloutHandle &handle)
reservation-update command handler
int reservationGetHandler(hooks::CalloutHandle &handle)
reservation-get command handler
int reservationAddHandler(hooks::CalloutHandle &handle)
reservation-add command handler
int reservationDelHandler(hooks::CalloutHandle &handle)
reservation-del command handler
int reservationGetByIdHandler(hooks::CalloutHandle &handle)
reservation-get-by-id command handler
isc::dhcp::HostPtr parseWithSubnet(isc::data::ConstElementPtr host_data, bool required=true)
Parser specified parameter as host reservation data.
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.
const isc::log::MessageID HOST_CMDS_RESERV_UPDATE
const isc::log::MessageID HOST_CMDS_RESERV_GET_ALL_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_ADD
const isc::log::MessageID HOST_CMDS_RESERV_GET_PAGE
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_HOSTNAME_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_DEL_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_ADD_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ID
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ADDRESS_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_PAGE_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET
const isc::log::MessageID HOST_CMDS_RESERV_DEL
const isc::log::MessageID HOST_CMDS_RESERV_UPDATE_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_PAGE_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ID_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ADDRESS_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET_ALL_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_UPDATE_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET_ALL
const isc::log::MessageID HOST_CMDS_RESERV_DEL_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_HOSTNAME_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ID_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_ADD_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_SUCCESS
const isc::log::MessageID HOST_CMDS_RESERV_GET_FAILED
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_HOSTNAME
const isc::log::MessageID HOST_CMDS_RESERV_GET_BY_ADDRESS
#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.
const char * CONTROL_ARGUMENTS
String used for arguments map ("arguments")
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
isc::log::Logger host_cmds_logger("host-cmds-hooks")
HostDataParser< isc::dhcp::HostReservationParser6 > HostDataParser6
Parser for DHCPv4 host reservation.
HostDataParser< isc::dhcp::HostReservationParser4 > HostDataParser4
Parser for DHCPv4 host reservation.
void decodeFormattedHexString(const string &hex_string, vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
vector< uint8_t > quotedStringToBinary(const string "ed_string)
Converts a string in quotes into vector.
Defines the logger used by the top-level component of kea-lfc.