From: Tomek Mrugalski Date: Wed, 17 Dec 2014 19:16:54 +0000 (+0100) Subject: [3553] Added missing header. X-Git-Tag: trac3712_base~69^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bcb5369a2f46e4a95bfb18e97bc5431a8b802abb;p=thirdparty%2Fkea.git [3553] Added missing header. --- diff --git a/src/lib/dhcp/tests/pkt_captures.h b/src/lib/dhcp/tests/pkt_captures.h new file mode 100644 index 0000000000..712295f561 --- /dev/null +++ b/src/lib/dhcp/tests/pkt_captures.h @@ -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 +#include + +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); +}; + +}; +};