7 #ifndef SHARED_NETWORK_H 8 #define SHARED_NETWORK_H 14 #include <boost/enable_shared_from_this.hpp> 15 #include <boost/multi_index/mem_fun.hpp> 16 #include <boost/multi_index/hashed_index.hpp> 17 #include <boost/multi_index/indexed_by.hpp> 18 #include <boost/multi_index/ordered_index.hpp> 19 #include <boost/multi_index/random_access_index.hpp> 20 #include <boost/multi_index_container.hpp> 21 #include <boost/shared_ptr.hpp> 52 public boost::enable_shared_from_this<SharedNetwork4> {
61 :
name_(name), subnets_() {
74 static SharedNetwork4Ptr create(
const std::string& name);
117 void del(
const SubnetID& subnet_id);
142 Subnet4Ptr getSubnet(
const std::string& subnet_prefix)
const;
159 const SubnetID& current_subnet)
const;
195 bool subnetsIncludeMatchClientId(
const Subnet4Ptr& first_subnet,
217 typedef boost::multi_index_container<
220 boost::multi_index::indexed_by<
223 boost::multi_index::random_access<
224 boost::multi_index::tag<SharedNetworkRandomAccessIndexTag>
227 boost::multi_index::hashed_non_unique<
228 boost::multi_index::tag<SharedNetworkIdIndexTag>,
233 boost::multi_index::ordered_unique<
234 boost::multi_index::tag<SharedNetworkNameIndexTag>,
240 boost::multi_index::ordered_non_unique<
241 boost::multi_index::tag<SharedNetworkServerIdIndexTag>,
246 boost::multi_index::ordered_non_unique<
247 boost::multi_index::tag<SharedNetworkModificationTimeIndexTag>,
248 boost::multi_index::const_mem_fun<data::BaseStampedElement,
249 boost::posix_time::ptime,
264 public boost::enable_shared_from_this<SharedNetwork6> {
271 :
name_(name), subnets_() {
284 static SharedNetwork6Ptr create(
const std::string& name);
327 void del(
const SubnetID& subnet_id);
352 Subnet6Ptr getSubnet(
const std::string& subnet_prefix)
const;
369 const SubnetID& current_subnet)
const;
415 typedef boost::multi_index_container<
418 boost::multi_index::indexed_by<
421 boost::multi_index::random_access<
422 boost::multi_index::tag<SharedNetworkRandomAccessIndexTag>
425 boost::multi_index::hashed_non_unique<
426 boost::multi_index::tag<SharedNetworkIdIndexTag>,
427 boost::multi_index::const_mem_fun<data::BaseStampedElement, uint64_t,
428 &data::BaseStampedElement::getId>
431 boost::multi_index::ordered_unique<
432 boost::multi_index::tag<SharedNetworkNameIndexTag>,
437 boost::multi_index::ordered_non_unique<
438 boost::multi_index::tag<SharedNetworkModificationTimeIndexTag>,
439 boost::multi_index::const_mem_fun<data::BaseStampedElement,
440 boost::posix_time::ptime,
453 template<
typename ReturnPtrType,
typename CollectionType>
464 static ReturnPtrType
get(
const CollectionType& collection,
const std::string& name) {
465 auto& index = collection.template get<SharedNetworkNameIndexTag>();
466 auto sn = index.find(name);
467 if (sn != index.end()) {
471 return (ReturnPtrType());
484 #endif // SHARED_NETWORK_H void setName(const std::string &name)
Sets new name for the shared network.
A class containing static convenience methods to fetch the shared networks from the containers...
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
A tag for accessing index by id.
std::string getName() const
Returns a name of the shared network.
boost::shared_ptr< Element > ElementPtr
const Subnet4SimpleCollection * getAllSubnets() const
Returns a pointer to the collection of subnets within this shared network.
Shared network holding IPv4 subnets.
Specialization of the Network object for DHCPv6 case.
A tag for accessing index by shared network name.
SharedNetwork4(const std::string &name)
Constructor.
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > >> Subnet4SimpleCollection
A simple collection of Subnet4 objects.
boost::posix_time::ptime getModificationTime() const
Returns timestamp.
const Subnet6SimpleCollection * getAllSubnets() const
Returns a pointer to the collection of subnets within this shared network.
uint64_t getId() const
Returns element's database identifier.
std::string getName() const
Returns a name of the shared network.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > >> Subnet6SimpleCollection
A simple collection of Subnet6 objects.
boost::multi_index_container< SharedNetwork6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< SharedNetworkIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SharedNetworkNameIndexTag >, boost::multi_index::const_mem_fun< SharedNetwork6, std::string, &SharedNetwork6::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SharedNetworkModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > >> SharedNetwork6Collection
Multi index container holding shared networks.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
A tag for accessing index by server identifier.
Defines the logger used by the top-level component of kea-lfc.
A tag for accessing random access index.
boost::multi_index_container< SharedNetwork4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< SharedNetworkIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SharedNetworkNameIndexTag >, boost::multi_index::const_mem_fun< SharedNetwork4, std::string, &SharedNetwork4::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SharedNetworkServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SharedNetworkModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > >> SharedNetwork4Collection
Multi index container holding shared networks.
Type
Type of lease or pool.
This class represents configuration element which is associated with database identifier and the modi...
virtual asiolink::IOAddress getServerId() const
Returns binary representation of the dhcp-server-identifier option (54).
Shared network holding IPv6 subnets.
Specialization of the Network object for DHCPv4 case.
Tag for the index for searching by shared network modification time.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
The IOAddress class represents an IP addresses (version agnostic)
SharedNetwork6(const std::string &name)
Constructor.
Container for storing client class names.
void setName(const std::string &name)
Sets new name for the shared network.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.