17#include <boost/foreach.hpp> 
   35                 const uint8_t* identifier_begin,
 
   36                 const size_t identifier_len)
 const {
 
   41    getAllInternal<ConstHostCollection>(identifier_type, identifier_begin,
 
   42                                        identifier_len, collection);
 
 
   48                 const uint8_t* identifier_begin, 
const size_t identifier_len) {
 
   53    getAllInternal<HostCollection>(identifier_type, identifier_begin,
 
   54                                   identifier_len, collection);
 
 
   64    getAllInternal4<ConstHostCollection>(subnet_id, collection);
 
 
   74    getAllInternal4<HostCollection>(subnet_id, collection);
 
 
   84    getAllInternal6<ConstHostCollection>(subnet_id, collection);
 
 
   94    getAllInternal6<HostCollection>(subnet_id, collection);
 
 
  104    getAllbyHostnameInternal<ConstHostCollection>(hostname, collection);
 
 
  114    getAllbyHostnameInternal<HostCollection>(hostname, collection);
 
 
  125    getAllbyHostnameInternal4<ConstHostCollection>(hostname, subnet_id, collection);
 
 
  136    getAllbyHostnameInternal4<HostCollection>(hostname, subnet_id, collection);
 
 
  147    getAllbyHostnameInternal6<ConstHostCollection>(hostname, subnet_id, collection);
 
 
  158    getAllbyHostnameInternal6<HostCollection>(hostname, subnet_id, collection);
 
 
  165                   uint64_t lower_host_id,
 
  171    getPageInternal4<ConstHostCollection>(subnet_id,
 
 
  181                   uint64_t lower_host_id,
 
  187    getPageInternal4<HostCollection>(subnet_id,
 
 
  197                   uint64_t lower_host_id,
 
  203    getPageInternal6<ConstHostCollection>(subnet_id,
 
 
  213                   uint64_t lower_host_id,
 
  219    getPageInternal6<HostCollection>(subnet_id,
 
 
  228                   uint64_t lower_host_id,
 
  234    getPageInternal<ConstHostCollection>(lower_host_id,
 
 
  242                   uint64_t lower_host_id,
 
  248    getPageInternal<HostCollection>(lower_host_id,
 
 
  256                   uint64_t lower_host_id,
 
  262    getPageInternal<ConstHostCollection>(lower_host_id,
 
 
  270                   uint64_t lower_host_id,
 
  276    getPageInternal<HostCollection>(lower_host_id,
 
 
  288    getAllInternal4<ConstHostCollection>(address, collection);
 
 
  298    getAllInternal4<HostCollection>(address, collection);
 
 
  308    getAllInternal6<ConstHostCollection>(address, collection);
 
 
  318    getAllInternal6<HostCollection>(address, collection);
 
 
  322template<
typename Storage>
 
  325                         const uint8_t* identifier,
 
  326                         const size_t identifier_len,
 
  327                         Storage& storage)
 const {
 
  335        .arg(identifier_text);
 
  340        boost::make_tuple(std::vector<uint8_t>(identifier,
 
  341                                               identifier + identifier_len),
 
  345    for (HostContainerIndex0::iterator host = idx.lower_bound(t);
 
  346         host != idx.upper_bound(t);
 
  350            .arg(identifier_text)
 
  351            .arg((*host)->toText());
 
  352        storage.push_back(*host);
 
  357        .arg(identifier_text)
 
  358        .arg(storage.size());
 
  361template<
typename Storage>
 
  363CfgHosts::getAllInternal4(
const SubnetID& subnet_id,
 
  364                          Storage& storage)
 const {
 
  373    for (HostContainerIndex2::iterator host = idx.lower_bound(subnet_id);
 
  374         host != idx.upper_bound(subnet_id);
 
  379            .arg((*host)->toText());
 
  380        storage.push_back(*host);
 
  386        .arg(storage.size());
 
  389template<
typename Storage>
 
  391CfgHosts::getAllInternal6(
const SubnetID& subnet_id,
 
  392                          Storage& storage)
 const {
 
  401    for (HostContainerIndex3::iterator host = idx.lower_bound(subnet_id);
 
  402         host != idx.upper_bound(subnet_id);
 
  407            .arg((*host)->toText());
 
  408        storage.push_back(*host);
 
  414        .arg(storage.size());
 
  417template<
typename Storage>
 
  419CfgHosts::getAllbyHostnameInternal(
const std::string& hostname,
 
  420                                   Storage& storage)
 const {
 
  429    for (HostContainerIndex5::iterator host = idx.lower_bound(hostname);
 
  430         host != idx.upper_bound(hostname);
 
  435            .arg((*host)->toText());
 
  436        storage.push_back(*host);
 
  442        .arg(storage.size());
 
  445template<
typename Storage>
 
  447CfgHosts::getAllbyHostnameInternal4(
const std::string& hostname,
 
  449                                    Storage& storage)
 const {
 
  460    for (HostContainerIndex5::iterator host = idx.lower_bound(hostname);
 
  461         host != idx.upper_bound(hostname);
 
  463        if ((*host)->getIPv4SubnetID() != subnet_id) {
 
  470            .arg((*host)->toText());
 
  471        storage.push_back(*host);
 
  479        .arg(storage.size());
 
  482template<
typename Storage>
 
  484CfgHosts::getAllbyHostnameInternal6(
const std::string& hostname,
 
  486                                    Storage& storage)
 const {
 
  497    for (HostContainerIndex5::iterator host = idx.lower_bound(hostname);
 
  498         host != idx.upper_bound(hostname);
 
  500        if ((*host)->getIPv6SubnetID() != subnet_id) {
 
  507            .arg((*host)->toText());
 
  508        storage.push_back(*host);
 
  516        .arg(storage.size());
 
  519template<
typename Storage>
 
  521CfgHosts::getPageInternal(uint64_t lower_host_id,
 
  523                          Storage& storage)
 const {
 
  529    HostContainerIndex4::const_iterator host = idx.lower_bound(lower_host_id);
 
  533        (host != idx.end()) && ((*host)->getHostId() == lower_host_id)) {
 
  538    for (; host != idx.end(); ++host) {
 
  541            .arg((*host)->toText());
 
  542        storage.push_back(*host);
 
  543        if (storage.size() >= page_size.page_size_) {
 
  550        .arg(storage.size());
 
  553template<
typename Storage>
 
  555CfgHosts::getPageInternal4(
const SubnetID& subnet_id,
 
  556                           uint64_t lower_host_id,
 
  558                           Storage& storage)
 const {
 
  565    HostContainerIndex4::const_iterator host = idx.lower_bound(lower_host_id);
 
  569        (host != idx.end()) && ((*host)->getHostId() == lower_host_id)) {
 
  574    for (; host != idx.end(); ++host) {
 
  575        if ((*host)->getIPv4SubnetID() != subnet_id) {
 
  581            .arg((*host)->toText());
 
  582        storage.push_back(*host);
 
  583        if (storage.size() >= page_size.page_size_) {
 
  591        .arg(storage.size());
 
  594template<
typename Storage>
 
  596CfgHosts::getPageInternal6(
const SubnetID& subnet_id,
 
  597                           uint64_t lower_host_id,
 
  599                           Storage& storage)
 const {
 
  606    HostContainerIndex4::const_iterator host = idx.lower_bound(lower_host_id);
 
  610        (host != idx.end()) && ((*host)->getHostId() == lower_host_id)) {
 
  615    for (; host != idx.end(); ++host) {
 
  616        if ((*host)->getIPv6SubnetID() != subnet_id) {
 
  622            .arg((*host)->toText());
 
  623        storage.push_back(*host);
 
  624        if (storage.size() >= page_size.page_size_) {
 
  632        .arg(storage.size());
 
  636template<
typename Storage>
 
  638CfgHosts::getAllInternal4(
const IOAddress& address, Storage& storage)
 const {
 
  643    if (!address.
isV4()) {
 
  644        isc_throw(BadHostAddress, 
"must specify an IPv4 address when searching" 
  645                  " for a host, specified address was " << address);
 
  651    BOOST_FOREACH(
auto const& host, r) {
 
  655            .arg(host->toText());
 
  656        storage.push_back(host);
 
  661        .arg(storage.size());
 
  665CfgHosts::getAllInternal4(
const SubnetID& subnet_id,
 
  672    if (!address.
isV4()) {
 
  673        isc_throw(BadHostAddress, 
"must specify an IPv4 address when searching" 
  674                  " for a host, specified address was " << address);
 
  681    BOOST_FOREACH(
auto const& host, r) {
 
  682        if (host->getIPv4SubnetID() == subnet_id) {
 
  687                .arg(host->toText());
 
  688            hosts.push_back(host);
 
  700template<
typename Storage>
 
  702CfgHosts::getAllInternal6(
const IOAddress& address, Storage& storage)
 const {
 
  707    if (!address.
isV6()) {
 
  708        isc_throw(BadHostAddress, 
"must specify an IPv6 address when searching" 
  709                  " for a host, specified address was " << address);
 
  715    BOOST_FOREACH(
auto const& reservation, r) {
 
  719            .arg(reservation.host_->toText());
 
  720        storage.push_back(reservation.host_);
 
  725        .arg(storage.size());
 
  731               const uint8_t* identifier_begin,
 
  732               const size_t identifier_len)
 const {
 
  734    return (getHostInternal(subnet_id, 
false, identifier_type, identifier_begin,
 
 
  741               const uint8_t* identifier_begin,
 
  742               const size_t identifier_len) {
 
  744    return (getHostInternal(subnet_id, 
false, identifier_type, identifier_begin,
 
 
  751        .arg(subnet_id).arg(address.
toText());
 
  766            .arg(host->toText());
 
 
  775    return (getAllInternal4(subnet_id, address));
 
 
  781               const uint8_t* identifier_begin,
 
  782               const size_t identifier_len)
 const {
 
  784    return (getHostInternal(subnet_id, 
true, identifier_type, identifier_begin,
 
 
  791               const uint8_t* identifier_begin,
 
  792               const size_t identifier_len) {
 
  794    return (getHostInternal(subnet_id, 
true, identifier_type, identifier_begin,
 
 
  801    return (getHostInternal6<ConstHostPtr>(prefix, prefix_len));
 
 
  807    return (getHostInternal6<HostPtr>(prefix, prefix_len));
 
 
  815    return (getHostInternal6<ConstHostPtr, ConstHostCollection>(subnet_id, address));
 
 
  823    return (getHostInternal6<HostPtr, HostCollection>(subnet_id, address));
 
 
  831    getAllInternal6(subnet_id, address, hosts);
 
 
  835template<
typename ReturnType, 
typename Storage>
 
  837CfgHosts::getHostInternal6(
const SubnetID& subnet_id,
 
  840        .arg(subnet_id).arg(address.
toText());
 
  843    getAllInternal6<Storage>(subnet_id, address, storage);
 
  844    switch (storage.size()) {
 
  857            .arg((*storage.begin())->toText());
 
  858        return (*storage.begin());
 
  862                  " for the host belonging to the subnet with id '" 
  863                  << subnet_id << 
"' and using the address '" 
  864                  << address.
toText() << 
"'");
 
  869template<
typename ReturnType>
 
  872                           const uint8_t prefix_len)
 const {
 
  874        .arg(prefix.
toText()).arg(
static_cast<int>(prefix_len));
 
  879                                            idx.upper_bound(prefix));
 
  880    BOOST_FOREACH(
auto const& resrv, r) {
 
  881        if (resrv.resrv_.getPrefixLen() == prefix_len) {
 
  885                .arg(
static_cast<int>(prefix_len))
 
  886                .arg(resrv.host_->toText());
 
  887            return (resrv.host_);
 
  894        .arg(
static_cast<int>(prefix_len));
 
  895    return (ReturnType());
 
  898template<
typename Storage>
 
  900CfgHosts::getAllInternal6(
const SubnetID& subnet_id,
 
  901                          const asiolink::IOAddress& address,
 
  902                          Storage& storage)
 const {
 
  904        .arg(subnet_id).arg(address.
toText());
 
  907    if (!address.
isV6()) {
 
  908        isc_throw(BadHostAddress, 
"must specify an IPv6 address when searching" 
  909                  " for a host, specified address was " << address);
 
  915                                            idx.upper_bound(boost::make_tuple(subnet_id, address)));
 
  921    BOOST_FOREACH(
auto const& resrv, r) {
 
  926            .arg(resrv.host_->toText());
 
  927        storage.push_back(resrv.host_);
 
  934        .arg(storage.size());
 
  938CfgHosts::getHostInternal(
const SubnetID& subnet_id, 
const bool subnet6,
 
  940                          const uint8_t* identifier,
 
  941                          const size_t identifier_len)
 const {
 
  944        .arg(subnet6 ? 
"IPv6" : 
"IPv4")
 
  952    getAllInternal<HostCollection>(identifier_type, identifier, identifier_len,
 
  958    for (
auto const& host_it : hosts) {
 
  960        SubnetID host_subnet_id = subnet6 ? host_it->getIPv6SubnetID() :
 
  961            host_it->getIPv4SubnetID();
 
  963        if (subnet_id == host_subnet_id) {
 
  975                isc_throw(DuplicateHost,  
"more than one reservation found" 
  976                          " for the host belonging to the subnet with id '" 
  977                          << subnet_id << 
"' and using the identifier '" 
  992            .arg(host->toText());
 
 1008        .arg(host ? host->toText() : 
"(no-host)");
 
 1013                  " is added to the configuration");
 
 1017    if (host->getIPv4SubnetID() == SUBNET_ID_UNUSED &&
 
 1018        host->getIPv6SubnetID() == SUBNET_ID_UNUSED) {
 
 1020                  " 0 when adding new host reservation");
 
 
 1031CfgHosts::add4(
const HostPtr& host) {
 
 1033    HWAddrPtr hwaddr = host->getHWAddress();
 
 1034    DuidPtr duid = host->getDuid();
 
 1037    if (host->getIPv4SubnetID() != SUBNET_ID_UNUSED) {
 
 1038        if (hwaddr && !hwaddr->hwaddr_.empty() &&
 
 1040                            &hwaddr->hwaddr_[0], hwaddr->hwaddr_.size())) {
 
 1042                      << 
" address '" << hwaddr->toText(
false)
 
 1043                      << 
"' to the IPv4 subnet id '" << host->getIPv4SubnetID()
 
 1044                      << 
"' as this host has already been added");
 
 1046        if (duid && !duid->getDuid().empty() &&
 
 1048                            &duid->getDuid()[0], duid->getDuid().size())) {
 
 1049            isc_throw(DuplicateHost, 
"failed to add new host using the " 
 1050                      << 
"DUID '" << duid->toText()
 
 1051                      << 
"' to the IPv4 subnet id '" << host->getIPv4SubnetID()
 
 1052                      << 
"' as this host has already been added");
 
 1055    } 
else if (host->getIPv6SubnetID() != SUBNET_ID_UNUSED) {
 
 1056        if (duid && !duid->getDuid().empty() &&
 
 1058                            &duid->getDuid()[0], duid->getDuid().size())) {
 
 1059            isc_throw(DuplicateHost, 
"failed to add new host using the " 
 1060                      << 
"DUID '" << duid->toText()
 
 1061                      << 
"' to the IPv6 subnet id '" << host->getIPv6SubnetID()
 
 1062                      << 
"' as this host has already been added");
 
 1064        if (hwaddr && !hwaddr->hwaddr_.empty() &&
 
 1066                            &hwaddr->hwaddr_[0], hwaddr->hwaddr_.size())) {
 
 1067            isc_throw(DuplicateHost, 
"failed to add new host using the HW" 
 1068                      << 
" address '" << hwaddr->toText(
false)
 
 1069                      << 
"' to the IPv6 subnet id '" << host->getIPv6SubnetID()
 
 1070                      << 
"' as this host has already been added");
 
 1075    if (ip_reservations_unique_ && !host->getIPv4Reservation().isV4Zero() &&
 
 1076        (host->getIPv4SubnetID() != SUBNET_ID_UNUSED) &&
 
 1077        !getAllInternal4(host->getIPv4SubnetID(),
 
 1078                         host->getIPv4Reservation()).empty()) {
 
 1079        isc_throw(ReservedAddress, 
"failed to add new host using the HW" 
 1080                  " address '" << (hwaddr ? hwaddr->toText(
false) : 
"(null)")
 
 1081                  << 
" and DUID '" << (duid ? duid->toText() : 
"(null)")
 
 1082                  << 
"' to the IPv4 subnet id '" << host->getIPv4SubnetID()
 
 1083                  << 
"' for the address " << host->getIPv4Reservation()
 
 1084                  << 
": There's already a reservation for this address");
 
 1088    const std::vector<uint8_t>& 
id = host->getIdentifier();
 
 1089    if ((host->getIPv4SubnetID() != SUBNET_ID_UNUSED) && !
id.empty()) {
 
 1090        if (getHostInternal(host->getIPv4SubnetID(), 
false,
 
 1091                            host->getIdentifierType(), &
id[0], 
id.size())) {
 
 1092            isc_throw(DuplicateHost, 
"failed to add duplicate IPv4 host using identifier: " 
 1094                                                   &
id[0], 
id.size()));
 
 1099    host->setHostId(++next_host_id_);
 
 1100    hosts_.insert(host);
 
 1104CfgHosts::add6(
const HostPtr& host) {
 
 1106    if (host->getIPv6SubnetID() == SUBNET_ID_UNUSED) {
 
 1111    HWAddrPtr hwaddr = host->getHWAddress();
 
 1112    DuidPtr duid = host->getDuid();
 
 1118    if (std::distance(reservations.first, reservations.second) == 0) {
 
 1125    BOOST_FOREACH(
auto const& it, reservations) {
 
 1127        if (ip_reservations_unique_) {
 
 1129            if (getHostInternal6<ConstHostPtr, ConstHostCollection>
 
 1130                (host->getIPv6SubnetID(), it.second.getPrefix())) {
 
 1131                isc_throw(DuplicateHost, 
"failed to add address reservation for " 
 1132                          << 
"host using the HW address '" 
 1133                          << (hwaddr ? hwaddr->toText(
false) : 
"(null)")
 
 1134                          << 
" and DUID '" << (duid ? duid->toText() : 
"(null)")
 
 1135                          << 
"' to the IPv6 subnet id '" << host->getIPv6SubnetID()
 
 1136                          << 
"' for address/prefix " << it.second.getPrefix()
 
 1137                          << 
": There's already reservation for this address/prefix");
 
 1140        hosts6_.insert(HostResrv6Tuple(it.second, host));
 
 1146    size_t erased_hosts = 0;
 
 1147    size_t erased_addresses = 0;
 
 1152        getAllInternal4<ConstHostCollection>(addr, hosts);
 
 1154        for (
auto const& host : hosts) {
 
 1155            if (host->getIPv4SubnetID() != subnet_id) {
 
 1158            erased_hosts += idx.erase(host->getHostId());
 
 1160        erased_addresses = erased_hosts;
 
 1167        auto const& range = idx6.equal_range(boost::make_tuple(subnet_id, addr));
 
 1171        BOOST_FOREACH(
auto const& key, range) {
 
 1172            static_cast<void>(ids.insert(key.host_->getHostId()));
 
 1175        for(
auto const& 
id : ids) {
 
 1176            erased_hosts += idx.erase(
id);
 
 1177            erased_addresses += idx3.erase(
id);
 
 1183        .arg(erased_addresses)
 
 1187    return (erased_hosts != 0);
 
 
 1194    size_t erased = idx.erase(subnet_id);
 
 
 1206               const uint8_t* identifier_begin,
 
 1207               const size_t identifier_len) {
 
 1210    auto const t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
 
 1211                                                          identifier_begin + identifier_len),
 
 1213    auto const& range = idx.equal_range(t);
 
 1215    for (
auto key = range.first; key != range.second;) {
 
 1216        if ((*key)->getIPv4SubnetID() != subnet_id) {
 
 1222        key = idx.erase(key);
 
 1231    return (erased != 0);
 
 
 1239    size_t erased_addresses = idx6.erase(subnet_id);
 
 1243    size_t erased_hosts = idx.erase(subnet_id);
 
 1247        .arg(erased_addresses)
 
 1250    return (erased_hosts);
 
 
 1256               const uint8_t* identifier_begin,
 
 1257               const size_t identifier_len) {
 
 1261    auto const t = boost::make_tuple(std::vector<uint8_t>(identifier_begin,
 
 1262                                                          identifier_begin + identifier_len),
 
 1265    auto const& range = idx.equal_range(t);
 
 1266    size_t erased_hosts = 0;
 
 1267    size_t erased_reservations = 0;
 
 1268    for (
auto key = range.first; key != range.second;) {
 
 1269        if ((*key)->getIPv6SubnetID() != subnet_id) {
 
 1276        auto host_id = (*key)->getHostId();
 
 1277        key = idx.erase(key);
 
 1280        erased_reservations += idx6.erase(host_id);
 
 1285        .arg(erased_reservations)
 
 1289    return (erased_hosts != 0);
 
 
 1294    bool deleted(
false);
 
 1296    std::vector<uint8_t> 
const& identifier(host->getIdentifier());
 
 1297    auto const t = boost::make_tuple(identifier, host->getIdentifierType());
 
 1299    auto const& range = idx.equal_range(t);
 
 1300    if (host->getIPv4SubnetID() != SUBNET_ID_UNUSED) {
 
 1302        for (
auto key = range.first; key != range.second;) {
 
 1303            if ((*key)->getIPv4SubnetID() != host->getIPv4SubnetID()) {
 
 1309            key = idx.erase(key);
 
 1313                .arg(host->getIPv4SubnetID())
 
 1314                .arg(host->getIdentifierAsText());
 
 1316    } 
else if (host->getIPv6SubnetID() != SUBNET_ID_UNUSED) {
 
 1319        for (
auto key = range.first; key != range.second;) {
 
 1320            if ((*key)->getIPv6SubnetID() != host->getIPv6SubnetID()) {
 
 1325            auto host_id = (*key)->getHostId();
 
 1326            key = idx.erase(key);
 
 1328            size_t erased_reservations = idx6.erase(host_id);
 
 1331                .arg(erased_reservations)
 
 1332                .arg(host->getIPv6SubnetID())
 
 1333                .arg(host->getIdentifierAsText());
 
 1342        .arg(host->toText());
 
 
 1350    ip_reservations_unique_ = unique;
 
 
 1358    if (family == AF_INET) {
 
 1359        return (toElement4());
 
 1360    } 
else if (family == AF_INET6) {
 
 1361        return (toElement6());
 
 1364                  "address family: " << family);
 
 
 1369CfgHosts::toElement4()
 const {
 
 1374    for (
auto const& host : idx) {
 
 1380        SubnetID subnet_id = host->getIPv4SubnetID();
 
 1381        result.
add(subnet_id, map);
 
 1387CfgHosts::toElement6()
 const {
 
 1388    CfgHostsList result;
 
 1392    for (
auto const& host : idx) {
 
 1398        SubnetID subnet_id = host->getIPv6SubnetID();
 
 1399        result.add(subnet_id, map);
 
 1401    return (result.externalize());
 
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)
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.
Utility class to represent host reservation configurations internally as a map keyed by subnet IDs,...
void add(SubnetID id, isc::data::ElementPtr resv)
Add a host reservation to the map.
isc::data::ElementPtr externalize() const
Externalize the map to a list Element.
virtual void update(HostPtr const &host)
Attempts to update an existing host entry.
virtual size_t delAll4(const SubnetID &subnet_id)
Attempts to delete all hosts for a given IPv4 subnet.
virtual void add(const HostPtr &host)
Adds a new host to the collection.
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.
virtual bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet4-id, identifier, identifier-type)
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete hosts by address.
virtual bool setIPReservationsUnique(const bool unique)
Controls whether IP reservations are unique or non-unique.
virtual size_t delAll6(const SubnetID &subnet_id)
Attempts to delete all hosts for a given IPv6 subnet.
virtual ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv6 subnet.
virtual ConstHostCollection getAllbyHostname(const std::string &hostname) const
Return all hosts with a hostname.
virtual bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Attempts to delete a host by (subnet6-id, identifier, identifier-type)
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.
virtual ConstHostCollection getAll4(const SubnetID &subnet_id) const
Return all hosts in a DHCPv4 subnet.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Returns a host connected to the IPv4 subnet.
virtual ConstHostCollection getAll6(const SubnetID &subnet_id) const
Return all hosts in a DHCPv6 subnet.
virtual ConstHostCollection getAllbyHostname6(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv6 subnet.
isc::data::ElementPtr toElement() const
Unparse a configuration object.
virtual ConstHostCollection getAllbyHostname4(const std::string &hostname, const SubnetID &subnet_id) const
Return all hosts with a hostname in a DHCPv4 subnet.
virtual ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
Exception thrown when the duplicate Host object is detected.
Exception thrown when a Host object is expected, but none are found.
Wraps value holding size of the page with host reservations.
IdentifierType
Type of the host identifier.
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< Element > ElementPtr
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6_COUNT
const isc::log::MessageID HOSTS_CFG_DEL4
HostContainer6::nth_index< 4 >::type HostContainer6Index4
Fifth index type in the HostContainer6.
HostContainer::nth_index< 4 >::type HostContainerIndex4
Fifth index type in the HostContainer.
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_HOST
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ALL
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID6
std::pair< HostContainerIndex1::iterator, HostContainerIndex1::iterator > HostContainerIndex1Range
Results range returned using the HostContainerIndex1.
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID4_HOST
isc::log::Logger hosts_logger("hosts")
Logger for the HostMgr and the code it calls.
const isc::log::MessageID HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOST
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4
const isc::log::MessageID HOSTS_CFG_GET_ALL_IDENTIFIER
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS4_HOST
const isc::log::MessageID HOSTS_CFG_ADD_HOST
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS4
const isc::log::MessageID HOSTS_CFG_UPDATE_DEL6
std::pair< HostContainer6Index1::iterator, HostContainer6Index1::iterator > HostContainer6Index1Range
Results range returned using the HostContainer6Index1.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
HostContainer6::nth_index< 3 >::type HostContainer6Index3
Fourth index type in the HostContainer6.
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4_NULL
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID6_HOST
boost::shared_ptr< DUID > DuidPtr
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID6_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID6
HostContainer6::nth_index< 0 >::type HostContainer6Index0
First index type in the HostContainer6.
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID4
std::pair< HostContainer6Index4::iterator, HostContainer6Index4::iterator > HostContainer6Index4Range
Results range returned using the HostContainer6Index4.
const isc::log::MessageID HOSTS_CFG_UPDATE_DEL4
const isc::log::MessageID HOSTS_CFG_GET_ONE_PREFIX_NULL
const isc::log::MessageID HOSTS_CFG_GET_ALL_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID4_HOST
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
const isc::log::MessageID HOSTS_CFG_GET_ALL_IDENTIFIER_HOST
HostContainer6::nth_index< 1 >::type HostContainer6Index1
Second index type in the HostContainer6.
std::vector< HostPtr > HostCollection
Collection of the Host objects.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
const isc::log::MessageID HOSTS_CFG_GET_ONE_PREFIX_HOST
const isc::log::MessageID HOSTS_CFG_DEL6
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_HOST
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID6_HOST
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_HOST
HostContainer::nth_index< 1 >::type HostContainerIndex1
Second index type in the HostContainer.
HostContainer6::nth_index< 2 >::type HostContainer6Index2
Third index type in the HostContainer6.
HostContainer::nth_index< 3 >::type HostContainerIndex3
Forth index type in the HostContainer.
const int HOSTS_DBG_TRACE
Logging levels for the host reservations management.
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_NULL
std::pair< HostContainer6Index0::iterator, HostContainer6Index0::iterator > HostContainer6Index0Range
Results range returned using the HostContainer6Index0.
const isc::log::MessageID HOSTS_CFG_GET_ONE_PREFIX
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4_HOST
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6_HOST
HostContainer::nth_index< 0 >::type HostContainerIndex0
First index type in the HostContainer.
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS4_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_COUNT
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6_HOST
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID4_COUNT
const int HOSTS_DBG_TRACE_DETAIL_DATA
Records detailed results of lookups.
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID4
const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET6
const int HOSTS_DBG_RESULTS
Records the results of the lookups.
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID6_COUNT
const isc::log::MessageID HOSTS_CFG_DEL_ALL_SUBNET4
HostContainer::nth_index< 5 >::type HostContainerIndex5
Sixth index type in the HostContainer.
const isc::log::MessageID HOSTS_CFG_GET_ALL_ADDRESS6_HOST
HostContainer::nth_index< 2 >::type HostContainerIndex2
Third index type in the HostContainer.
const isc::log::MessageID HOSTS_CFG_DEL
const isc::log::MessageID HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6_NULL
const isc::log::MessageID HOSTS_CFG_GET_ALL_HOSTNAME_SUBNET_ID4_COUNT
const isc::log::MessageID HOSTS_CFG_UPDATE_ADD
const isc::log::MessageID HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS4_COUNT
Defines the logger used by the top-level component of kea-lfc.
RAII lock object to protect the code in the same scope with a mutex.