![]() |
Kea 3.1.1
|
Maintains an in-memory store of PingContexts. More...
#include <ping_context_store.h>
Public Member Functions | |
PingContextStore () | |
Constructor. | |
~PingContextStore ()=default | |
Destructor. | |
PingContextPtr | addContext (isc::dhcp::Lease4Ptr &lease, isc::dhcp::Pkt4Ptr &query, uint32_t min_echos, uint32_t reply_timeout, isc::hooks::ParkingLotHandlePtr &parking_lot=PingContext::EMPTY_LOT()) |
Creates a new PingContext and adds it to the store. | |
void | clear () |
Removes all contexts from the store. | |
void | deleteContext (const PingContextPtr &context) |
Removes the context from the store. | |
PingContextCollectionPtr | getAll () |
Fetches all of the contexts (in order by target) | |
PingContextPtr | getContextByAddress (const isc::asiolink::IOAddress &address) |
Fetches the context with a given target address. | |
PingContextPtr | getContextByQuery (isc::dhcp::Pkt4Ptr &query) |
Fetches the context with a given query packet. | |
PingContextCollectionPtr | getExpiredSince (const TimeStamp &since=PingContext::now()) |
Fetches the contexts in WAITING_FOR_REPLY that expired since a given time. | |
PingContextPtr | getExpiresNext () |
Fetches the context in WAITING_FOR_REPLY with the oldest expiration time that has not already passed (i.e. | |
PingContextPtr | getNextToSend () |
Fetches the context in WAITING_TO_SEND with the oldest send wait start time. | |
void | updateContext (const PingContextPtr &context) |
Updates a context in the store. | |
Maintains an in-memory store of PingContexts.
Provides essential CRUD functions for managing a collection of PingContexts. Additionally there are finders that can return contexts by target IP address, instigating query, WAITING_TO_SEND start time, WAITING_FOR_REPLY expiration time, and context state. All finders return copies of the contexts found, rather than the stored context itself.
Definition at line 136 of file ping_context_store.h.
|
inline |
Constructor.
Definition at line 140 of file ping_context_store.h.
|
default |
Destructor.
References isc::ping_check::PingContext::EMPTY_LOT(), and isc::ping_check::PingContext::now().
PingContextPtr isc::ping_check::PingContextStore::addContext | ( | isc::dhcp::Lease4Ptr & | lease, |
isc::dhcp::Pkt4Ptr & | query, | ||
uint32_t | min_echos, | ||
uint32_t | reply_timeout, | ||
isc::hooks::ParkingLotHandlePtr & | parking_lot = PingContext::EMPTY_LOT() ) |
Creates a new PingContext and adds it to the store.
lease | lease whose address is to be ping checked |
query | query that instigated the lease |
min_echos | minimum number of ECHO REQUESTs sent without replies received required to declare an address free to offer. Must be greater than zero. |
reply_timeout | maximum number of milliseconds to wait for an ECHO REPLY after an ECHO REQUEST has been sent. Must be greater than 0. |
parking_lot | parking lot in which query is parked. If empty, parking is assumed to not be employed. |
DuplicateContext | is a context for the lease address already exists in the store. |
Definition at line 24 of file ping_context_store.cc.
References isc_throw.
void isc::ping_check::PingContextStore::clear | ( | ) |
Removes all contexts from the store.
Definition at line 138 of file ping_context_store.cc.
void isc::ping_check::PingContextStore::deleteContext | ( | const PingContextPtr & | context | ) |
Removes the context from the store.
If the context does not exist in the store, it simply returns.
context | context to delete. |
Definition at line 61 of file ping_context_store.cc.
PingContextCollectionPtr isc::ping_check::PingContextStore::getAll | ( | ) |
Fetches all of the contexts (in order by target)
Definition at line 127 of file ping_context_store.cc.
PingContextPtr isc::ping_check::PingContextStore::getContextByAddress | ( | const isc::asiolink::IOAddress & | address | ) |
Fetches the context with a given target address.
address | target IP address for which to search |
Definition at line 75 of file ping_context_store.cc.
PingContextPtr isc::ping_check::PingContextStore::getContextByQuery | ( | isc::dhcp::Pkt4Ptr & | query | ) |
Fetches the context with a given query packet.
query | query for which to search |
Definition at line 84 of file ping_context_store.cc.
PingContextCollectionPtr isc::ping_check::PingContextStore::getExpiredSince | ( | const TimeStamp & | since = PingContext::now() | ) |
Fetches the contexts in WAITING_FOR_REPLY that expired since a given time.
since | timestamp to search by. Defaults to current time. |
Definition at line 111 of file ping_context_store.cc.
References isc::ping_check::PingContext::MIN_TIME().
PingContextPtr isc::ping_check::PingContextStore::getExpiresNext | ( | ) |
Fetches the context in WAITING_FOR_REPLY with the oldest expiration time that has not already passed (i.e.
is still in the future)
Definition at line 102 of file ping_context_store.cc.
References isc::ping_check::PingContext::now().
PingContextPtr isc::ping_check::PingContextStore::getNextToSend | ( | ) |
Fetches the context in WAITING_TO_SEND with the oldest send wait start time.
Definition at line 93 of file ping_context_store.cc.
References isc::ping_check::PingContext::MIN_TIME().
void isc::ping_check::PingContextStore::updateContext | ( | const PingContextPtr & | context | ) |
Updates a context in the store.
The context is assumed to already exist in the store.
context | context to update. |
InvalidOperation | if PingContext does not exist in the store. |
Definition at line 47 of file ping_context_store.cc.
References isc_throw.