Kea: isc::ping_check::PingContextStore Class Reference

| Kea 3.2.0-git

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 125 of file ping_context_store.h.

## Constructor & Destructor Documentation

## ◆ PingContextStore()

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

Constructor.

Definition at line 129 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

  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.

Returns
  pointer to the newly created context

Exceptions

  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.

## ◆ 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

  context | context 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

  address | target 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

  query | query 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

  since | timestamp 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

  context | context to update.

Exceptions

  InvalidOperation | if 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:

- ping_context_store.h
- ping_context_store.cc