Packets: added tests for dump methods
tho [Wed, 18 Feb 2009 09:31:18 +0000 (09:31 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1122 270642c3-0616-0410-b53a-bc976706d245

15 files changed:
Packets/80211Bundle/RadiotapPacket.test.cc
Packets/80211Bundle/WLANPacket.test.cc
Packets/80221Bundle/MIHPacket.hh
Packets/80221Bundle/MIHPacket.test.cc
Packets/80221Bundle/TLVPacket.test.cc
Packets/DefaultBundle/EthernetPacket.test.cc
Packets/DefaultBundle/ICMPv6Packet.test.cc
Packets/DefaultBundle/IPv4Packet.test.cc
Packets/DefaultBundle/IPv6Extensions.test.cc
Packets/DefaultBundle/IPv6Packet.test.cc
Packets/DefaultBundle/LlcSnapPacket.test.cc
Packets/DefaultBundle/RTPPacket.test.cc
Packets/DefaultBundle/UDPPacket.test.cc
Packets/MPEGDVBBundle/MPESection.test.cc
Packets/MPEGDVBBundle/TransportPacket.test.cc

index 99aeb4a..33ee3fa 100644 (file)
@@ -92,6 +92,9 @@ BOOST_AUTO_UNIT_TEST(RadiotapPacket_packet)
     BOOST_CHECK_EQUAL( p->channelOptions().staticTurbo(), false);
     BOOST_CHECK_EQUAL( p->channelOptions().halfRateChannel(), false);
     BOOST_CHECK_EQUAL( p->channelOptions().quarterRateChannel(), false);
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(RadiotapPacket_create)
index ed1c889..e91cdc8 100644 (file)
@@ -58,25 +58,28 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
 
     BOOST_CHECK_EQUAL( p->duration(),       0u    );
 
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->dataFrame().destinationAddress().value(),
             senf::MACAddress::from_string("00:18:4d:6e:78:48") );
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->dataFrame().sourceAddress().value(),
             senf::MACAddress::from_string("00:0b:6b:57:06:b0") );
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->dataFrame().bssid().value(),
             senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") );
 
-    BOOST_CHECK_EQUAL( 
-            p->dataFrame().bssid().value(), 
+    BOOST_CHECK_EQUAL(
+            p->dataFrame().bssid().value(),
             p->dataFrame().receiverAddress().value() );
-    BOOST_CHECK_EQUAL( 
-            p->dataFrame().transmitterAddress().value(), 
+    BOOST_CHECK_EQUAL(
+            p->dataFrame().transmitterAddress().value(),
             p->dataFrame().sourceAddress().value() );
 
     BOOST_CHECK_EQUAL( p->dataFrame().sequenceNumber(), 3u );
     BOOST_CHECK_EQUAL( p->dataFrame().fragmentNumber(), 0u );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 
@@ -133,16 +136,16 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_beaconFrame_packet)
 
     BOOST_CHECK_EQUAL( p->is_mgtFrame(),    true  );
 
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->mgtFrame().destinationAddress().value(),
             senf::MACAddress::from_string("ff:ff:ff:ff:ff:ff") );
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->mgtFrame().sourceAddress().value(),
             senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") );
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->mgtFrame().bssid().value(),
             senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") );
-    
+
     BOOST_CHECK_EQUAL( p->mgtFrame().sequenceNumber(), 302u );
     BOOST_CHECK_EQUAL( p->mgtFrame().fragmentNumber(), 0u   );
 
@@ -194,7 +197,7 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_packet)
 
     BOOST_CHECK_EQUAL( p->duration(),       0u    );
 
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
             p->ctrlFrame().receiverAddress().value(),
             senf::MACAddress::from_string("00:0b:6b:57:06:b0") );
 }
