summaryrefslogtreecommitdiffstats
path: root/src/bin/perfdhcp/perf_socket.h
diff options
context:
space:
mode:
authorMichal Nowikowski <godfryd@isc.org>2019-02-19 14:37:00 +0100
committerMichal Nowikowski <godfryd@isc.org>2019-02-19 21:54:31 +0100
commit98e64a69d5271db2a6f4944b7c377ee6488a1a42 (patch)
tree24f03ada13c1a36c63c57919879033da9aba0a93 /src/bin/perfdhcp/perf_socket.h
parentperfdhcp avalanche: completed avalanche unit tests (diff)
downloadkea-98e64a69d5271db2a6f4944b7c377ee6488a1a42.tar.xz
kea-98e64a69d5271db2a6f4944b7c377ee6488a1a42.zip
perfdhcp avalache: improvements after review
- simplified differentiating for IP version and exchange types - added more comments - fixed unittest for receiver by mocking socket - added option for building perfdhcp by hammer - added workaround for compiler bug that cannot handle enum class as a key to std::unordered_map - hidden warnings from boost by changing compiler flag from -I<boost-path> to -isystem <boost-path> - removed unused options_ field from StatsMgr class
Diffstat (limited to 'src/bin/perfdhcp/perf_socket.h')
-rw-r--r--src/bin/perfdhcp/perf_socket.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/perfdhcp/perf_socket.h b/src/bin/perfdhcp/perf_socket.h
index 83f8b971b8..bdb18ee7bb 100644
--- a/src/bin/perfdhcp/perf_socket.h
+++ b/src/bin/perfdhcp/perf_socket.h
@@ -17,11 +17,18 @@
namespace isc {
namespace perfdhcp {
+/// \brief Socket wrapper structure.
+///
+/// This is a base class that is inherited by PerfSocket
+/// and unit tests derived that. This way it allows mocking
+/// out socket operations and avoid using real network
+/// interfaces.
class BasePerfSocket : public dhcp::SocketInfo {
public:
/// Interface index.
uint16_t ifindex_;
+ /// \brief Default constructor of BasePerfSocket.
BasePerfSocket() :
SocketInfo(asiolink::IOAddress("127.0.0.1"), 0, 0),
ifindex_(0) {}
@@ -29,10 +36,19 @@ public:
/// \brief Destructor of the socket wrapper class.
virtual ~BasePerfSocket() = default;
+ /// \brief See description of this method in PerfSocket class below.
virtual dhcp::Pkt4Ptr receive4(uint32_t timeout_sec, uint32_t timeout_usec) = 0;
+
+ /// \brief See description of this method in PerfSocket class below.
virtual dhcp::Pkt6Ptr receive6(uint32_t timeout_sec, uint32_t timeout_usec) = 0;
+
+ /// \brief See description of this method in PerfSocket class below.
virtual bool send(const dhcp::Pkt4Ptr& pkt) = 0;
+
+ /// \brief See description of this method in PerfSocket class below.
virtual bool send(const dhcp::Pkt6Ptr& pkt) = 0;
+
+ /// \brief See description of this method in PerfSocket class below.
virtual dhcp::IfacePtr getIface() = 0;
};