7#ifndef HOST_CACHE_IMPL_H
8#define HOST_CACHE_IMPL_H
17#include <boost/shared_ptr.hpp>
58 const uint8_t* identifier_begin,
59 const size_t identifier_len);
82 const uint8_t* identifier_begin,
83 const size_t identifier_len);
92 const uint8_t prefix_len);
115 HostContainerSequencedIndex::iterator
118 const uint8_t* identifier,
119 const size_t identifier_len);
128 HostContainerSequencedIndex::iterator
141 const uint8_t prefix_len);
180 const uint8_t* identifier_begin,
181 const size_t identifier_len);
201 const uint8_t* identifier_begin,
202 const size_t identifier_len);
268 void flush(
size_t count);
274 return (cache_.size());
300 const uint8_t* identifier_begin,
301 const size_t identifier_len)
const;
The IOAddress class represents an IP addresses (version agnostic)
IdentifierType
Type of the host identifier.
void flush(size_t count)
Flush entries.
size_t capacity() const
Return the maximum number of entries.
dhcp::ConstHostPtr get6(const dhcp::SubnetID &subnet_id, const dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Returns a host connected to the IPv6 subnet.
void removeResv6(const dhcp::HostPtr &host)
Remove IPv6 reservations.
HostContainerSequencedIndex::iterator getHostInternal4(const dhcp::SubnetID &subnet_id, const asiolink::IOAddress &address)
Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.
size_t getMaximum() const
Get maximum number of elements.
dhcp::HostPtr relocate(dhcp::HostPtr host)
Relocate an entry to the end of sequenced index.
size_t maximum_
Maximum number of elements (0 means unbound).
virtual dhcp::ConstHostCollection get(const dhcp::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...
virtual ~HostCacheImpl()
Destructor.
void update(isc::dhcp::ConstHostPtr const &host)
Implements isc::dhcp::BaseHostDataSource::update() for HostCacheImpl.
void clear()
Flush all entries.
dhcp::HostPtr getHostInternal6(const asiolink::IOAddress &prefix, const uint8_t prefix_len)
Returns a host using the specified IPv6 prefix.
bool add(const dhcp::HostPtr &host)
Adds a new host to the collection.
HostContainerSequencedIndex::iterator getHostInternal(const dhcp::SubnetID &subnet_id, const bool subnet6, const dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier, const size_t identifier_len)
Returns Host object connected to a subnet.
HostCacheImpl()
Constructor.
std::string del6(const dhcp::SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete a host by (subnet-id6, address)
void setMaximum(size_t maximum)
Set maximum number of elements.
std::string del4(const dhcp::SubnetID &subnet_id, const asiolink::IOAddress &addr)
Attempts to delete a host by (subnet-id4, address)
data::ElementPtr toElement() const
Unparse cache content.
size_t size() const
Return the number of entries.
dhcp::ConstHostPtr get4(const dhcp::SubnetID &subnet_id, const dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Returns a host connected to the IPv4 subnet.
bool insertResv6(const dhcp::HostPtr &host)
Insert IPv6 reservations.
bool remove(const dhcp::HostPtr &host)
Remove a host from the cache.
size_t insert(const dhcp::ConstHostPtr &host, bool overwrite)
Insert a host into the cache.
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
boost::multi_index_container< dhcp::HostPtr, boost::multi_index::indexed_by< boost::multi_index::sequenced< boost::multi_index::tag< HostSequencedIndexTag > >, boost::multi_index::hashed_unique< boost::multi_index::tag< HostHashedIndexTag >, boost::multi_index::identity< dhcp::HostPtr > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< HostIdentifierIndexTag >, boost::multi_index::composite_key< dhcp::Host, boost::multi_index::const_mem_fun< dhcp::Host, const std::vector< uint8_t > &, &dhcp::Host::getIdentifier >, boost::multi_index::const_mem_fun< dhcp::Host, dhcp::Host::IdentifierType, &dhcp::Host::getIdentifierType > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< HostAddress4IndexTag >, boost::multi_index::const_mem_fun< dhcp::Host, const asiolink::IOAddress &, &dhcp::Host::getIPv4Reservation > > > > HostContainer
Multi-index container holding host cache entries.
boost::multi_index_container< HostResrv6Tuple, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< Resv6AddressIndexTag >, boost::multi_index::const_mem_fun< HostResrv6Tuple, const asiolink::IOAddress &, &HostResrv6Tuple::getKey > >, boost::multi_index::ordered_unique< boost::multi_index::tag< Resv6SubnetAddressIndexTag >, boost::multi_index::composite_key< HostResrv6Tuple, boost::multi_index::member< HostResrv6Tuple, const dhcp::SubnetID, &HostResrv6Tuple::subnet_id_ >, boost::multi_index::const_mem_fun< HostResrv6Tuple, const asiolink::IOAddress &, &HostResrv6Tuple::getKey > > > > > Resv6Container
Multi-index container holding IPv6 reservations.
Defines the logger used by the top-level component of kea-lfc.