Commit fc1671c6 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰 Committed by Michal Nowikowski

[#283,!135] Changes after review: PktPtr moved to dhcp/pkt.h

parent c6853147
......@@ -118,14 +118,14 @@ Receiver::readPktFromSocket() {
} catch (const Exception& e) {
cerr << "Failed to receive DHCP packet: " << e.what() << endl;
}
if (!pkt) {
return nullptr;
if (pkt) {
/// @todo: Add packet exception handling here. Right now any
/// malformed packet will cause perfdhcp to abort.
pkt->unpack();
}
/// @todo: Add packet exception handling here. Right now any
/// malformed packet will cause perfdhcp to abort.
pkt->unpack();
return pkt;
return (pkt);
}
void
......
......@@ -10,8 +10,7 @@
#include <perfdhcp/better_socket.h>
#include <perfdhcp/command_options.h>
#include <dhcp/pkt4.h>
#include <dhcp/pkt6.h>
#include <dhcp/pkt.h>
#include <util/threads/thread.h>
#include <queue>
......@@ -22,8 +21,6 @@
namespace isc {
namespace perfdhcp {
typedef boost::shared_ptr<isc::dhcp::Pkt> PktPtr;
/// \brief A receviving DHCP packets class.
///
/// Receiver can be used in two modes: single-thread and multi-thread.
......@@ -48,7 +45,7 @@ private:
std::unique_ptr<util::thread::Thread> recv_thread_;
/// \brief Queue for passing packets from receiver thread to main thread.
std::queue<PktPtr> pkt_queue_;
std::queue<dhcp::PktPtr> pkt_queue_;
/// \brief Mutex for controlling access to the queue.
std::mutex pkt_queue_mutex_;
......@@ -82,7 +79,7 @@ public:
///
/// In single-thread mode it reads directly from the socket.
/// In multi-thread mode it reads packets from the queue.
PktPtr getPkt();
dhcp::PktPtr getPkt();
private:
/// \brief Receiving thread main function.
......@@ -94,7 +91,7 @@ private:
void receivePackets();
/// \brief Read a packet directly from the socket.
PktPtr readPktFromSocket();
dhcp::PktPtr readPktFromSocket();
};
}
......
......@@ -785,6 +785,9 @@ private:
HWAddrPtr& storage);
};
/// @brief A pointer to either Pkt4 or Pkt6 packet
typedef boost::shared_ptr<isc::dhcp::Pkt> PktPtr;
}; // namespace isc::dhcp
}; // namespace isc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment