Kea 3.3.1
isc::dhcp::ClientHandler Class Reference

Client race avoidance RAII handler. More...

#include <client_handler.h>

Inheritance diagram for isc::dhcp::ClientHandler:

Classes

struct  Client
 Class (aka static) types, methods and members. More...

Public Types

typedef boost::shared_ptr< ClientClientPtr
 The type of shared pointers to clients.
typedef boost::shared_ptr< ClientClientPtr
 The type of shared pointers to clients.

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.

Member Typedef Documentation

◆ ClientPtr [1/2]

typedef boost::shared_ptr<Client> isc::dhcp::ClientHandler::ClientPtr

The type of shared pointers to clients.

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

◆ ClientPtr [2/2]

typedef boost::shared_ptr<Client> isc::dhcp::ClientHandler::ClientPtr

The type of shared pointers to clients.

Definition at line 83 of file dhcp6/client_handler.h.

Constructor & Destructor Documentation

◆ ClientHandler() [1/2]

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

Public interface.

Constructor.

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

◆ ~ClientHandler() [1/2]

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

Destructor.

Releases the client if it was acquired.

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

References isc::util::ThreadPool< WorkItem, Container >::addFront(), isc::dhcp::DBG_DHCP4_BASIC, isc::dhcp::dhcp4_logger, isc::dhcp::DHCP4_PACKET_QUEUE_FULL, isc::util::MultiThreadingMgr::getMode(), isc::util::MultiThreadingMgr::getThreadPool(), isc::util::MultiThreadingMgr::instance(), and LOG_DEBUG.

Here is the call graph for this function:

◆ 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 188 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::util::str::dumpAsHex(), 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 109 of file dhcp6/client_handler.cc.

References isc::stats::StatsMgr::addValue(), isc::dhcp::bad_packet6_logger, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_PACKET_DROP_DUPLICATE, isc::stats::StatsMgr::instance(), isc_throw, and LOG_DEBUG.

Here is the call graph for this function:

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