 |
Kea
1.5.0
|
Go to the documentation of this file.
22 #include <boost/function.hpp>
23 #include <boost/shared_ptr.hpp>
24 #include <boost/noncopyable.hpp>
157 const uint8_t prefix_len);
170 bool prefix,
const uint8_t prefix_len);
264 std::map<Lease::Type, AllocatorPtr> allocators_;
270 int hook_index_lease4_select_;
271 int hook_index_lease6_select_;
432 const uint8_t prefix_len = 128);
443 const uint8_t prefix_len = 128);
450 const uint8_t prefix_len = 128)
const;
458 const std::vector<uint8_t>& identifier) {
471 return (
ias_.back());
529 const bool fwd_dns,
const bool rev_dns,
530 const std::string& hostname,
const bool fake_allocation,
691 const bool remove_lease,
692 const uint16_t max_unwarned_cycles = 0);
750 const bool remove_lease,
751 const uint16_t max_unwarned_cycles = 0);
829 Lease6Ptr createLease6(ClientContext6& ctx,
831 const uint8_t prefix_len,
859 allocateReservedLeases6(ClientContext6& ctx,
Lease6Collection& existing_leases);
875 allocateGlobalReservedLeases6(ClientContext6& ctx,
Lease6Collection& existing_leases);
886 removeNonmatchingReservedLeases6(ClientContext6& ctx,
897 removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
914 removeNonreservedLeases6(ClientContext6& ctx,
995 void extendLease6(ClientContext6& ctx,
Lease6Ptr lease);
1004 enum DbReclaimMode {
1007 DB_RECLAIM_LEAVE_UNCHANGED
1021 template<
typename LeasePtrType>
1022 void reclaimExpiredLease(
const LeasePtrType& lease,
1023 const bool remove_lease,
1036 template<
typename LeasePtrType>
1037 void reclaimExpiredLease(
const LeasePtrType& lease,
1050 void reclaimExpiredLease(
const Lease6Ptr& lease,
1051 const DbReclaimMode& reclaim_mode,
1064 void reclaimExpiredLease(
const Lease4Ptr& lease,
1065 const DbReclaimMode& reclaim_mode,
1086 template<
typename LeasePtrType>
1087 void reclaimLeaseInDatabase(
const LeasePtrType& lease,
1088 const bool remove_lease,
1089 const boost::function<
void (
const LeasePtrType&)>&
1090 lease_update_fun)
const;
1103 bool reclaimDeclined(
const Lease4Ptr& lease);
1116 bool reclaimDeclined(
const Lease6Ptr& lease);
1211 const std::vector<uint8_t>& identifier) {
1240 const bool fwd_dns_update,
const bool rev_dns_update,
1241 const std::string& hostname,
const bool fake_allocation);
1575 void updateLease4Information(
const Lease4Ptr& lease,
1597 bool conditionalExtendLifetime(
Lease& lease)
const;
1603 uint16_t incomplete_v4_reclamations_;
1607 uint16_t incomplete_v6_reclamations_;
1616 #endif // ALLOC_ENGINE_H
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
uint8_t prefixlen_
IPv6 prefix length.
HWAddrPtr hwaddr_
HW address from the DHCP message.
Parameters pertaining to individual IAs.
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
Lease6Collection changed_leases_
A pointer to any leases that have changed FQDN information.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
bool fwd_dns_update_
Perform forward DNS update.
Lease6Collection allocateLeases6(ClientContext6 &ctx)
Allocates IPv6 leases for a given IA container.
virtual isc::asiolink::IOAddress pickAddress(const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
returns a random address from pool of specified subnet
std::pair< isc::asiolink::IOAddress, uint8_t > ResourceType
Defines a single hint (an address + prefix-length).
virtual isc::asiolink::IOAddress pickAddress(const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
returns an address based on hash calculated from client's DUID.
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Pkt4Ptr query_
A pointer to the client's message.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
IdentifierType
Type of the host identifier.
ClientIdPtr clientid_
Client identifier from the DHCP message.
DuidPtr duid_
Client identifier.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
The IOAddress class represents an IP addresses (version agnostic)
Address/prefix allocator that gets an address based on a hash.
Lease6Collection old_leases_
A pointer to any old leases that the client had before update but are no longer valid after the updat...
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
IterativeAllocator(Lease::Type type)
default constructor
boost::shared_ptr< DUID > DuidPtr
static ConstHostPtr findGlobalReservation(ClientContext6 &ctx)
Attempts to find the host reservation for the client.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
void createIAContext()
Creates new IA context.
Defines elements for storing the names of client classes.
ConstHostPtr globalHost() const
Returns global host reservation if there is one.
Subnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
Random allocator that picks address randomly.
Lease4Ptr new_lease_
A pointer to a newly allocated lease.
IAContext()
Default constructor.
DHCPv4 and DHCPv6 allocation engine.
uint32_t iaid_
iaid IAID field from IA_NA or IA_PD that is being processed
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
Type
Type of lease or pool.
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
HintContainer hints_
client's hints
Lease::Type type_
Lease type.
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Reclaims expired IPv4 leases.
Lease4Ptr old_lease_
A pointer to an old lease that the client had before update.
virtual isc::asiolink::IOAddress pickAddress(const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
returns the next address from pools in a subnet
bool fake_allocation_
Indicates if this is a real or fake allocation.
An abstract API for lease database.
This is a base class for exceptions thrown from the DNS library module.
std::string hostname_
Hostname.
Subnet6Ptr subnet_
Subnet selected for the client by the server.
void deleteExpiredReclaimedLeases4(const uint32_t secs)
Deletes reclaimed leases expired more than specified amount of time ago.
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
std::list< IdentifierPair > IdentifierList
Map holding values to be used as host identifiers.
Lease::Type pool_type_
defines pool type allocation
AllocType
specifies allocation type
std::pair< Host::IdentifierType, std::vector< uint8_t > > IdentifierPair
A tuple holding host identifier type and value.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
base class for all address/prefix allocation algorithms
ClientContext6()
Default constructor.
std::vector< IAContext > ias_
Container holding IA specific contexts.
Structure that holds a lease for IPv6 address and/or prefix.
bool hasGlobalReservation(const IPv6Resrv &resv) const
Determines if a global reservation exists.
Subnet4Ptr subnet_
Subnet selected for the client by the server.
void addAllocatedResource(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Convenience method adding allocated prefix or address.
Address/prefix allocator that iterates over all addresses.
bool fake_allocation_
Indicates if this is a real or fake allocation.
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
AllocatorPtr getAllocator(Lease::Type type)
Returns allocator for a given pool type.
IPv6 reservation for a host.
HashedAllocator(Lease::Type type)
default constructor (does nothing)
virtual ~AllocEngine()
Destructor.
static isc::asiolink::IOAddress increaseAddress(const isc::asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len)
Returns the next address or prefix.
Lease6Collection renewLeases6(ClientContext6 &ctx)
Renews existing DHCPv6 leases for a given IA.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
RandomAllocator(Lease::Type type)
default constructor (does nothing)
Context information for the DHCPv6 leases allocation.
static void findReservation(ClientContext6 &ctx)
Attempts to find appropriate host reservation.
CalloutNextStep
Specifies allowed next steps.
std::string hostname_
Hostname.
Lease6Collection new_leases_
A collection of newly allocated leases.
virtual ~Allocator()
virtual destructor
boost::shared_ptr< AllocEngine > AllocEnginePtr
A pointer to the AllocEngine object.
void deleteExpiredReclaimedLeases6(const uint32_t secs)
Deletes reclaimed leases expired more than specified amount of time ago.
std::vector< ResourceType > HintContainer
Container for client's hints.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
boost::shared_ptr< Allocator > AllocatorPtr
defines a pointer to allocator
ConstHostPtr currentHost() const
Returns host for currently selected subnet.
static IPv6Resrv makeIPv6Resrv(const Lease6 &lease)
Creates an IPv6Resrv instance from a Lease6.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6=true)
Constructor.
Lease4Ptr allocateLease4(ClientContext4 &ctx)
Returns IPv4 lease.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Lease::Type type_
Lease type (IA or PD)
static isc::asiolink::IOAddress increasePrefix(const isc::asiolink::IOAddress &prefix, const uint8_t prefix_len)
Returns the next prefix.
ClientContext4()
Default constructor.
AllocFailed(const char *file, size_t line, const char *what)
constructor
void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Reclaims expired IPv6 leases.
virtual isc::asiolink::IOAddress pickAddress(const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)=0
picks one address out of available pools in a given subnet
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
bool isAllocated(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const
Checks if specified address or prefix was allocated.
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
a common structure for IPv4 and IPv6 leases
An exception that is thrown when allocation module fails (e.g.
void addHint(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Convenience method adding new hint.
asiolink::IOAddress requested_address_
An address that the client desires.
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
@ TYPE_NA
the lease contains non-temporary IPv6 address
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
bool rev_dns_update_
Perform reverse DNS update.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
std::set< ResourceType > ResourceContainer
Container holding allocated prefixes or addresses.
Container for storing client class names.
Context information for the DHCPv4 lease allocation.
Pkt6Ptr query_
A pointer to the client's message.
Allocator(Lease::Type pool_type)
Default constructor.
Lease4Ptr conflicting_lease_
A pointer to the object representing a lease in conflict.