Kea 2.2.0
network_state.h
Go to the documentation of this file.
1// Copyright (C) 2017-2021 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/scoped_ptr.hpp>
13#include <boost/shared_ptr.hpp>
14#include <set>
15#include <mutex>
16#include <string>
17
18namespace isc {
19namespace dhcp {
20
21class NetworkStateImpl;
22
71public:
72
76 DHCPv6
77 };
78
84 enum class Origin {
86 USER_COMMAND,
88 HA_COMMAND,
91 DB_CONNECTION
92 };
93
95 typedef std::set<SubnetID> Subnets;
96
98 typedef std::set<std::string> Networks;
99
101 NetworkState(const ServerType& server_type);
102
110 void disableService(const NetworkState::Origin& origin);
111
119 void enableService(const NetworkState::Origin& origin);
120
127 void reset(const NetworkState::Origin& type);
128
133 void enableAll(const NetworkState::Origin& origin);
134
140 void delayedEnableAll(const unsigned int seconds,
141 const NetworkState::Origin& origin);
142
146 bool isServiceEnabled() const;
147
155 bool isDelayedEnableAll() const;
156
158
159
166 void selectiveDisable(const NetworkState::Subnets& subnets);
167
174 void selectiveDisable(const NetworkState::Networks& networks);
175
182 void selectiveEnable(const NetworkState::Subnets& subnets);
183
190 void selectiveEnable(const NetworkState::Networks& networks);
191
193
194private:
195
197 boost::shared_ptr<NetworkStateImpl> impl_;
198
200 const boost::scoped_ptr<std::mutex> mutex_;
201};
202
204typedef boost::shared_ptr<NetworkState> NetworkStatePtr;
205
206} // end of namespace isc::dhcp
207} // end of namespace isc
208
209#endif // NETWORK_STATE_H
Holds information about DHCP service enabling status.
Definition: network_state.h:70
void enableService(const NetworkState::Origin &origin)
Enable the DHCP service state for respective transition origin.
void selectiveDisable(const NetworkState::Subnets &subnets)
Disable DHCP service for selected subnets.
std::set< SubnetID > Subnets
Type of the container holding collection of subnet identifiers.
Definition: network_state.h:95
void disableService(const NetworkState::Origin &origin)
Disable the DHCP service state for respective transition origin.
void delayedEnableAll(const unsigned int seconds, const NetworkState::Origin &origin)
Schedules enabling DHCP service in the future.
std::set< std::string > Networks
Type of the container holding collection of shared network names.
Definition: network_state.h:98
void enableAll(const NetworkState::Origin &origin)
Enables DHCP service globally and for scopes which have been disabled as a result of control command.
void reset(const NetworkState::Origin &type)
Reset internal counters.
bool isDelayedEnableAll() const
Checks if delayed enabling of DHCP services is scheduled.
void selectiveEnable(const NetworkState::Subnets &subnets)
Enable DHCP service for selected subnets.
Origin
Origin of the network state transition.
Definition: network_state.h:84
NetworkState(const ServerType &server_type)
Constructor.
ServerType
DHCP server type.
Definition: network_state.h:74
bool isServiceEnabled() const
Checks if the DHCP service is globally enabled.
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
Defines the logger used by the top-level component of kea-lfc.