Kea 3.1.1
isc::ping_check::PingContextStore Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PingContextStore()

isc::ping_check::PingContextStore::PingContextStore ( )
inline

Constructor.

Definition at line 140 of file ping_context_store.h.

◆ ~PingContextStore()

isc::ping_check::PingContextStore::~PingContextStore ( )
default

Destructor.

References isc::ping_check::PingContext::EMPTY_LOT(), and isc::ping_check::PingContext::now().

+ Here is the call graph for this function:

Member Function Documentation

◆ addContext()

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.

Parameters
leaselease whose address is to be ping checked
queryquery that instigated the lease
min_echosminimum number of ECHO REQUESTs sent without replies received required to declare an address free to offer. Must be greater than zero.
reply_timeoutmaximum number of milliseconds to wait for an ECHO REPLY after an ECHO REQUEST has been sent. Must be greater than 0.
parking_lotparking lot in which query is parked. If empty, parking is assumed to not be employed.
Returns
pointer to the newly created context
Exceptions
DuplicateContextis a context for the lease address already exists in the store.

Definition at line 24 of file ping_context_store.cc.

References isc_throw.

◆ clear()

void isc::ping_check::PingContextStore::clear ( )

Removes all contexts from the store.

Definition at line 138 of file ping_context_store.cc.

◆ deleteContext()

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.

Parameters
contextcontext to delete.

Definition at line 61 of file ping_context_store.cc.

◆ getAll()

PingContextCollectionPtr isc::ping_check::PingContextStore::getAll ( )

Fetches all of the contexts (in order by target)

Returns
a collection of all contexts in the store.

Definition at line 127 of file ping_context_store.cc.

◆ getContextByAddress()

PingContextPtr isc::ping_check::PingContextStore::getContextByAddress ( const isc::asiolink::IOAddress & address)

Fetches the context with a given target address.

Parameters
addresstarget IP address for which to search
Returns
pointer to the matching PingContext or an empty pointer if not found.

Definition at line 75 of file ping_context_store.cc.

◆ getContextByQuery()

PingContextPtr isc::ping_check::PingContextStore::getContextByQuery ( isc::dhcp::Pkt4Ptr & query)

Fetches the context with a given query packet.

Parameters
queryquery for which to search
Returns
pointer to the matching PingContext or an empty pointer if not found.

Definition at line 84 of file ping_context_store.cc.

◆ getExpiredSince()

PingContextCollectionPtr isc::ping_check::PingContextStore::getExpiredSince ( const TimeStamp & since = PingContext::now())

Fetches the contexts in WAITING_FOR_REPLY that expired since a given time.

Parameters
sincetimestamp to search by. Defaults to current time.
Returns
a collection of the matching contexts, ordered by expiration time.

Definition at line 111 of file ping_context_store.cc.

References isc::ping_check::PingContext::MIN_TIME().

+ Here is the call graph for this function:

◆ getExpiresNext()

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)

Returns
pointer to the matching PingContext or an empty pointer if not found.

Definition at line 102 of file ping_context_store.cc.

References isc::ping_check::PingContext::now().

+ Here is the call graph for this function:

◆ getNextToSend()

PingContextPtr isc::ping_check::PingContextStore::getNextToSend ( )

Fetches the context in WAITING_TO_SEND with the oldest send wait start time.

Returns
pointer to the matching PingContext or an empty pointer if not found.

Definition at line 93 of file ping_context_store.cc.

References isc::ping_check::PingContext::MIN_TIME().

+ Here is the call graph for this function:

◆ updateContext()

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.

Parameters
contextcontext to update.
Exceptions
InvalidOperationif PingContext does not exist in the store.

Definition at line 47 of file ping_context_store.cc.

References isc_throw.


The documentation for this class was generated from the following files: