--- /dev/null
+/*
+ The software in this package is distributed under the GNU General
+ Public License version 2 (with a special exception described below).
+
+ A copy of GNU General Public License (GPL) is included in this distribution,
+ in the file COPYING.GPL.
+
+ As a special exception, if other files instantiate templates or use macros
+ or inline functions from this file, or you compile this file and link it
+ with other works to produce a work based on this file, this file
+ does not by itself cause the resulting work to be covered
+ by the GNU General Public License.
+
+ However the source code for this file must still be made available
+ in accordance with section (3) of the GNU General Public License.
+
+ This exception does not invalidate any other reasons why a work based
+ on this file might be covered by the GNU General Public License.
+
+ Christian Herdtweck, Intra2net AG 2015
+ */
+
+#include "ip/ipheader.h"
+#include <sstream>
+
+std::string IpHeader::to_string() const
+{
+ std::stringstream buf;
+ buf << "[IP header: from " << get_source_address().to_string() << " to "
+ << get_destination_address().to_string() << "]";
+ return buf.str();
+}
+
+// (created using vim -- the world's best text editor)
+
#define IPHEADER_H
#include <stdint.h>
-#include <istream>
#include <boost/shared_ptr.hpp>
#include <boost/asio/ip/address.hpp>
virtual ~IpHeader() {}
- virtual std::string to_string() const
- { return "[IP header]"; }
+ virtual std::string to_string() const;
};
typedef boost::shared_ptr<IpHeader> IpHeaderPtr;
add_executable(test_ipv4header
test_ipv4header.cpp
${CMAKE_SOURCE_DIR}/src/boost_assert_handler.cpp
+ ${CMAKE_SOURCE_DIR}/src/ip/ipheader.cpp
${CMAKE_SOURCE_DIR}/src/ip/ipv4header.cpp
${CMAKE_SOURCE_DIR}/src/host/messagepayload.cpp
)
add_executable(test_ipv6header
test_ipv6header.cpp
${CMAKE_SOURCE_DIR}/src/boost_assert_handler.cpp
+ ${CMAKE_SOURCE_DIR}/src/ip/ipheader.cpp
${CMAKE_SOURCE_DIR}/src/ip/ipv6header.cpp
${CMAKE_SOURCE_DIR}/src/host/messagepayload.cpp
)