Kea 2.5.8
isc::dhcp::ClientHandler Class Reference

Client race avoidance RAII handler. More...

#include <client_handler.h>

+ Inheritance diagram for isc::dhcp::ClientHandler:

Public Member Functions

 ClientHandler ()
 Public interface.
 
 ClientHandler ()
 Public interface.
 
virtual ~ClientHandler ()
 Destructor.
 
virtual ~ClientHandler ()
 Destructor.
 
bool tryLock (Pkt4Ptr query, ContinuationPtr cont=ContinuationPtr())
 Tries to acquires a client.
 
bool tryLock (Pkt6Ptr query, ContinuationPtr cont=ContinuationPtr())
 Tries to acquires a client.
 

Detailed Description

Client race avoidance RAII handler.

Definition at line 38 of file dhcp4/client_handler.h.

Constructor & Destructor Documentation

◆ ClientHandler() [1/2]

isc::dhcp::ClientHandler::ClientHandler ( )

Public interface.

Constructor.

Definition at line 135 of file dhcp4/client_handler.cc.

◆ ~ClientHandler() [1/2]

isc::dhcp::ClientHandler::~ClientHandler ( )
virtual

◆ ClientHandler() [2/2]

isc::dhcp::ClientHandler::ClientHandler ( )

Public interface.

Constructor.

◆ ~ClientHandler() [2/2]

virtual isc::dhcp::ClientHandler::~ClientHandler ( )
virtual

Destructor.

Releases the client if it was acquired.

Member Function Documentation

◆ tryLock() [1/2]

bool isc::dhcp::ClientHandler::tryLock ( Pkt4Ptr  query,
ContinuationPtr  cont = ContinuationPtr() 
)

Tries to acquires a client.

Lookup the client:

  • if not found insert the client in the clients map and return true
  • if found, if has a continuation put it in the holder, and return false
Parameters
queryThe query from the client.
contThe continuation in the case the client was held.
Returns
true if the client was acquired, false if there is already a query from the same client.

Definition at line 164 of file dhcp4/client_handler.cc.

References isc::stats::StatsMgr::addValue(), isc::dhcp::bad_packet4_logger, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP4_PACKET_DROP_0011, isc::dhcp::DHCP4_PACKET_DROP_0012, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::stats::StatsMgr::instance(), isc_throw, and LOG_DEBUG.

Referenced by isc::dhcp::Dhcpv4Srv::processDhcp4Query(), and isc::dhcp::Dhcpv6Srv::processDhcp6Query().

+ Here is the call graph for this function:

◆ tryLock() [2/2]

bool isc::dhcp::ClientHandler::tryLock ( Pkt6Ptr  query,
ContinuationPtr  cont = ContinuationPtr() 
)

Tries to acquires a client.

Lookup the client:

  • if not found insert the client in the clients map and return true
  • if found, if has a continuation put it in the holder, and return false
Parameters
queryThe query from the client.
contThe continuation in the case the client was held.
Returns
true if the client was acquired, false if there is already a query from the same client.

Definition at line 86 of file dhcp6/client_handler.cc.

References isc::dhcp::bad_packet6_logger, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_PACKET_DROP_DUPLICATE, isc_throw, and LOG_DEBUG.


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