summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/alloc_engine.h
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2016-06-06 15:04:26 +0200
committerMarcin Siodelski <marcin@isc.org>2016-06-06 15:12:29 +0200
commit17e2afb7f3e617e62b9eb90895eaaa298e3259fc (patch)
tree73684cdbf86e952930f4b4e018ea4d4d3f659de6 /src/lib/dhcpsrv/alloc_engine.h
parent[4320] Rename ResourceContainer to HintContainer. (diff)
downloadkea-17e2afb7f3e617e62b9eb90895eaaa298e3259fc.tar.xz
kea-17e2afb7f3e617e62b9eb90895eaaa298e3259fc.zip
[4320] Global set of allocated addresses in the ClientContext6.
Diffstat (limited to 'src/lib/dhcpsrv/alloc_engine.h')
-rw-r--r--src/lib/dhcpsrv/alloc_engine.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h
index 01bc568efa..434a2cf002 100644
--- a/src/lib/dhcpsrv/alloc_engine.h
+++ b/src/lib/dhcpsrv/alloc_engine.h
@@ -254,6 +254,9 @@ public:
/// @brief Container for client's hints.
typedef std::vector<ResourceType> HintContainer;
+ /// @brief Container holding allocated prefixes or addresses.
+ typedef std::set<ResourceType> ResourceContainer;
+
/// @brief A tuple holding host identifier type and value.
typedef std::pair<Host::IdentifierType, std::vector<uint8_t> > IdentifierPair;
@@ -336,6 +339,9 @@ public:
/// @brief Callout handle associated with the client's message.
hooks::CalloutHandlePtr callout_handle_;
+ /// @brief Holds addresses and prefixes allocated for all IAs.
+ ResourceContainer allocated_resources_;
+
//@}
/// @brief Parameters pertaining to individual IAs.
@@ -354,9 +360,6 @@ public:
/// allows more than one address or prefix for each IA container.
HintContainer hints_;
- /// @brief Holds addresses or prefixes allocated for this IA.
- HintContainer allocated_resources_;
-
/// @brief A pointer to any old leases that the client had before
/// update but are no longer valid after the update/allocation.
///
@@ -389,19 +392,25 @@ public:
/// @param prefix_len Prefix length. Default is 128 for addresses.
void addHint(const asiolink::IOAddress& prefix,
const uint8_t prefix_len = 128);
-
- /// @brief Convenience method adding allocated prefix or address.
- ///
- /// @param prefix Prefix or address.
- /// @param prefix_len Prefix length. Default is 128 for addresses.
- void addAllocatedResource(const asiolink::IOAddress& prefix,
- const uint8_t prefix_len = 128);
-
};
/// @brief Container holding IA specific contexts.
std::vector<IAContext> ias_;
+ /// @brief Convenience method adding allocated prefix or address.
+ ///
+ /// @param prefix Prefix or address.
+ /// @param prefix_len Prefix length. Default is 128 for addresses.
+ void addAllocatedResource(const asiolink::IOAddress& prefix,
+ const uint8_t prefix_len = 128);
+
+ /// @brief Checks if specified address or prefix was allocated.
+ ///
+ /// @param prefix Prefix or address.
+ /// @param prefix_len Prefix length. Default is 128 for addresses.
+ bool isAllocated(const asiolink::IOAddress& prefix,
+ const uint8_t prefix_len = 128) const;
+
/// @brief Conveniece function adding host identifier into
/// @ref host_identifiers_ list.
///