Kea  1.5.0
assignable_network.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef ASSIGNABLE_NETWORK_H
8 #define ASSIGNABLE_NETWORK_H
9 
10 #include <dhcpsrv/network.h>
11 
12 namespace isc {
13 namespace dhcp {
14 
24 protected:
25 
27  virtual ~AssignableNetwork() { }
28 
35  virtual NetworkPtr sharedFromThis() = 0;
36 
42  template<typename SubnetPtr>
43  void setSharedNetwork(const SubnetPtr& subnet) {
44  subnet->setSharedNetwork(sharedFromThis());
45  }
46 
53  template<typename SubnetPtr>
54  void clearSharedNetwork(const SubnetPtr& subnet) {
55  subnet->setSharedNetwork(NetworkPtr());
56  }
57 };
58 
59 } // end of namespace isc::dhcp
60 } // end of namespace isc
61 
62 #endif // ASSIGNABLE_NETWORK_H
virtual ~AssignableNetwork()
Virtual destructor.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
Definition: network.h:360
Represents a network that can be associated with a subnet.
void setSharedNetwork(const SubnetPtr &subnet)
Associates a subnet with this network.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual NetworkPtr sharedFromThis()=0
Returns shared pointer to this object.
void clearSharedNetwork(const SubnetPtr &subnet)
Removes association of a subnet with a network.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition: subnet.h:455