index ede5f41..5f4f997 100644 (file)
 
 namespace senf {
 
-    // the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21)
-    // we could set maxLengthValue in INIT, but for the most MIHF_IDs the default
-    // maximum length of 127 should be enough.
-    // The user must call mihPacket->src_mihfId().maxLengthValue( 253) before 
-    // setting longer MIHF_IDs
+    /** \brief Parse a MIHF_ID
+
+         the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21)
+         we could set maxLengthValue in init(), but for the most MIHF_IDs the default
+         maximum length of 127 should be enough.
+         
+         \note you must call mihfIdPacket.maxLengthValue( 253) *before*
+         setting longer MIHF_IDs values.
+    */
     class MIHFId_TLVParser : public BaseTLVPacketParser
     {
-    #   include SENF_PARSER()        
+    #   include SENF_PARSER()
         SENF_PARSER_INHERIT  ( BaseTLVPacketParser );
         SENF_PARSER_SKIP     ( length(), 0         );
         SENF_PARSER_FINALIZE ( MIHFId_TLVParser    );
-                
+
         std::string asString() const;
         void setString(std::string const &id);
-        
+
         senf::MACAddress asMACAddress() const;
         void setMACAddress(senf::MACAddress const &mac);
 
         senf::INet4Address asINet4Address() const;
         void setINet4Address(senf::INet4Address const &addr);
-        
+
         senf::INet6Address asINet6Address() const;
         void setINet6Address(senf::INet6Address const &addr);
 
@@ -70,7 +74,7 @@ namespace senf {
         struct binaryNAIEncoder {
             binaryNAIEncoder(OutputIterator &i) : i_(i) {}
             void operator()(const boost::uint8_t &v) const {
-                *i_++ = '\\'; 
+                *i_++ = '\\';
                 *i_++ = v;
             }
             OutputIterator &i_;
@@ -79,10 +83,10 @@ namespace senf {
         static boost::function_output_iterator<binaryNAIEncoder<OutputIterator> > getNAIEncodedOutputIterator(OutputIterator i) {
             return boost::make_function_output_iterator(binaryNAIEncoder<OutputIterator>(i));
         }
-        
+
         struct binaryNAIDecoder {
             binaryNAIDecoder() : readNextByte_(true) {}
-            bool operator()(const boost::uint8_t &v) { 
+            bool operator()(const boost::uint8_t &v) {
                 readNextByte_ = readNextByte_ ? false : true;
                 return readNextByte_;
             }
@@ -98,13 +102,13 @@ namespace senf {
 
         Parser implementing the MIH header. The fields implemented are:
         \image html MIHPacket.png
-        
+
         \see MIHPacketType
      */
     struct MIHPacketParser : public PacketParserBase
     {
     #   include SENF_PARSER()
-        
+
         SENF_PARSER_BITFIELD_RO ( version,       4,  unsigned );
         SENF_PARSER_BITFIELD    ( ackRequest,    1,  bool     );
         SENF_PARSER_BITFIELD    ( ackResponse,   1,  bool     );
@@ -112,32 +116,32 @@ namespace senf {
         SENF_PARSER_BITFIELD    ( moreFragment,  1,  bool     );
         SENF_PARSER_BITFIELD    ( fragmentNr,    7,  unsigned );
         SENF_PARSER_SKIP_BITS   ( 1                           );
-        
+
         // MIH message ID (MID)
         SENF_PARSER_BITFIELD ( sid,     4,  unsigned );
         SENF_PARSER_BITFIELD ( opcode,  2,  unsigned );
         SENF_PARSER_BITFIELD ( aid,    10,  unsigned );
-        
+
         SENF_PARSER_SKIP_BITS ( 4                           );
         SENF_PARSER_BITFIELD  ( transactionId, 12, unsigned );
         SENF_PARSER_FIELD_RO  ( payloadLength, UInt16Parser );
-        
+
         // Source MIHF Id
         SENF_PARSER_FIELD ( src_mihfId, MIHFId_TLVParser );
         // Destination MIHF Id
         SENF_PARSER_FIELD ( dst_mihfId, MIHFId_TLVParser );
-        
+
         SENF_PARSER_FINALIZE ( MIHPacketParser );
-        
+
         SENF_PARSER_INIT() {
             version_() = 1;
             src_mihfId().type() = 1;
             dst_mihfId().type() = 2;
         }
-        
+
         friend class MIHPacketType;
     };
-    
+
     /** \brief MIH packet
 
         \par Packet type (typedef):
@@ -145,7 +149,7 @@ namespace senf {
 
         \par Fields:
             \ref MIHPacketParser
-        
+
         \ingroup protocolbundle_80221
      */
     struct MIHPacketType
@@ -170,16 +174,16 @@ namespace senf {
 
     /** \brief MIH packet typedef */
     typedef ConcretePacket<MIHPacketType> MIHPacket;
-    
-    
+
+
     struct MIHPayloadPacketParser : public PacketParserBase
     {
     #   include SENF_PARSER()
         SENF_PARSER_LIST ( tlv_list, packetSize(), GenericTLVPacketParser );
-        
+
         SENF_PARSER_FINALIZE ( MIHPayloadPacketParser );
     };
-    
+
     struct MIHPayloadPacketType
         : public PacketTypeBase,
           public PacketTypeMixin<MIHPayloadPacketType>
@@ -187,7 +191,7 @@ namespace senf {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<MIHPayloadPacketType> mixin;
 #endif
-        typedef ConcretePacket<MIHPayloadPacketType> packet; ///< MIH Payload packet typedef 
+        typedef ConcretePacket<MIHPayloadPacketType> packet; ///< MIH Payload packet typedef
         typedef MIHPayloadPacketParser parser; ///< typedef to the parser of MIH Payload packet
 
         using mixin::nextPacketRange;
@@ -197,7 +201,7 @@ namespace senf {
         /** \brief Dump given MIHPayload in readable form to given output stream */
         static void dump(packet p, std::ostream &os);
     };
-        
+
      /** \brief MIH Payload packet typedef */
     typedef ConcretePacket<MIHPayloadPacketType> MIHPayloadPacket;
 }
@@ -211,7 +215,7 @@ namespace senf {
 //#include "MIHPacket.cti"
 #endif
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 80a28c1..675bc61 100644 (file)
@@ -45,13 +45,13 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_string)
     mihPacket->src_mihfId().setString( "senf@berlios.de");
     mihPacket->dst_mihfId().setString( "test");
     mihPacket.finalizeThis();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
             // MIH header
             0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x17,
             // source MIHF_ID TLV:
             0x01, 0x0f, // type, length
-            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c, 
+            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c,
             0x69, 0x6f, 0x73, 0x2e, 0x64, 0x65,  // value
             // destination MIHF_ID TLV:
             0x02, 0x04, 0x74, 0x65, 0x73, 0x74
@@ -59,16 +59,19 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_string)
     BOOST_CHECK(equal( mihPacket.data().begin(), mihPacket.data().end(), data ));
     BOOST_CHECK_EQUAL( mihPacket->src_mihfId().asString(), "senf@berlios.de");
     BOOST_CHECK_EQUAL( mihPacket->dst_mihfId().asString(), "test");
-    
+
     // now expand a MIHF_ID
     mihPacket->dst_mihfId().maxLengthValue(253);
     mihPacket->dst_mihfId().setString( std::string(200, 'x'));
     mihPacket.finalizeThis();
-    
+
     BOOST_CHECK_EQUAL( mihPacket.size(), unsigned(8 + 17 + 203));
     BOOST_CHECK_EQUAL( mihPacket->payloadLength(), 17 + 203);
     BOOST_CHECK_EQUAL( mihPacket->dst_mihfId().length(), 200u);
     BOOST_CHECK_EQUAL( senf::bytes(mihPacket->dst_mihfId()), 203u);
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( mihPacket.dump( oss));
 }
 
 
@@ -81,8 +84,8 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_mac)
     mihPacket->src_mihfId().setMACAddress( MACAddress::from_string("01:02:03:04:05:06"));
     mihPacket->dst_mihfId().setMACAddress( MACAddress::from_string("07:08:09:0a:0b:0c"));
     mihPacket.finalizeThis();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
             // MIH header
             0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x1c,
             // source MIHF_ID TLV:
@@ -93,11 +96,11 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_mac)
             0x5c, 0x07, 0x5c, 0x08, 0x5c, 0x09, 0x5c, 0x0a, 0x5c, 0x0b, 0x5c, 0x0c  // value (nai-encoded)
     };
     BOOST_CHECK(equal( mihPacket.data().begin(), mihPacket.data().end(), data ));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->src_mihfId().asMACAddress(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->src_mihfId().asMACAddress(),
             MACAddress::from_string("01:02:03:04:05:06"));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->dst_mihfId().asMACAddress(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->dst_mihfId().asMACAddress(),
             MACAddress::from_string("07:08:09:0a:0b:0c"));
 }
 
@@ -111,8 +114,8 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_inet4)
     mihPacket->src_mihfId().setINet4Address( INet4Address::from_string("128.129.130.131"));
     mihPacket->dst_mihfId().setINet4Address( INet4Address::from_string("132.133.134.135"));
     mihPacket.finalizeThis();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
             // MIH header
             0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x14,
             // source MIHF_ID TLV:
@@ -123,11 +126,11 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_inet4)
             0x5c, 0x84, 0x5c, 0x85, 0x5c, 0x86, 0x5c, 0x87  // value (nai-encoded)
     };
     BOOST_CHECK(equal( mihPacket.data().begin(), mihPacket.data().end(), data ));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->src_mihfId().asINet4Address(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->src_mihfId().asINet4Address(),
             INet4Address::from_string("128.129.130.131"));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->dst_mihfId().asINet4Address(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->dst_mihfId().asINet4Address(),
             INet4Address::from_string("132.133.134.135"));
 }
 
