]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3553] Added missing header.
authorTomek Mrugalski <tomasz@isc.org>
Wed, 17 Dec 2014 19:16:54 +0000 (20:16 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 31 Dec 2014 13:08:02 +0000 (14:08 +0100)
src/lib/dhcp/tests/pkt_captures.h [new file with mode: 0644]

diff --git a/src/lib/dhcp/tests/pkt_captures.h b/src/lib/dhcp/tests/pkt_captures.h
new file mode 100644 (file)
index 0000000..712295f
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <dhcp/pkt4.h>
+#include <dhcp/pkt6.h>
+
+namespace isc {
+namespace test {
+
+class PktCaptures {
+public:
+
+    /// @brief returns captured DISCOVER that went through a relay
+    ///
+    /// See method code for a detailed explanation. This is a discover from
+    /// docsis3.0 device (Cable Modem)
+    ///
+    /// @return relayed DISCOVER
+    static isc::dhcp::Pkt4Ptr captureRelayedDiscover();
+
+    /// @brief returns captured DISCOVER that went through a relay
+    ///
+    /// See method code for a detailed explanation. This is a discover from
+    /// eRouter1.0 device (CPE device integrated with cable modem)
+    ///
+    /// @return relayed DISCOVER
+    static isc::dhcp::Pkt4Ptr captureRelayedDiscover2();
+
+    // see wireshark.cc for descriptions
+    // The descriptions are too large and too closely related to the
+    // code, so it is kept in .cc rather than traditionally in .h
+    static isc::dhcp::Pkt6Ptr captureSimpleSolicit();
+    static isc::dhcp::Pkt6Ptr captureRelayedSolicit();
+    static isc::dhcp::Pkt6Ptr captureDocsisRelayedSolicit();
+    static isc::dhcp::Pkt6Ptr captureeRouterRelayedSolicit();
+    static isc::dhcp::Pkt6Ptr captureCableLabsShortVendorClass();
+
+protected:
+    /// @brief Auxiliary method that sets Pkt6 fields
+    ///
+    /// Used to reconstruct captured packets. Sets UDP ports, interface names,
+    /// and other fields to some believable values.
+    /// @param pkt packet that will have its fields set
+    static void captureSetDefaultFields(const isc::dhcp::Pkt6Ptr& pkt);
+
+
+    /// @brief generates a DHCPv4 packet based on provided hex string
+    ///
+    /// @return created packet
+    static isc::dhcp::Pkt4Ptr packetFromCapture(const std::string& hex_string);
+
+    /// @brief sets default fields in a captured packet
+    ///
+    /// Sets UDP ports, addresses and interface.
+    ///
+    /// @param pkt packet to have default fields set
+    static void captureSetDefaultFields(const isc::dhcp::Pkt4Ptr& pkt);
+};
+
+};
+};