7#ifndef CLIENT_HANDLER_H
8#define CLIENT_HANDLER_H
11#include <boost/noncopyable.hpp>
12#include <boost/multi_index_container.hpp>
13#include <boost/multi_index/composite_key.hpp>
14#include <boost/multi_index/hashed_index.hpp>
15#include <boost/multi_index/member.hpp>
16#include <boost/shared_ptr.hpp>
34 return (boost::make_shared<Continuation>(cont));
92 typedef boost::multi_index_container<
98 boost::multi_index::indexed_by<
101 boost::multi_index::hashed_unique<
104 boost::multi_index::member<
109 > ClientByIdContainer;
112 typedef boost::multi_index_container<
118 boost::multi_index::indexed_by<
121 boost::multi_index::hashed_unique<
124 boost::multi_index::composite_key<
126 boost::multi_index::member<
129 boost::multi_index::member<
135 > ClientByHWAddrContainer;
158 static void addById(
const ClientPtr& client);
165 static void addByHWAddr(
const ClientPtr& client);
179 static void del(
const HWAddrPtr& hwaddr);
184 static std::mutex mutex_;
187 static ClientByIdContainer clients_client_id_;
190 static ClientByHWAddrContainer clients_hwaddr_;
239 void unLockByHWAddr();
virtual ~ClientHandler()
Destructor.
boost::shared_ptr< Client > ClientPtr
The type of shared pointers to clients.
bool tryLock(Pkt4Ptr query, ContinuationPtr cont=ContinuationPtr())
Tries to acquires a client.
ClientHandler()
Public interface.
std::function< void()> Continuation
Define the type of packet processing continuation.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
ContinuationPtr makeContinuation(Continuation &&cont)
Continuation factory.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
Defines the logger used by the top-level component of kea-lfc.
Class (aka static) types, methods and members.
uint16_t htype_
Cached hardware type.
uint32_t transid_
Cached transaction ID.
std::vector< uint8_t > client_id_
Cached binary client ID.
Client(Pkt4Ptr query, ClientIdPtr client_id, HWAddrPtr hwaddr)
Constructor.
Pkt4Ptr next_query_
The next query.
ContinuationPtr cont_
The continuation to process next query for the client.
std::vector< uint8_t > hwaddr_
Cached binary hardware address.
uint8_t msg_type_
Cached message type.
std::thread::id thread_
The ID of the thread processing the query.