@@ -141,8 +144,8 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_inet6)
     mihPacket->src_mihfId().setINet6Address( INet6Address::from_string("::ffff:1.2.3.4"));
     mihPacket->dst_mihfId().setINet6Address( INet6Address::from_string("::ffff:5.6.7.8"));
     mihPacket.finalizeThis();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
             // MIH header
             0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x44,
             // source MIHF_ID TLV:
@@ -161,25 +164,25 @@ BOOST_AUTO_UNIT_TEST(MIHPacket_create_inet6)
             0x5c, 0x05, 0x5c, 0x06, 0x5c, 0x07, 0x5c, 0x08
     };
     BOOST_CHECK(equal( mihPacket.data().begin(), mihPacket.data().end(), data ));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->src_mihfId().asINet6Address(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->src_mihfId().asINet6Address(),
             INet6Address::from_string("::ffff:1.2.3.4"));
-    BOOST_CHECK_EQUAL( 
-            mihPacket->dst_mihfId().asINet6Address(), 
+    BOOST_CHECK_EQUAL(
+            mihPacket->dst_mihfId().asINet6Address(),
             INet6Address::from_string("::ffff:5.6.7.8") );
 }
 
 
 BOOST_AUTO_UNIT_TEST(MIHPayload_parse)
 {
-    unsigned char data[] = { 
+    unsigned char data[] = {
             // MIH header
-            0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 
+            0x10, 0x54, 0x00, 0x00, 0x00, 0x15,
             // variable payload length:
             0x00, 0x2a,
             // source MIHF_ID TLV:
             0x01, 0x0f, // type, length
-            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c, 
+            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c,
             0x69, 0x6f, 0x73, 0x2e, 0x64, 0x65,  // value ("senf@berlios.de")
             // destination MIHF_ID TLV:
             0x02, 0x04, 0x74, 0x65, 0x73, 0x74,  // type, length, value ("test")
@@ -193,25 +196,25 @@ BOOST_AUTO_UNIT_TEST(MIHPayload_parse)
             0x05, // first bit not set, length=5
             0x1a, 0x2b, 0x3c, 0x4d, 0x5e // value
     };
-    
+
     MIHPacket mihPacket (MIHPacket::create(data));
     BOOST_CHECK_EQUAL( mihPacket->payloadLength(), 42u);
-    
+
     BOOST_REQUIRE( mihPacket.next().is<MIHPayloadPacket>() );
     MIHPayloadPacket mihPayload (mihPacket.next().as<MIHPayloadPacket>());
 
     BOOST_CHECK_EQUAL( mihPayload->tlv_list().size(), 2u);
     MIHPayloadPacketParser::tlv_list_t::container tlv_list_container (mihPayload->tlv_list());
-    
+
     GenericTLVPacket::Parser tlv1 = *tlv_list_container.begin();
     BOOST_CHECK_EQUAL( tlv1.type(), 0x42);
     BOOST_CHECK_EQUAL( tlv1.length(), 0x0au);
     BOOST_CHECK_EQUAL( tlv1.value().size(), 0x0a);
-    
+
     GenericTLVPacket::Parser tlv2 = *boost::next(tlv_list_container.begin());
     BOOST_CHECK_EQUAL( tlv2.type(), 0x43);
     BOOST_CHECK_EQUAL( tlv2.length(), 0x05u);
-    BOOST_CHECK_EQUAL( tlv2.value().size(), 0x05);            
+    BOOST_CHECK_EQUAL( tlv2.value().size(), 0x05);
 }
 
 
@@ -222,35 +225,35 @@ BOOST_AUTO_UNIT_TEST(MIHPayload_create)
     mihPacket->transactionId() = 21;
     mihPacket->src_mihfId().setString( "senf@berlios.de");
     mihPacket->dst_mihfId().setString( "test");
-    
+
     MIHPayloadPacket mihPayload (MIHPayloadPacket::createAfter(mihPacket));
-    
-    unsigned char tlv1_value[] = { 
+
+    unsigned char tlv1_value[] = {
             0x1a, 0x2b, 0x3c, 0x4d, 0x5e };
     GenericTLVPacket tlv2 = (GenericTLVPacket::create());
     tlv2->type() = 0x43;
     tlv2->value( tlv1_value);
-    tlv2.finalizeThis();         
+    tlv2.finalizeThis();
     mihPayload->tlv_list().push_front( tlv2.parser());
 
-    unsigned char tlv2_value[] = { 
+    unsigned char tlv2_value[] = {
            0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
     GenericTLVPacket tlv1 (GenericTLVPacket::create());
     tlv1->type() = 0x42;
     tlv1->value( tlv2_value);
     tlv1.finalizeThis();
     mihPayload->tlv_list().push_front( tlv1.parser());
-    
+
     mihPacket.finalizeAll();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
             // MIH header
-            0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 
+            0x10, 0x54, 0x00, 0x00, 0x00, 0x15,
             // variable payload length:
             0x00, 0x2a,
             // source MIHF_ID TLV:
             0x01, 0x0f, // type, length
-            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c, 
+            0x73, 0x65, 0x6e, 0x66, 0x40, 0x62, 0x65, 0x72, 0x6c,
             0x69, 0x6f, 0x73, 0x2e, 0x64, 0x65,  // value ("senf@berlios.de")
             // destination MIHF_ID TLV:
             0x02, 0x04, 0x74, 0x65, 0x73, 0x74,  // type, length, value ("test")
@@ -264,7 +267,7 @@ BOOST_AUTO_UNIT_TEST(MIHPayload_create)
             0x05, // first bit not set, length=5
             0x1a, 0x2b, 0x3c, 0x4d, 0x5e // value
     };
-    
+
     BOOST_CHECK(equal( mihPacket.data().begin(), mihPacket.data().end(), data ));
 }
 
@@ -272,7 +275,7 @@ BOOST_AUTO_UNIT_TEST(MIHPayload_create)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 2ec504f..b5c4949 100644 (file)
@@ -27,9 +27,7 @@
 
 // Custom includes
 #include "TLVPacket.hh"
-#include <senf/Packets.hh>
 #include "../DefaultBundle/EthernetPacket.hh"
-#include <senf/Utils/hexdump.hh>
 
 #include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
@@ -57,7 +55,7 @@ void check_TLVPacket(GenericTLVPacket &tlvPacket, boost::uint8_t type, boost::ui
 
 BOOST_AUTO_UNIT_TEST(GenericTLVPacket_parse_packet_with_simple_length)
 {
-    unsigned char data[] = { 
+    unsigned char data[] = {
         0x01, // type
         0x0A, // first bit not set, length=10
         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 // value
@@ -69,12 +67,12 @@ BOOST_AUTO_UNIT_TEST(GenericTLVPacket_parse_packet_with_simple_length)
 
 BOOST_AUTO_UNIT_TEST(GenericTLVPacket_parse_packet_with_extended_length)
 {
-    unsigned char data[] = { 
+    unsigned char data[] = {
         0x01, // type
         0x81, // first and last bit set => one byte length following
         0x0A, // length (10 bytes value)
         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 // value
-    };        
+    };
     GenericTLVPacket tlvPacket (GenericTLVPacket::create(data));
     check_TLVPacket( tlvPacket, 0x01, 0x0Au );
 }
@@ -82,7 +80,7 @@ BOOST_AUTO_UNIT_TEST(GenericTLVPacket_parse_packet_with_extended_length)
 
 BOOST_AUTO_UNIT_TEST(GenericTLVPacket_create_packet_with_simple_length)
 {
-    unsigned char value[] = { 
+    unsigned char value[] = {
            0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
     };
     GenericTLVPacket tlvPacket (GenericTLVPacket::create());
@@ -91,8 +89,8 @@ BOOST_AUTO_UNIT_TEST(GenericTLVPacket_create_packet_with_simple_length)
     tlvPacket.finalizeThis();
 
     check_TLVPacket( tlvPacket, 42u, 0x0Au );
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
         0x2a, // type
         0x0A, // first bit not set, length=10
         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 // value
@@ -112,15 +110,15 @@ BOOST_AUTO_UNIT_TEST(GenericTLVPacket_create_packet_with_extended_length)
     tlvPacket.finalizeThis();
 
     check_TLVPacket( tlvPacket, 42u, sizeof(value) );
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
         0x2a, // type
         0x81, // first and last bit set => one byte length following
         0xff, // length (255 bytes value)
         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 // first bytes of value
     };
-    BOOST_CHECK( equal( 
-            tlvPacket.data().begin(), 
+    BOOST_CHECK( equal(
+            tlvPacket.data().begin(),
             boost::next( tlvPacket.data().begin(), sizeof(data)),
             data ));
 }
@@ -131,11 +129,11 @@ BOOST_AUTO_UNIT_TEST(GenericTLVPacket_create_invalid_packet)
     GenericTLVPacket tlvPacket (GenericTLVPacket::create());
     tlvPacket->type() = 42u;
     tlvPacket.finalizeThis();
-    
+
     unsigned char value[255];
     for (unsigned i=0; i<sizeof(value); i++)
         value[i] = i;
-    
+
     BOOST_CHECK_THROW( tlvPacket->value( value), TLVLengthException);
     tlvPacket->maxLengthValue( sizeof(value));
     tlvPacket->value( value);
@@ -148,12 +146,12 @@ namespace {
 
     struct TestMacAddressTLVPacketParser : public BaseTLVPacketParser
     {
-    #   include SENF_PARSER()        
+    #   include SENF_PARSER()
         SENF_PARSER_INHERIT ( BaseTLVPacketParser );
         SENF_PARSER_VECTOR  ( value, bytes(length), senf::MACAddressParser );
         SENF_PARSER_FINALIZE( TestMacAddressTLVPacketParser );
     };
-    
+
     struct TestMacAddressTLVPacketType
         : public PacketTypeBase,
           public PacketTypeMixin<TestMacAddressTLVPacketType>
@@ -164,8 +162,8 @@ namespace {
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
-        
-        static void finalize(ConcretePacket<TestMacAddressTLVPacketType> p) { 
+
+        static void finalize(ConcretePacket<TestMacAddressTLVPacketType> p) {
             p->shrinkLength();
         }
     };
@@ -179,8 +177,8 @@ BOOST_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create)
     tlvPacket->value().push_back( senf::MACAddress::from_string("01:23:45:67:89:ab") );
     tlvPacket->value().push_back( senf::MACAddress::from_string("cd:ef:01:23:45:67") );
     tlvPacket.finalizeThis();
-    
-    unsigned char data[] = { 
+
+    unsigned char data[] = {
         0x2a, // type
         0x0c, // length
         0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67  // value
@@ -192,7 +190,7 @@ BOOST_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 4c25433..29f85cc 100644 (file)
 
 BOOST_AUTO_UNIT_TEST(ethernetPacket_parse)
 {
-    senf::PacketData::byte data[] = { 
+    senf::PacketData::byte data[] = {
         0x01, 0x02, 0x03, 0x04, 0x05, 0x06,  // destination MAC
         0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,  // source MAC
-        0x10, 0x11 
+        0x10, 0x11
     };                        // EtherType
     senf::EthernetPacket p (senf::EthernetPacket::create(data));
 
     BOOST_CHECK_EQUAL( p->destination()[3], 0x04 );
     BOOST_CHECK_EQUAL( p->source()[0], 0x07 );
     BOOST_CHECK_EQUAL( p->type_length(), 0x1011 );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(ethernetPacket_parse_chain)
@@ -58,7 +61,7 @@ BOOST_AUTO_UNIT_TEST(ethernetPacket_parse_chain)
         0x81, 0x00,                          // EtherType: VLan
         0x92, 0x34,                          // VLAN prio, cfi, id
         0xab, 0xcd,                          // EtherType
-        0xf0, 0xf1, 0xf2, 0xf3, 0xf4 
+        0xf0, 0xf1, 0xf2, 0xf3, 0xf4
     };      // Payload
     senf::EthernetPacket p (senf::EthernetPacket::create(data));
 
@@ -77,7 +80,7 @@ BOOST_AUTO_UNIT_TEST(ethernetPacket_create)
     senf::EthernetPacket eth (senf::EthernetPacket::create());
     eth->source() = senf::MACAddress::from_string("01:02:03:04:05:06");
     eth->destination() = senf::MACAddress::from_string("07:08:09:0a:0b:0c");
-    
+
     senf::EthVLanPacket vlan (senf::EthVLanPacket::createAfter(eth));
     vlan->priority() = 9u;
     vlan->cfi() = true;
@@ -97,12 +100,12 @@ BOOST_AUTO_UNIT_TEST(ethernetPacket_llcsnap)
     senf::EthernetPacket eth (senf::EthernetPacket::create());
     eth->source() = senf::MACAddress::from_string("01:02:03:04:05:06");
     eth->destination() = senf::MACAddress::from_string("07:08:09:0a:0b:0c");
-    
+
     senf::LlcSnapPacket llcsnap (senf::LlcSnapPacket::createAfter(eth));
     senf::DataPacket payload  (senf::DataPacket::createAfter(
             llcsnap, std::string("Hello, world!")));
     eth.finalizeAll();
-    
+
     BOOST_CHECK_EQUAL( eth->type_length(), 8u + 13u);
     BOOST_CHECK_EQUAL( llcsnap->dsap(), 0xaa );
     BOOST_CHECK_EQUAL( llcsnap->ssap(), 0xaa );
@@ -118,7 +121,7 @@ BOOST_AUTO_UNIT_TEST(ethernetPacket_llcsnap)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index aa14500..a116e2b 100644 (file)
@@ -31,7 +31,7 @@
 
 BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
 {
-    unsigned char data[] = { 
+    unsigned char data[] = {
             0x8f, 0x00, 0x8d, 0x54, 0x00, 0x00, 0x00, 0x01,
             0x04, 0x00, 0x00, 0x00, 0xff, 0x15, 0x00, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -39,7 +39,7 @@ BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
     };
 
     senf::ICMPv6Packet p ( senf::ICMPv6Packet::create(data) );
-    
+
     BOOST_CHECK_EQUAL( p->type(),     0x8f   );
     BOOST_CHECK_EQUAL( p->code(),     0x00   );
     BOOST_CHECK_EQUAL( p->checksum(), 0x8d54 );
@@ -47,4 +47,6 @@ BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
     BOOST_CHECK( p.next().is<senf::MLDv2ListenerReport>() );
     BOOST_CHECK_EQUAL( p.next().size(), 24u );
 
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
index 9f1eb94..26d630c 100644 (file)
@@ -62,6 +62,9 @@ BOOST_AUTO_UNIT_TEST(ipV4Packet_packet)
     BOOST_CHECK_EQUAL( p->checksum(),    0x0B0Cu     );
     BOOST_CHECK_EQUAL( p->source().value(), senf::INet4Address(0x11121314u) );
     BOOST_CHECK_EQUAL( p->destination().value(), senf::INet4Address(0x15161718u) );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(ipV4Packet_create)
@@ -91,7 +94,7 @@ BOOST_AUTO_UNIT_TEST(ipV4Packet_create)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index dcdf8ed..a82a73a 100644 (file)
@@ -73,6 +73,10 @@ BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_packet)
     BOOST_CHECK_EQUAL( p->nextHeader(), 44u );
     BOOST_CHECK_EQUAL( p->source().value(), senf::INet6Address::from_string("2001::1") );
     BOOST_CHECK_EQUAL( p->destination().value(), senf::INet6Address::from_string("2001::2") );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
+
     BOOST_CHECK( p.next().is<senf::IPv6Extension_Fragment>() );
 
     senf::IPv6Extension_Fragment f (p.next().as<senf::IPv6Extension_Fragment>());
@@ -98,7 +102,7 @@ BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_packet)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index b39bc40..87cdcc1 100644 (file)
@@ -63,12 +63,15 @@ BOOST_AUTO_UNIT_TEST(ipV6Packet_packet)
     BOOST_CHECK( p.next() );
     BOOST_CHECK( p.next().is<senf::DataPacket>() );
     BOOST_CHECK_EQUAL( p.next().size(), 1u );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 8f2bb4e..e3e51a6 100644 (file)
@@ -42,7 +42,7 @@ BOOST_AUTO_UNIT_TEST(llcsnap_parse)
         0xaa,             // SSAP
         0x03,             // ctrl
         0x00, 0x00, 0x00, // Protocol Identification Field
-        0x10, 0x11        // EtherType / Length 
+        0x10, 0x11        // EtherType / Length
     };
     senf::LlcSnapPacket p (senf::LlcSnapPacket::create(data));
 
@@ -51,6 +51,9 @@ BOOST_AUTO_UNIT_TEST(llcsnap_parse)
     BOOST_CHECK_EQUAL( p->ctrl(), 0x03 );
     BOOST_CHECK_EQUAL( p->protocolId(), 0x000000u );
     BOOST_CHECK_EQUAL( p->type_length(), 0x1011 );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(llcSnapPacket_ethernet)
@@ -58,7 +61,7 @@ BOOST_AUTO_UNIT_TEST(llcSnapPacket_ethernet)
     senf::LlcSnapPacket llcsnap (senf::LlcSnapPacket::create());
     senf::EthernetPacket eth (senf::EthernetPacket::createAfter(llcsnap));
     senf::DataPacket payload  (senf::DataPacket::createAfter(
-            eth, std::string("Hello, world!")));    
+            eth, std::string("Hello, world!")));
     llcsnap.finalizeAll();
 
     BOOST_CHECK_EQUAL( llcsnap->dsap(), 0xaa );
@@ -72,7 +75,7 @@ BOOST_AUTO_UNIT_TEST(llcSnapPacket_ethernet)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 9cff4af..58dd16c 100644 (file)
@@ -44,4 +44,7 @@ BOOST_AUTO_UNIT_TEST(RTPPacket_packet)
     BOOST_CHECK_EQUAL( p->seqNumber(), 0x1bbbu);
     BOOST_CHECK_EQUAL( p->timeStamp(), 0x2cbad80u);
     BOOST_CHECK_EQUAL( p->synSourceId(), 0x5048a78cu);
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
index 6df9409..dd39540 100644 (file)
@@ -48,6 +48,9 @@ BOOST_AUTO_UNIT_TEST(udpPacket_packet)
     BOOST_CHECK_EQUAL( p->destination(),       0x0304       );
     BOOST_CHECK_EQUAL( p->length(),            0x0506       );
     BOOST_CHECK_EQUAL( p->checksum(),          0x0708       );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(udpPacket_create)
@@ -63,11 +66,11 @@ BOOST_AUTO_UNIT_TEST(udpPacket_create)
     ip->destination() = senf::INet4Address::Loopback;
     ip->df() = true;
     ip->ttl() = 64;
-    
+
     senf::UDPPacket udp (senf::UDPPacket::createAfter(ip));
     udp->source() = 23456;
     udp->destination() = 12345;
-    
+
     senf::DataPacket::createAfter(udp,std::string("TEST-WRITE"));
 
     // validates, since the checksum is 0 and thus ignored !
@@ -83,7 +86,7 @@ BOOST_AUTO_UNIT_TEST(udpPacket_create)
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 311c6da..6d8969a 100644 (file)
@@ -33,7 +33,6 @@
 #include "../../Packets/DefaultBundle/EthernetPacket.hh"
 #include "../../Packets/DefaultBundle/IPv4Packet.hh"
 #include <boost/test/test_tools.hpp>
-#include <senf/Utils/hexdump.hh>
 
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
@@ -43,7 +42,7 @@ using namespace senf;
 BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
 {
     // MPE section captured with dvbsnoop
-    unsigned char data[] = { 
+    unsigned char data[] = {
             // MPE Header
             0x3e, 0xb0, 0x77, 0x00, 0x00, 0xc3, 0x00, 0x00,
             0x04, 0xd8, 0x12, 0x0c,
@@ -51,26 +50,26 @@ BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
             0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x00, 0x62,
             // Ethernet Header
             0x01, 0x00, 0x5e, 0x01, 0x02, 0x03, 0x12, 0xb0,
-            0x43, 0x61, 0x5d, 0x99, 0x08, 0x00, 
+            0x43, 0x61, 0x5d, 0x99, 0x08, 0x00,
             // IPv4 Header
             0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
             0x01, 0x01, 0xc6, 0xfb, 0xc0, 0xa8, 0x01, 0x01,
-            0xef, 0x01, 0x02, 0x03, 
+            0xef, 0x01, 0x02, 0x03,
             // Payload (ICMP)
-            0x08, 0x00, 0x0e, 0xa3, 0xf2, 0x72, 0x55, 0xea, 
-            0xa2, 0xae, 0x56, 0x47, 0xbb, 0x06, 0x02, 0x00, 
+            0x08, 0x00, 0x0e, 0xa3, 0xf2, 0x72, 0x55, 0xea,
+            0xa2, 0xae, 0x56, 0x47, 0xbb, 0x06, 0x02, 0x00,
             0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 
-            0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 
-            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 
-            0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 
+            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+            0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+            0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
             0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
             // MPE Trailer (crc)
             0xb5, 0x77, 0x4c, 0x3c
     };
-            
+
     senf::MPESection sec (senf::MPESection::create(data));
-    
+
     BOOST_CHECK_EQUAL(   sec->table_id(),                0x3eu       );
     BOOST_CHECK(         sec->section_syntax_indicator()             );
     BOOST_CHECK(       ! sec->private_indicator()                    );
@@ -89,7 +88,10 @@ BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
     BOOST_CHECK_EQUAL(   sec->real_time_parameters().address(),        0x120cu );
     BOOST_CHECK_EQUAL(   sec->crc(), 3044494396u                     );
     BOOST_CHECK_EQUAL(   sec->crc(), sec->calcCrc()                  );
-    
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( sec.dump( oss));
+
     BOOST_REQUIRE( sec.next().is<senf::LlcSnapPacket>() );
     senf::LlcSnapPacket llcsnap (sec.next().as<senf::LlcSnapPacket>());
 
@@ -97,21 +99,21 @@ BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
     BOOST_CHECK_EQUAL( llcsnap->ssap(),        0xaau );
     BOOST_CHECK_EQUAL( llcsnap->ctrl(),        0x3u  );
     BOOST_CHECK_EQUAL( llcsnap->protocolId(),  0x0u  );
-    // in the captured section the llcsnap type/length field was set to the 
+    // in the captured section the llcsnap type/length field was set to the
     // length of the following ethernet packet; the ethertype 0x6558 (Trans
     // Ether Bridging [RFC1701]) would be possible as well (see next test)
     BOOST_CHECK_EQUAL( llcsnap->type_length(), 0x62u );
 
     BOOST_REQUIRE( llcsnap.next().is<senf::EthernetPacket>() );
     senf::EthernetPacket eth (llcsnap.next().as<senf::EthernetPacket>());
-    
+
     BOOST_CHECK_EQUAL( eth->destination().value(), senf::MACAddress::from_string("01:00:5e:01:02:03") );
     BOOST_CHECK_EQUAL( eth->source().value(),      senf::MACAddress::from_string("12:b0:43:61:5d:99") );
     BOOST_CHECK_EQUAL( eth->type_length(),         0x800u                                             );
 
     BOOST_REQUIRE( eth.next().is<senf::IPv4Packet>() );
     senf::IPv4Packet ip (eth.next().as<senf::IPv4Packet>());
-    
+
     BOOST_CHECK_EQUAL( ip->version(),    0x4u   );
     BOOST_CHECK_EQUAL( ip->ihl(),        0x5u   );
     BOOST_CHECK_EQUAL( ip->tos(),        0x0u   );
@@ -135,23 +137,23 @@ BOOST_AUTO_UNIT_TEST(MPESection_create)
     sec->real_time_parameters().table_boundary() = 1;
     sec->real_time_parameters().frame_boundary() = 0;
     sec->real_time_parameters().address()        = 0xfffffu;
-    
+
     // the type/length field will be set to the ethertype 0x6558 (Trans
-    // Ether Bridging [RFC1701]) on finalize() 
+    // Ether Bridging [RFC1701]) on finalize()
     senf::LlcSnapPacket llcsnap (senf::LlcSnapPacket::createAfter(sec));
-    
+
     senf::EthernetPacket eth (senf::EthernetPacket::createAfter(llcsnap));
     eth->destination() = senf::MACAddress::from_string("01:00:5e:01:02:03");
     eth->source()      = senf::MACAddress::from_string("92:4c:a2:1c:da:81");
-    
+
     senf::IPv4Packet ip (senf::IPv4Packet::createAfter(eth));
     ip->df()          = 1;
     ip->ttl()         = 1;
     ip->protocol()    = 1;
     ip->source()      = senf::INet4Address::from_string("10.1.2.2");
     ip->destination() = senf::INet4Address::from_string("239.1.2.3");
-    
-    unsigned char payload_data[] = { 
+
+    unsigned char payload_data[] = {
             // Payload (ICMP)
             0x08, 0x00, 0x52, 0x73, 0x0e, 0x02, 0x00, 0x20,
             0xa4, 0x3a, 0xb4, 0x47, 0x4f, 0xe5, 0x04, 0x00,
@@ -163,9 +165,9 @@ BOOST_AUTO_UNIT_TEST(MPESection_create)
             0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37
     };
     senf::DataPacket payload (senf::DataPacket::createAfter(ip, payload_data));
-    
+
     sec.finalizeAll();
-    
+
     unsigned char sec_data[] = {
             0x3e, 0xb0, 0x77, 0x00, 0x00, 0xc3, 0x00, 0x00,
             0x02, 0x7b, 0xff, 0xff, 0xaa, 0xaa, 0x03, 0x00,
@@ -183,14 +185,14 @@ BOOST_AUTO_UNIT_TEST(MPESection_create)
             0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
             0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x52, 0xdf,
             0x6a, 0x1d
-    };    
+    };
     BOOST_CHECK( equal( sec.data().begin(), sec.data().end(), sec_data ));
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100
index 7879ff0..c3cc1a7 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
-#include <senf/Utils/hexdump.hh>
 
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
@@ -41,25 +40,25 @@ BOOST_AUTO_UNIT_TEST(transportPacket_parse)
 {
     // TransportStream-Packet containing a ULE encoded IPv6 ping packet,
     // captured with dvbsnoop
-    unsigned char data[] = { 
+    unsigned char data[] = {
             // Transport Packet Header
-            0x47, 0x41, 0x0f, 0x1e, 
+            0x47, 0x41, 0x0f, 0x1e,
             // Payload Pointer
-            0x00, 
+            0x00,
             // SNDU Header
             0x80, 0x4c, 0x86, 0xdd,
             // IPv6 Packet
             0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x40,
             0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x48, 0x7c, 0x7e, 0xff, 0xfe, 0x23, 0x68, 0xaf,
-            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,
             0x02, 0x8c, 0x02, 0x8c, 0x00, 0x20, 0x58, 0xe1,
             0x11, 0x05, 0x12, 0x67, 0x06, 0x2f, 0x01, 0x00,
             0x20, 0x01, 0x06, 0x38, 0x04, 0x09, 0x10, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00,
             // SNDU footer (crc-32)
-            0x1d, 0xc4, 0xe8, 0xc1, 
+            0x1d, 0xc4, 0xe8, 0xc1,
             // Transport Packet stuffing
             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -75,7 +74,7 @@ BOOST_AUTO_UNIT_TEST(transportPacket_parse)
             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
     };
-            
+
     TransportPacket p (TransportPacket::create(data));
 
     BOOST_CHECK_EQUAL(   p->sync_byte(),                TransportPacketType::SYNC_BYTE+0 );
@@ -86,7 +85,10 @@ BOOST_AUTO_UNIT_TEST(transportPacket_parse)
     BOOST_CHECK_EQUAL(   p->transport_scrmbl_ctrl(),    0x0u                             );
     BOOST_CHECK_EQUAL(   p->adaptation_field_ctrl(),    0x1u                             );
     BOOST_CHECK_EQUAL(   p->continuity_counter(),       0x0eu                            );
-    BOOST_CHECK_EQUAL(   p->pointer_field(),          0x0u                             );
+    BOOST_CHECK_EQUAL(   p->pointer_field(),            0x0u                             );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 
@@ -96,15 +98,15 @@ BOOST_AUTO_UNIT_TEST(transportPacket_create_with_pusi)
     ts_packet->setPUSI(true);
     ts_packet->pid() = 0x010fu;
     ts_packet->continuity_counter() = 0x0eu;
-    
-    unsigned char payload_data[] = {  // see test above 
+
+    unsigned char payload_data[] = {  // see test above
             // SNDU Header
             0x80, 0x4c, 0x86, 0xdd,
             // IPv6 Packet
             0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x40,
             0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x48, 0x7c, 0x7e, 0xff, 0xfe, 0x23, 0x68, 0xaf,
-            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,
             0x02, 0x8c, 0x02, 0x8c, 0x00, 0x20, 0x58, 0xe1,
             0x11, 0x05, 0x12, 0x67, 0x06, 0x2f, 0x01, 0x00,
@@ -114,16 +116,12 @@ BOOST_AUTO_UNIT_TEST(transportPacket_create_with_pusi)
             0x1d, 0xc4, 0xe8, 0xc1
     };
     senf::DataPacket payload (senf::DataPacket::createAfter( ts_packet, payload_data));
-    
-    //TransportPacketType::addStuffingPacketAfter( ts_packet);
-    
-    //senf::hexdump(ts_packet.data().begin(), ts_packet.data().end(), std::cout);
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100