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/hashed_index.hpp>
14#include <boost/multi_index/member.hpp>
15#include <boost/shared_ptr.hpp>
33 return (boost::make_shared<Continuation>(cont));
56 std::vector<uint8_t> duid_;
59 std::thread::id thread_;
75 typedef boost::shared_ptr<Client> ClientPtr;
78 typedef boost::multi_index_container<
84 boost::multi_index::indexed_by<
87 boost::multi_index::hashed_unique<
90 boost::multi_index::member<
91 Client, std::vector<uint8_t>, &Client::duid_
103 static ClientPtr lookup(
const DuidPtr& duid);
110 static void add(
const ClientPtr& client);
117 static void del(
const DuidPtr& duid);
122 static std::mutex mutex_;
125 static ClientContainer clients_;
Client race avoidance RAII handler.
virtual ~ClientHandler()
Destructor.
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< DUID > DuidPtr
ContinuationPtr makeContinuation(Continuation &&cont)
Continuation factory.
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Defines the logger used by the top-level component of kea-lfc.