Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unfiltered getAll to CfgHosts #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/lib/dhcpsrv/cfg_hosts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ using namespace isc::data;
namespace isc {
namespace dhcp {

ConstHostCollection
CfgHosts::getAll() const {
ConstHostCollection collection;
const HostContainerIndex0& idx = hosts_.get<0>();
for (HostContainerIndex0::const_iterator host = idx.begin();
host != idx.end(); ++host) {
collection.push_back(*host);
}
return (collection);
}

HostCollection
CfgHosts::getAll() {
HostCollection collection;
const HostContainerIndex0& idx = hosts_.get<0>();
for (HostContainerIndex0::const_iterator host = idx.begin();
host != idx.end(); ++host) {
collection.push_back(*host);
}
return (collection);
}

ConstHostCollection
CfgHosts::getAll(const Host::IdentifierType& identifier_type,
const uint8_t* identifier_begin,
Expand Down
18 changes: 18 additions & 0 deletions src/lib/dhcpsrv/cfg_hosts.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ class CfgHosts : public BaseHostDataSource, public WritableHostDataSource,
/// @brief Destructor.
virtual ~CfgHosts() { }

/// @brief Return all hosts
///
/// This method returns all @c Host objects which represent reservations
/// in this configuration.
///
/// @return Collection of const @c Host objects.
virtual ConstHostCollection
getAll() const;

/// @brief Non-const version of the @c getAll const method.
///
/// This method returns all @c Host objects which represent reservations
/// in this configuration.
///
/// @return Collection of non-const @c Host objects.
virtual HostCollection
getAll();

/// @brief Return all hosts connected to any subnet for which reservations
/// have been made using a specified identifier.
///
Expand Down