mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[#1415] Added permutation ptr to the pool
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <dhcpsrv/address_range.h>
|
#include <dhcpsrv/address_range.h>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
@@ -113,6 +115,9 @@ private:
|
|||||||
std::mt19937 generator_;
|
std::mt19937 generator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @brief Pointer to the @c AddressRangePermutation.
|
||||||
|
typedef boost::shared_ptr<AddressRangePermutation> AddressRangePermutationPtr;
|
||||||
|
|
||||||
} // end of namespace isc::dhcp
|
} // end of namespace isc::dhcp
|
||||||
} // end of namespace isc
|
} // end of namespace isc
|
||||||
|
|
||||||
|
@@ -22,7 +22,8 @@ Pool::Pool(Lease::Type type, const isc::asiolink::IOAddress& first,
|
|||||||
const isc::asiolink::IOAddress& last)
|
const isc::asiolink::IOAddress& last)
|
||||||
:id_(getNextID()), first_(first), last_(last), type_(type),
|
:id_(getNextID()), first_(first), last_(last), type_(type),
|
||||||
capacity_(0), cfg_option_(new CfgOption()), client_class_(""),
|
capacity_(0), cfg_option_(new CfgOption()), client_class_(""),
|
||||||
last_allocated_(first), last_allocated_valid_(false) {
|
last_allocated_(first), last_allocated_valid_(false),
|
||||||
|
permutation_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pool::inRange(const isc::asiolink::IOAddress& addr) const {
|
bool Pool::inRange(const isc::asiolink::IOAddress& addr) const {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -8,13 +8,14 @@
|
|||||||
#define POOL_H
|
#define POOL_H
|
||||||
|
|
||||||
#include <asiolink/io_address.h>
|
#include <asiolink/io_address.h>
|
||||||
#include <dhcp/classify.h>
|
|
||||||
#include <dhcp/option6_pdexclude.h>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <cc/data.h>
|
#include <cc/data.h>
|
||||||
#include <cc/user_context.h>
|
#include <cc/user_context.h>
|
||||||
|
#include <dhcp/classify.h>
|
||||||
|
#include <dhcp/option6_pdexclude.h>
|
||||||
|
#include <dhcpsrv/address_range_permutation.h>
|
||||||
#include <dhcpsrv/cfg_option.h>
|
#include <dhcpsrv/cfg_option.h>
|
||||||
#include <dhcpsrv/lease.h>
|
#include <dhcpsrv/lease.h>
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -166,6 +167,13 @@ public:
|
|||||||
/// @return A pointer to unparsed pool configuration.
|
/// @return A pointer to unparsed pool configuration.
|
||||||
virtual data::ElementPtr toElement() const;
|
virtual data::ElementPtr toElement() const;
|
||||||
|
|
||||||
|
/// @brief Returns pointer to the permutation associated with the pool.
|
||||||
|
///
|
||||||
|
/// @return Pointer to the address range permutation.
|
||||||
|
AddressRangePermutationPtr getPermutation() const {
|
||||||
|
return (permutation_);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// @brief protected constructor
|
/// @brief protected constructor
|
||||||
@@ -234,6 +242,12 @@ protected:
|
|||||||
|
|
||||||
/// @brief Status of last allocated address
|
/// @brief Status of last allocated address
|
||||||
bool last_allocated_valid_;
|
bool last_allocated_valid_;
|
||||||
|
|
||||||
|
/// @brief Pointer to the permutation object.
|
||||||
|
///
|
||||||
|
/// It may be initialized for certain pools and poo types to provide
|
||||||
|
/// address randomization capabilities.
|
||||||
|
AddressRangePermutationPtr permutation_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Pool4;
|
class Pool4;
|
||||||
|
Reference in New Issue
Block a user