14#include <boost/scoped_ptr.hpp>
91 void serveScope(
const std::string& scope_name);
107 void serveScopes(
const std::vector<std::string>& scopes);
211 void serveScopeInternal(
const std::string& scope_name);
222 void serveScopeOnlyInternal(
const std::string& scope_name);
231 void serveScopesInternal(
const std::vector<std::string>& scopes);
239 void serveDefaultScopesInternal();
250 void serveFailoverScopesInternal();
255 void serveNoScopesInternal();
264 bool amServingScopeInternal(
const std::string& scope_name)
const;
271 std::set<std::string> getServedScopesInternal()
const;
287 template<
typename QueryPtrType>
288 bool inScopeInternal(
const QueryPtrType& query, std::string& scope_class)
const;
330 uint8_t
loadBalanceHash(
const uint8_t* key,
const size_t key_len)
const;
359 std::vector<HAConfig::PeerConfigPtr>
peers_;
DHCP query filtering class.
void serveScopes(const std::vector< std::string > &scopes)
Enables selected scopes.
bool inScope(const dhcp::Pkt4Ptr &query4, std::string &scope_class) const
Checks if this server should process the DHCPv4 query.
bool amServingScope(const std::string &scope_name) const
Checks if this server instance is configured to process traffic belonging to a particular scope.
std::string makeScopeClass(const std::string &scope_name) const
Returns scope class name for the specified scope name.
boost::scoped_ptr< std::mutex > mutex_
Mutex to protect the internal state.
void serveFailoverScopes()
Enable scopes required in failover case.
uint8_t loadBalanceHash(const uint8_t *key, const size_t key_len) const
Compute load balancing hash.
void validateScopeName(const std::string &scope_name) const
Checks if the scope name matches a name of any of the configured servers.
int active_servers_
Number of the active servers in the given HA mode.
HAConfigPtr config_
Pointer to the HA configuration.
void serveScopeOnly(const std::string &scope_name)
Enable scope and disable all other scopes.
int loadBalance(const dhcp::Pkt4Ptr &query4) const
Performs load balancing of the DHCPv4 queries.
static bool isHaType(const dhcp::Pkt4Ptr &query4)
Determines if a DHCPv4 query is a message type HA should process.
void serveDefaultScopes()
Serve default scopes for the given HA mode.
void serveNoScopes()
Disables all scopes.
std::set< std::string > getServedScopes() const
Returns served scopes.
void serveScope(const std::string &scope_name)
Enable scope.
std::vector< HAConfig::PeerConfigPtr > peers_
Vector of HA peers configurations.
std::map< std::string, bool > scopes_
Holds mapping of the scope names to the flag which indicates if the scopes are enabled or disabled.
QueryFilter(const HAConfigPtr &config)
Constructor.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
Defines the logger used by the top-level component of kea-lfc.