Kea  1.5.0
network_state.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 NETWORK_STATE_H
8 #define NETWORK_STATE_H
9 
10 #include <cc/data.h>
11 #include <dhcpsrv/subnet_id.h>
12 #include <boost/shared_ptr.hpp>
13 #include <set>
14 #include <string>
15 
16 namespace isc {
17 namespace dhcp {
18 
19 class NetworkStateImpl;
20 
57 class NetworkState {
58 public:
59 
61  enum ServerType {
63  DHCPv6
64  };
65 
67  typedef std::set<SubnetID> Subnets;
68 
70  typedef std::set<std::string> Networks;
71 
73  NetworkState(const ServerType& server_type);
74 
79  void disableService();
80 
86  void enableService();
87 
90  void enableAll();
91 
96  void delayedEnableAll(const unsigned int seconds);
97 
101  bool isServiceEnabled() const;
102 
110  bool isDelayedEnableAll() const;
111 
113 
114 
121  void selectiveDisable(const NetworkState::Subnets& subnets);
122 
129  void selectiveDisable(const NetworkState::Networks& networks);
130 
137  void selectiveEnable(const NetworkState::Subnets& subnets);
138 
145  void selectiveEnable(const NetworkState::Networks& networks);
146 
148 
149 private:
150 
152  boost::shared_ptr<NetworkStateImpl> impl_;
153 };
154 
156 typedef boost::shared_ptr<NetworkState> NetworkStatePtr;
157 
158 } // end of namespace isc::dhcp
159 } // end of namespace isc
160 
161 #endif // NETWORK_STATE_H
isc::dhcp::NetworkState::Networks
std::set< std::string > Networks
Type of the container holding collection of shared network names.
Definition: network_state.h:70
isc::dhcp::NetworkStatePtr
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
Definition: network_state.h:156
isc::dhcp::NetworkState::isServiceEnabled
bool isServiceEnabled() const
Checks if the DHCP service is globally enabled.
Definition: network_state.cc:126
isc::dhcp::NetworkState::DHCPv4
@ DHCPv4
Definition: network_state.h:62
isc::dhcp::NetworkState::DHCPv6
@ DHCPv6
Definition: network_state.h:63
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::dhcp::NetworkState::Subnets
std::set< SubnetID > Subnets
Type of the container holding collection of subnet identifiers.
Definition: network_state.h:67
isc::dhcp::NetworkState::selectiveDisable
void selectiveDisable(const NetworkState::Subnets &subnets)
Disable DHCP service for selected subnets.
Definition: network_state.cc:136
isc::dhcp::NetworkState::isDelayedEnableAll
bool isDelayedEnableAll() const
Checks if delayed enabling of DHCP services is scheduled.
Definition: network_state.cc:131
isc::dhcp::NetworkState
Holds information about DHCP service enabling status.
Definition: network_state.h:57
isc::dhcp::NetworkState::NetworkState
NetworkState(const ServerType &server_type)
Constructor.
Definition: network_state.cc:101
isc::dhcp::NetworkState::ServerType
ServerType
DHCP server type.
Definition: network_state.h:61
data.h
subnet_id.h
isc::dhcp::NetworkState::selectiveEnable
void selectiveEnable(const NetworkState::Subnets &subnets)
Enable DHCP service for selected subnets.
Definition: network_state.cc:146
isc::dhcp::NetworkState::enableService
void enableService()
Globally enables DHCP service.
Definition: network_state.cc:111
isc::dhcp::NetworkState::delayedEnableAll
void delayedEnableAll(const unsigned int seconds)
Schedules enabling DHCP service in the future.
Definition: network_state.cc:121
isc::dhcp::NetworkState::enableAll
void enableAll()
Enables DHCP service globally and for scopes which have been disabled as a result of control command.
Definition: network_state.cc:116
isc::dhcp::NetworkState::disableService
void disableService()
Globally disables DHCP service.
Definition: network_state.cc:106