- updated MPESection creation
tho [Thu, 14 Feb 2008 15:04:39 +0000 (15:04 +0000)]
- some documentation updates, once again

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@697 270642c3-0616-0410-b53a-bc976706d245

Examples/Sniffer/Mainpage.dox
Packets/DefaultBundle/LlcSnapPacket.cc
Packets/MPEGDVBBundle/MPESection.cc
Packets/MPEGDVBBundle/MPESection.hh
Packets/MPEGDVBBundle/MPESection.test.cc
Scheduler/Scheduler.hh
Socket/Protocols/INet/INet6Address.cti
Socket/Protocols/INet/MulticastSocketProtocol.hh
doclib/Doxyfile.global

index 3e0159d..ea3fc29 100644 (file)
@@ -28,7 +28,7 @@
     tethereal. The application uses a packet socket to read Ethernet packets from the \c eth0
     interface and dumps the parsed packets out to the standard output.
 
-    To try out the example application, check out the library, go to the \c Sniffer
+    To try out the example application, check out the library, go to the \c %Sniffer
     directory and execute
 
     <pre>
@@ -39,7 +39,7 @@
     < Hit Ctrl-C when you've seen enough >
     </pre>
 
-    We will now look at the code which is found in \c Sniffer.cc in the \c Sniffer directory. The
+    We will now look at the code which is found in \c Sniffer.cc in the \c %Sniffer directory. The
     code starts out by including the necessary headers
 
     \skip // Custom includes
index dbc7454..4442463 100644 (file)
@@ -66,9 +66,6 @@ prefix_ void senf::LlcSnapPacketType::finalize(packet p)
         p->type_length() << k;
     else if (p.next().is<EthernetPacket>())
         p->type_length() << p.next().data().size();
-    else
-        ///\fixme Is this correct ?? we at least need an 'if (! p.next().is<DataPacket>() )'
-        p->type_length() << 0;
 }
 
 
index dcb6a50..2625b7b 100644 (file)
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-//prefix_ boost::uint32_t senf::MPESectionParser::calcCrc()
-//    const
-//{
-//    return std::for_each(
-//            data().begin(), 
-//            boost::prior(data().end(), 4), 
-//            crc32_t() ).checksum();
-//}
+prefix_ boost::uint32_t senf::MPESectionParser::calcCrc()
+    const
+{
+    return std::for_each(
+            data().begin(),
+            boost::prior(data().end(), 4),
+            crc32_t() ).checksum();
+}
 
 
 prefix_ void senf::MPESectionType::dump(packet p, std::ostream & os)
