7 #ifndef CFG_SHARED_NETWORKS_H 8 #define CFG_SHARED_NETWORKS_H 15 #include <boost/shared_ptr.hpp> 33 template<
typename SharedNetworkPtrType,
typename SharedNetworkCollection>
43 void add(
const SharedNetworkPtrType& network) {
46 "' found in the configuration");
57 void del(
const std::string& name) {
58 auto& index =
networks_.template get<SharedNetworkNameIndexTag>();
59 auto shared_network = index.find(name);
60 if (shared_network != index.end()) {
62 (*shared_network)->delAll();
65 index.erase(shared_network);
68 << name <<
"' from shared networks configuration");
78 SharedNetworkPtrType
getByName(
const std::string& name)
const {
79 const auto& index =
networks_.template get<SharedNetworkNameIndexTag>();
80 auto shared_network = index.find(name);
81 if (shared_network != index.cend()) {
82 return (*shared_network);
84 return (SharedNetworkPtrType());
95 const auto& index =
networks_.template get<SharedNetworkNameIndexTag>();
96 for (
auto shared_network = index.begin(); shared_network != index.end();
98 list->add((*shared_network)->toElement());
111 SharedNetwork4Collection> {
135 SharedNetwork6Collection> {
151 #endif // CFG_SHARED_NETWORKS_H SharedNetworkCollection networks_
Multi index container holding shared networks.
void add(const SharedNetworkPtrType &network)
Adds new shared network to the configuration.
boost::shared_ptr< CfgSharedNetworks6 > CfgSharedNetworks6Ptr
Pointer to the configuration of IPv6 shared networks.
boost::multi_index_container< SharedNetwork6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SharedNetworkNameIndexTag >, boost::multi_index::const_mem_fun< SharedNetwork6, std::string, &SharedNetwork6::getName > > >> SharedNetwork6Collection
Multi index container holding shared networks.
void del(const std::string &name)
Deletes shared network from the configuration.
Represents configuration of IPv4 shared networks.
bool hasNetworkWithServerId(const asiolink::IOAddress &server_id) const
Checks if specified server identifier has been specified for any network.
boost::shared_ptr< Element > ElementPtr
boost::multi_index_container< SharedNetwork4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, 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 > > >> SharedNetwork4Collection
Multi index container holding shared networks.
SharedNetworkPtrType getByName(const std::string &name) const
Retrieves shared network by name.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
const SharedNetwork4Collection * getAll() const
Returns pointer to all configured shared networks.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
const SharedNetwork6Collection * getAll() const
Returns pointer to all configured shared networks.
boost::shared_ptr< CfgSharedNetworks4 > CfgSharedNetworks4Ptr
Pointer to the configuration of IPv4 shared networks.
Abstract class for configuration Cfg_* classes.
This class holds configuration of shared networks.
Represents configuration of IPv6 shared networks.
Defines the logger used by the top-level component of kea-dhcp-ddns.
The IOAddress class represents an IP addresses (version agnostic)
virtual data::ElementPtr toElement() const
Unparses shared networks configuration.