29 uint8_t msg_type = holder->msg_type_;
31 <<
" (" <<
static_cast<int>(msg_type) <<
")"
32 <<
", trans_id=0x" << hex << holder->transid_ << dec;
33 if (holder->relayed_) {
42 :
thread_(this_thread::get_id()) {
52 duid_ = client_id->getDuid();
55 relayed_ = !query->relay_info_.empty();
58mutex ClientHandler::mutex_;
60ClientHandler::ClientContainer ClientHandler::clients_;
63ClientHandler::lookup(
const DuidPtr& duid) {
69 auto it = clients_.find(duid->getDuid());
70 if (it == clients_.end()) {
77ClientHandler::add(
const ClientPtr& client) {
84 clients_.insert(client);
88ClientHandler::del(
const DuidPtr& duid) {
91 isc_throw(InvalidParameter,
"null duid in ClientHandler::del");
95 clients_.erase(duid->getDuid());
103 lock_guard<mutex> lk(mutex_);
118 const DuidPtr& duid = query->getClientId();
123 if (duid->getDuid().empty()) {
127 client_.reset(
new Client(query, duid));
133 lock_guard<mutex> lk(mutex_);
134 holder = lookup(duid);
142 next_query = holder->next_query_;
143 holder->next_query_ = query;
144 holder->cont_ = cont;
155 .arg(
"duid[" + duid->toText() +
"]")
156 .arg(next_query->toText())
157 .arg(this_thread::get_id())
158 .arg(summary(holder))
159 .arg(holder->thread_);
161 static_cast<int64_t
>(1));
163 static_cast<int64_t
>(1));
170 .arg(
"duid[" + duid->toText() +
"]")
171 .arg(query->toText())
172 .arg(this_thread::get_id())
173 .arg(summary(holder))
174 .arg(holder->thread_);
176 static_cast<int64_t
>(1));
178 static_cast<int64_t
>(1));
185ClientHandler::lock() {
195ClientHandler::unLock() {
204 if (!client_ || !client_->cont_) {
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
A generic exception that is thrown when an unexpected error condition occurs.
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.
const char * getName() const
Returns name of the DHCPv6 message.
static StatsMgr & instance()
Statistics Manager accessor method.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
ThreadPool< std::function< void()> > & getThreadPool()
Get the dhcp thread pool.
bool getMode() const
Get the multi-threading mode.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
isc::log::Logger bad_packet6_logger(DHCP6_BAD_PACKET_LOGGER_NAME)
Logger for rejected packets.
boost::shared_ptr< DUID > DuidPtr
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
const int DBG_DHCP6_BASIC
Debug level used to trace basic operations within the code.
isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME)
Base logger for DHCPv6 server.
const isc::log::MessageID DHCP6_PACKET_DROP_DUPLICATE
const isc::log::MessageID DHCP6_PACKET_QUEUE_FULL
const int DBGLVL_PKT_HANDLING
This debug level is reserved for logging the details of packet handling, such as dropping the packet ...
Defines the logger used by the top-level component of kea-lfc.
Class (aka static) types, methods and members.
uint32_t transid_
Cached transaction ID.
Client(Pkt4Ptr query, ClientIdPtr client_id, HWAddrPtr hwaddr)
Constructor.
std::vector< uint8_t > duid_
Cached binary client ID.
bool relayed_
Cached relayed flag.
uint8_t msg_type_
Cached message type.
std::thread::id thread_
The ID of the thread processing the query.
bool addFront(const WorkItemPtr &item)
add a work item to the thread pool at front