@@ -101,7 +101,7 @@ prefix_ void senf::MPESectionType::finalize(packet p)
 {
     p->llc_snap_flag() = p.next(nothrow) && p.next().is<LlcSnapPacket>() ? 1 : 0;
     p->section_length() = p.data().size() - 3;
-//    p->crc() = p->calcCrc();
+    p->crc() = p->calcCrc();
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
index 1e0bc2d..c9be56a 100644 (file)
@@ -55,8 +55,9 @@ namespace senf {
         
         \see MPESectionType
      */
-    struct MPESectionParser : public PacketParserBase
+    class MPESectionParser : public PacketParserBase
     {
+    public:
 #       include SENF_FIXED_PARSER()
 
         SENF_PARSER_FIELD( table_id, UInt8Parser );
@@ -96,11 +97,12 @@ namespace senf {
         }
         
         UInt32Parser crc() const { return parse<UInt32Parser>( data().size()-4 ); }
-        
-//        typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> crc32_t;
-//        boost::uint32_t calcCrc() const;
+        boost::uint32_t calcCrc() const;
         
         friend class MPESectionType;
+        
+    private:
+        typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> crc32_t;        
     };
     
     
index f62a828..3833a83 100644 (file)
@@ -83,19 +83,23 @@ BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
     BOOST_CHECK      (   sec->curr_next_indicator()                  );
     BOOST_CHECK_EQUAL(   sec->section_num(),             0x0u        );
     BOOST_CHECK_EQUAL(   sec->last_section_num(),        0x0u        );
-    BOOST_CHECK_EQUAL(   sec->real_time_parameters().delta_t(),        0x4du   );
+    BOOST_CHECK_EQUAL(   sec->real_time_parameters().delta_t(),        0x04du  );
     BOOST_CHECK_EQUAL(   sec->real_time_parameters().table_boundary(), 1       );
     BOOST_CHECK_EQUAL(   sec->real_time_parameters().frame_boundary(), 0       );
     BOOST_CHECK_EQUAL(   sec->real_time_parameters().address(),        0x120cu );
     BOOST_CHECK_EQUAL(   sec->crc(), 3044494396u                     );
+    BOOST_CHECK_EQUAL(   sec->crc(), sec->calcCrc()                  );
     
     BOOST_REQUIRE( sec.next().is<senf::LlcSnapPacket>() );
     senf::LlcSnapPacket llcsnap (sec.next().as<senf::LlcSnapPacket>());
 
-    BOOST_CHECK_EQUAL( llcsnap->dsap(), 0xaau        );
-    BOOST_CHECK_EQUAL( llcsnap->ssap(), 0xaau        );
-    BOOST_CHECK_EQUAL( llcsnap->ctrl(), 0x3u         );
-    BOOST_CHECK_EQUAL( llcsnap->protocolId(), 0u     );
+    BOOST_CHECK_EQUAL( llcsnap->dsap(),        0xaau );
+    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 
+    // 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>() );
@@ -127,38 +131,60 @@ BOOST_AUTO_UNIT_TEST(MPESection_parse_chain)
 BOOST_AUTO_UNIT_TEST(MPESection_create)
 {
     senf::MPESection sec (senf::MPESection::create());
-    sec->real_time_parameters().delta_t()        = 0x4du;
+    sec->real_time_parameters().delta_t()        = 0x027u;
     sec->real_time_parameters().table_boundary() = 1;
     sec->real_time_parameters().frame_boundary() = 0;
-    sec->real_time_parameters().address()        = 0x120cu;
+    sec->real_time_parameters().address()        = 0xfffffu;
     
+    // the type/length field will be set to the ethertype 0x6558 (Trans
+    // 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("12:b0:43:61:5d:99");
+    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("192.168.1.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[] = { 
             // Payload (ICMP)
-            0x08, 0x00, 0x0e, 0xa3, 0xf2, 0x72, 0x55, 0xea, 
-            0xa2, 0xae, 0x56, 0x47, 0xbb, 0x06, 0x02, 0x00, 
+            0x08, 0x00, 0x52, 0x73, 0x0e, 0x02, 0x00, 0x20,
+            0xa4, 0x3a, 0xb4, 0x47, 0x4f, 0xe5, 0x04, 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
     };
     senf::DataPacket payload (senf::DataPacket::createAfter(ip, payload_data));
     
     sec.finalize();
+    
+    unsigned char sec_data[] = {
+            0x3e, 0xb0, 0x77, 0x00, 0x00, 0xc3, 0x00, 0x00,
+            0x02, 0x7b, 0xff, 0xff, 0xaa, 0xaa, 0x03, 0x00,
+            0x00, 0x00, 0x65, 0x58, 0x01, 0x00, 0x5e, 0x01,
+            0x02, 0x03, 0x92, 0x4c, 0xa2, 0x1c, 0xda, 0x81,
+            0x08, 0x00, 0x45, 0x00, 0x00, 0x54, 0x00, 0x00,
+            0x40, 0x00, 0x01, 0x01, 0x7c, 0xa2, 0x0a, 0x01,
+            0x02, 0x02, 0xef, 0x01, 0x02, 0x03, 0x08, 0x00,
+            0x52, 0x73, 0x0e, 0x02, 0x00, 0x20, 0xa4, 0x3a,
+            0xb4, 0x47, 0x4f, 0xe5, 0x04, 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, 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////////////////////////////////////////
index 706ee5b..b320e77 100644 (file)
@@ -250,7 +250,8 @@ namespace senf {
                                                  the Handle interface defined above.
                                              \param[in] cb callback
                                              \param[in] eventMask arbitrary combination via '|'
-                                                 operator of EventId designators. */
+                                                 operator of \ref senf::Scheduler::EventId "EventId"
+                                                 designators. */
         template <class Handle>
         void remove(Handle const & handle, int eventMask = EV_ALL); ///< Remove event callback
                                         /**< remove() will remove any callback registered for any of
@@ -259,8 +260,8 @@ namespace senf {
                                              \param[in] handle file descriptor or handle providing
                                                  the Handle interface defined above.
                                              \param[in] eventMask arbitrary combination via '|'
-                                                 operator of EventId designators. */
-
+                                                 operator of \ref senf::Scheduler::EventId "EventId"
+                                                 designators. */
         ///\}
 
         ///\name Timeouts
index c4158c4..1947b12 100644 (file)
@@ -31,6 +31,8 @@
 #define prefix_ inline
 ///////////////////////////////cti.p///////////////////////////////////////
 
+#ifndef DOXYGEN
+
 template <unsigned a>
 prefix_ bool senf::detail::CheckINet6Network_impl5<a,0,0>::match(boost::uint8_t v0,
                                                                  boost::uint8_t v1)
@@ -161,6 +163,8 @@ match(INet6Address const & addr)
         CheckINet6Network_impl4<a7,restbits>::match(addr[14],addr[15]);
 }
 
+#endif
+
 ///////////////////////////////cti.e///////////////////////////////////////
 #undef prefix_
 
index 15ef04f..2d93ae7 100644 (file)
@@ -177,8 +177,7 @@ namespace senf {
                                              multicast groups received. The group is left from the
                                              interface with the given local address.
                                              \param[in] mcAddr address of group to leave
-                                             \param[in] localAddr address of interface to leave
-                                                 from */
+                                             \param[in] iface interface name */
     };
 
     ///\}
index ddf11b9..5d04e39 100644 (file)
@@ -1164,7 +1164,8 @@ PREDEFINED             = DOXYGEN \
                          "SENF_PARSER_VEC_N(name,elt_type,size_type)=senf::Parse_VectorN<elt_type,size_type> name() const" \
                          "SENF_LOG_CLASS_AREA()=" \
                          "SENF_LOG_DEFAULT_AREA(area)=" \
-                         "SENF_LOG_DEFAULT_STREAM(stream)="
+                         "SENF_LOG_DEFAULT_STREAM(stream)=" \
+                         "BOOST_PP_ITERATE()="
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
 # this tag can be used to specify a list of macro names that should be expanded.