Kea  2.3.3-git
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. More...
 
 ClientHandler ()
 Public interface. More...
 
virtual ~ClientHandler ()
 Destructor. More...
 
virtual ~ClientHandler ()
 Destructor. More...
 
bool tryLock (Pkt6Ptr query, ContinuationPtr cont=ContinuationPtr())
 Tries to acquires a client. More...
 
bool tryLock (Pkt4Ptr query, ContinuationPtr cont=ContinuationPtr())
 Tries to acquires a client. More...
 

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 ( 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::util::ThreadPool< WorkItem, Container >::addFront(), isc::stats::StatsMgr::addValue(), isc::dhcp::bad_packet6_logger, isc::dhcp::DBG_DHCP6_BASIC, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_PACKET_DROP_DUPLICATE, isc::dhcp::DHCP6_PACKET_QUEUE_FULL, isc::util::MultiThreadingMgr::getMode(), isc::util::MultiThreadingMgr::getThreadPool(), isc::stats::StatsMgr::instance(), isc_throw, and LOG_DEBUG.

+ Here is the call graph for this function:

◆ tryLock() [2/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:

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