Packets documentation updates
tho [Wed, 4 Feb 2009 13:30:23 +0000 (13:30 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1098 270642c3-0616-0410-b53a-bc976706d245

20 files changed:
Makefile
Packets/80221Bundle/MIHPacket.hh
Packets/80221Bundle/TLV.dia [new file with mode: 0644]
Packets/80221Bundle/TLVPacket.hh
Packets/DefaultBundle/EthernetPacket.hh
Packets/DefaultBundle/IPv4Packet.hh
Packets/DefaultBundle/IPv4Packet.test.cc
Packets/DefaultBundle/IPv6Extensions.hh
Packets/DefaultBundle/IPv6Packet.hh
Packets/DefaultBundle/LlcSnapPacket.hh
Packets/DefaultBundle/Mldv2Packet.test.cc
Packets/DefaultBundle/RTPPacket.cc
Packets/DefaultBundle/RTPPacket.hh
Packets/DefaultBundle/RTPPacket.test.cc
Packets/DefaultBundle/UDPPacket.hh
Packets/MPEGDVBBundle/MPESection.hh
Packets/MPEGDVBBundle/TLV.dia [deleted file]
Packets/MPEGDVBBundle/TransportPacket.hh
Packets/SConscript
Socket/Protocols/DatagramSocketProtocol.hh

index 250155c..b09752e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,9 @@ all_docs all_tests all:
 %/test %/doc:
        $(SCONS) $@
 
+%/build:
+       $(SCONS) $*
+
 #----------------------------------------------------------------------
 # Subversion stuff
 #----------------------------------------------------------------------
index 9c7f103..ede5f41 100644 (file)
@@ -44,7 +44,7 @@ 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( 127) before 
+    // The user must call mihPacket->src_mihfId().maxLengthValue( 253) before 
     // setting longer MIHF_IDs
     class MIHFId_TLVParser : public BaseTLVPacketParser
     {
@@ -94,6 +94,13 @@ namespace senf {
         }
     };
 
+    /** \brief Parse a MIH packet
+
+        Parser implementing the MIH header. The fields implemented are:
+        \image html MIHPacket.png
+        
+        \see MIHPacketType
+     */
     struct MIHPacketParser : public PacketParserBase
     {
     #   include SENF_PARSER()
@@ -138,7 +145,6 @@ namespace senf {
 
         \par Fields:
             \ref MIHPacketParser
-            \image html MIHPacket.png
         
         \ingroup protocolbundle_80221
      */
@@ -146,19 +152,23 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<MIHPacketType>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<MIHPacketType> mixin;
-        typedef ConcretePacket<MIHPacketType> packet;
-        typedef MIHPacketParser parser;
+#endif
+        typedef ConcretePacket<MIHPacketType> packet; ///< MIH packet typedef
+        typedef MIHPacketParser parser;               ///< typedef to the parser of MIH packet
 
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
 
+        /** \brief Dump given MIH packet in readable form to given output stream */
         static void dump(packet p, std::ostream &os);
         static void finalize(packet p);
         static factory_t nextPacketType(packet p);
     };
 
+    /** \brief MIH packet typedef */
     typedef ConcretePacket<MIHPacketType> MIHPacket;
     
     
@@ -174,20 +184,22 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<MIHPayloadPacketType>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<MIHPayloadPacketType> mixin;
-        typedef ConcretePacket<MIHPayloadPacketType> packet;
-        typedef MIHPayloadPacketParser parser;
+#endif
+        typedef ConcretePacket<MIHPayloadPacketType> packet; ///< MIH Payload packet typedef 
+        typedef MIHPayloadPacketParser parser; ///< typedef to the parser of MIH Payload packet
 
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
 
+        /** \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;
-            
-
 }
 
 
diff --git a/Packets/80221Bundle/TLV.dia b/Packets/80221Bundle/TLV.dia
new file mode 100644 (file)
index 0000000..d3f9ab5
Binary files /dev/null and b/Packets/80221Bundle/TLV.dia differ
index c337aec..bf0ce2e 100644 (file)
@@ -71,27 +71,80 @@ namespace senf {
     };  
         
 
+    /** \brief Base class for TLV-Packet-Parsers
+     
+         BaseTLVPacketParser is the abstract base class for TLV-Packet-Parsers. It defines the
+         \ref type() field as an \ref senf::UInt8Parser and the \ref length() field as a 
+         DynamicTLVLengthParser. The length field is read-only. 
+         
+         To create your own \c TLVParser you have to inherit from BaseTLVPacketParser (don't 
+         forget \ref SENF_PARSER_INHERIT) and define the \c value field. In the following example 
+         the value is a vector of MacAddresses: 
+         \code
+         struct MacAddressesTLVParser : public BaseTLVPacketParser {
+         #   include SENF_PARSER()        
+             SENF_PARSER_INHERIT ( BaseTLVPacketParser );
+             SENF_PARSER_VECTOR  ( value, bytes(length), senf::MACAddressParser );
+             SENF_PARSER_FINALIZE( MacAddressesTLVParser );
+         };
+         
+         struct MacAddressesTLVPacketType : public PacketTypeBase {
+            typedef MacAddressesTLVParser parser;
+            ...
+            static void finalize(ConcretePacket<MacAddressesTLVPacketType> p) { 
+                p->shrinkLength();
+            }
+         };
+         \endcode
+         
+         You have to adjust the maximum length value with the \ref maxLengthValue function 
+         before the length value is set. The default maximum value is 127. So, in the above
+         example adding more than 21 MACAddresses to the vector will throw a TLVLengthException
+         if you don't call \c macAddressesTLVPacket->maxLengthValue( \e some_value) before.
+         
+         \see DynamicTLVLengthParser \n
+           GenericTLVPacketParser \n
+     */
     class BaseTLVPacketParser : public PacketParserBase
     {
+    public:
 #       include SENF_PARSER()
         SENF_PARSER_FIELD    ( type,   UInt8Parser            );
         SENF_PARSER_FIELD_RO ( length, DynamicTLVLengthParser );
         SENF_PARSER_FINALIZE ( BaseTLVPacketParser            );
         
+        /** \brief set maximum value of length field
+    
+            The size of the length field will be increased if necessary.
+            \param v maximum value of length field
+         */
         void maxLengthValue(DynamicTLVLengthParser::value_type v) const {
             length_().maxValue(v);
         }
+        
+        /** \brief shrink size of length field to minimum
+    
+            The size of the length field will be decreased to minimum necessary to hold
+            the current length value.
+         */
         void shrinkLength() { 
             length_().shrink(); 
         };
         
     protected:
+        /// return size of length field
         size_type length_bytes() const { return length_().bytes(); };
+        /// set length field to given value
         void length(DynamicTLVLengthParser::value_type &v) { length_() = v; };
+        /// resize the Packet after the length field to given size
         senf::safe_data_iterator resizeValue(DynamicTLVLengthParser::value_type size);
     };
 
         
+    /** \brief Parser for a generic TLV packet
+
+        \see GenericTLVPacketType
+     */
     struct GenericTLVPacketParser : public BaseTLVPacketParser
     {
 #       include SENF_PARSER()        
@@ -109,22 +162,38 @@ namespace senf {
         void value(ForwardReadableRange const &range);
     };
     
+    /** \brief Generic TLV packet
+
+        \par Packet type (typedef):
+            \ref GenericTLVPacket
+
+        \image html TLV.png
+        
+        \ingroup protocolbundle_80221
+     */
     struct GenericTLVPacketType
         : public PacketTypeBase,
           public PacketTypeMixin<GenericTLVPacketType>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<GenericTLVPacketType> mixin;
-        typedef ConcretePacket<GenericTLVPacketType> packet;
-        typedef GenericTLVPacketParser parser;
+#endif
+        typedef ConcretePacket<GenericTLVPacketType> packet; ///< GenericTLV packet typedef
+        typedef GenericTLVPacketParser parser;               ///< typedef to the parser of GenericTLV packet
 
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
         
-        static void finalize(packet p);
-        static void dump(packet p, std::ostream & os);
+        /** \brief Dump given GenericTLVPacket in readable form to given output stream */
+        static void dump(packet p, std::ostream & os);  
+        static void finalize(packet p);  ///< Finalize packet.
+                                         /**< shrink size of length field to minimum 
+                                              \see BaseTLVPacketParser::shrinkLength() */
+        
     };
     
+    /** \brief GenericTLV packet typedef */
     typedef ConcretePacket<GenericTLVPacketType> GenericTLVPacket;
 }
 
index 8286e88..4332391 100644 (file)
@@ -85,7 +85,6 @@ namespace senf {
             \ref PacketRegistry
      */
     struct EtherTypes {
-        // See 
         typedef boost::uint16_t key_t;
     };
 
@@ -110,7 +109,9 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<EthernetPacketType, EtherTypes>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<EthernetPacketType, EtherTypes> mixin;
+#endif
         typedef ConcretePacket<EthernetPacketType> packet;
         typedef EthernetPacketParser parser;
 
@@ -119,7 +120,8 @@ namespace senf {
         using mixin::init;
 
         static factory_t nextPacketType(packet p);
-        static void dump(packet p, std::ostream & os);
+        /// Dump given EthernetPacket in readable form to given output stream
+        static void dump(packet p, std::ostream & os); 
         static void finalize(packet p);
     };
 
@@ -166,7 +168,9 @@ namespace senf {
         : public PacketTypeBase, 
           public PacketTypeMixin<EthVLanPacketType, EtherTypes>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<EthVLanPacketType, EtherTypes> mixin;
+#endif
         typedef ConcretePacket<EthVLanPacketType> packet;
         typedef EthVLanPacketParser parser;
 
@@ -180,6 +184,7 @@ namespace senf {
         static key_t nextPacketKey(packet p) 
             { return p->type(); }
 
+        /// Dump given EthVLanPacket in readable form to given output stream
         static void dump(packet p, std::ostream & os);
         static void finalize(packet p);
     };
index 0dc7917..e124ee4 100644 (file)
@@ -60,6 +60,8 @@ namespace senf {
 
         Parser implementing the IPv4 header.
         
+        \image html IPv4Packet.png
+                
         \see IPv4PacketType \n
             <a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
 
@@ -76,10 +78,10 @@ namespace senf {
         SENF_PARSER_FIELD( length,      UInt16Parser       );
         SENF_PARSER_FIELD( identifier,  UInt16Parser       );
 
-        SENF_PARSER_BITFIELD( reserved,  1, bool     );
-        SENF_PARSER_BITFIELD( df,        1, bool     );
-        SENF_PARSER_BITFIELD( mf,        1, bool     );
-        SENF_PARSER_BITFIELD( frag,     13, unsigned );
+        SENF_PARSER_PRIVATE_BITFIELD( reserved,  1, bool     );
+        SENF_PARSER_BITFIELD        ( df,        1, bool     );
+        SENF_PARSER_BITFIELD        ( mf,        1, bool     );
+        SENF_PARSER_BITFIELD        ( frag,     13, unsigned );
 
         SENF_PARSER_FIELD( ttl,         UInt8Parser        );
         SENF_PARSER_FIELD( protocol,    UInt8Parser        );
@@ -95,11 +97,16 @@ namespace senf {
 
         SENF_PARSER_FINALIZE(IPv4PacketParser);
         
-        boost::uint16_t calcChecksum() const;
+        boost::uint16_t calcChecksum() const; ///< calculate header checksum
+                                              /**< calculate and return the checksum of the header
+                                                   \see \ref senf::IpChecksum */
 
         bool validateChecksum() const {
             return checksum() == calcChecksum();
-        }
+        }                               ///< validate header checksum
+                                        /**< return \c true if the \ref checksum() "checksum" 
+                                             field is equal to the \ref calcChecksum() 
+                                             "calculated checksum" */
     };
 
     /** \brief IP protocol number registry
@@ -114,6 +121,12 @@ namespace senf {
     };
 
     /** \brief IPv4 packet
+        
+        \par Packet type (typedef):
+            \ref IPv4Packet
+
+        \par Fields:
+            see \ref IPv4PacketParser
 
         <table class="packet" cellpadding="5" cellspacing="1" border="1">
           <tr>
@@ -129,7 +142,7 @@ namespace senf {
             <td colspan="8">\ref IPv4PacketParser::length() "Length"</td> 
           </tr><tr>
             <td colspan="4">\ref IPv4PacketParser::identifier() "Identifier"</td>
-            <td>\ref IPv4PacketParser::reserved() "R"</td>
+            <td>R</td>
             <td>\ref IPv4PacketParser::df() "DF"</td>
             <td>\ref IPv4PacketParser::mf() "MF"</td>
             <td colspan="5">\ref IPv4PacketParser::frag() "Fragment Offset"</td>
@@ -143,23 +156,13 @@ namespace senf {
             <td colspan="12">\ref IPv4PacketParser::destination() "Destination Address"</td>
           </tr>
         </table>
-        
-        \par Packet type (typedef):
-            \ref IPv4Packet
-
-        \par Fields:
-            \ref IPv4PacketParser
 
         \par Associated registries:
             \ref IpTypes
 
         \par Finalize action:
-            Set \a length from payload size\n
-            Set \a protocol from type of next packet if found in \ref IpTypes\n
-            Calculate \a checksum
-
-        \image html IPv4Packet.png
-
+            \copydetails finalize()
         \ingroup protocolbundle_default
      */
     struct IPv4PacketType
@@ -168,9 +171,10 @@ namespace senf {
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<IPv4PacketType, IpTypes> mixin;
-        typedef ConcretePacket<IPv4PacketType> packet;
-        typedef IPv4PacketParser parser;
 #endif
+        typedef ConcretePacket<IPv4PacketType> packet;  ///< IPv4 packet typedef
+        typedef IPv4PacketParser parser;                ///< typedef to the parser of IPv4 packet
+
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
         using mixin::initSize;
@@ -178,11 +182,19 @@ namespace senf {
 
         static key_t nextPacketKey(packet p) 
             { return p->protocol(); }
-
-        static void dump(packet p, std::ostream & os);
-        static void finalize(packet p);
-    };
         
+        /** \brief Dump given IPv4Packet in readable form to given output stream */
+        static void dump(packet p, std::ostream & os); 
+        
+        static void finalize(packet p); ///< Finalize packet.
+                                        /**< \li set \ref IPv4PacketParser::length() "length" 
+                                               from payload size
+                                             \li set \ref IPv4PacketParser::protocol() "protocol" 
+                                               from type of next packet if found in \ref IpTypes
+                                             \li calculate and set 
+                                               \ref IPv4PacketParser::checksum() "checksum" */
+    };
+
     /** \brief IPv4 packet typedef */
     typedef ConcretePacket<IPv4PacketType> IPv4Packet;
 }
@@ -191,7 +203,7 @@ namespace senf {
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
 #ifndef SENF_PACKETS_DECL_ONLY
-//#include IPv4Packet.cci"
+//#include "IPv4Packet.cci"
 //#include "IPv4Packet.ct"
 //#include "IPv4Packet.cti"
 #endif
index 423e19f..9f1eb94 100644 (file)
@@ -54,7 +54,6 @@ BOOST_AUTO_UNIT_TEST(ipV4Packet_packet)
     BOOST_CHECK_EQUAL( p->tos(),         0x02u       );
     BOOST_CHECK_EQUAL( p->length(),      0x0304u     );
     BOOST_CHECK_EQUAL( p->identifier(),  0x0506u     );
-    BOOST_CHECK_EQUAL( p->reserved(),    0           );
     BOOST_CHECK_EQUAL( p->df(),          0           );
     BOOST_CHECK_EQUAL( p->mf(),          0           );
     BOOST_CHECK_EQUAL( p->frag(),        0x0708u     );
index d2e9de0..4a88310 100644 (file)
@@ -37,6 +37,7 @@ namespace senf {
     /** \brief Parse in IPv6 fragment extension header
         
         Parser implementing the IPv6 fragment extension. The fields implemented are:
+        \image html IPv6Extensions_Fragment.png
 
         \see IPv6ExtensionType_Fragment \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
@@ -66,13 +67,11 @@ namespace senf {
             \ref IPv6PacketParserExtension_Fragment
         
         \par Associated registries:
-            \par IpTypes
+            \ref IpTypes
         
         \par Finalize action:
             Set \a nextHeader from type of next packet if found in \ref IpTypes
 
-        \image html IPv6Extensions_Fragment.png
-
         \ingroup protocolbundle_default
      */
     struct IPv6ExtensionType_Fragment
@@ -81,9 +80,12 @@ namespace senf {
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes> mixin;
-        typedef ConcretePacket<IPv6ExtensionType_Fragment> packet;
-        typedef IPv6PacketParserExtension_Fragment parser;
 #endif
+        /** \brief IPv6 fragment extension packet typedef */
+        typedef ConcretePacket<IPv6ExtensionType_Fragment> packet; 
+        /** \brief typedef to the parser of IPv6 fragment extension packet */
+        typedef IPv6PacketParserExtension_Fragment parser;
+
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
         using mixin::initSize;
@@ -92,10 +94,11 @@ namespace senf {
         static key_t nextPacketKey(packet p) 
             { return p->nextHeader(); }
         
-        static void dump(packet p, std::ostream & os);
+        /** \brief Dump given IPv6Extension_Fragment in readable form to given output stream */
+        static void dump(packet p, std::ostream & os); 
 
-        static void finalize(packet p)
-            { p->nextHeader() << key(p.next(nothrow)); }
+        static void finalize(packet p) { 
+            p->nextHeader() << key(p.next(nothrow)); }
     };
 
     /** \brief IPv6 fragment extension packet typedef */
index 97f79ab..2ce41a6 100644 (file)
@@ -59,6 +59,7 @@ namespace senf {
 
     /** \brief Parse an IPv6 packet
 
+        \image html IPv6Packet.png
         \see IPv6PacketType \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
      */
@@ -91,14 +92,34 @@ namespace senf {
         \par Fields:
             \ref IPv6PacketParser
 
+        <table class="packet" cellpadding="5" cellspacing="1" border="1">
+          <tr>
+            <th width="12.5%">0</th>  <th width="12.5%">4</th> <th width="12.5%">8</th>
+            <th width="12.5%">12</th> <th width="12.5%">16</th> <th width="12.5%">20</th>
+            <th width="12.5%">24</th> <th width="6.5%">28</th>
+            <th style="text-align:right" width="6%">31</th>
+          </tr><tr>
+            <td>\ref IPv6PacketParser::version() "Version"</td>
+            <td colspan="2">\ref IPv6PacketParser::trafficClass() "Traffic Class"</td>
+            <td colspan="6">\ref IPv6PacketParser::flowLabel() "Flow Label"</td>
+          </tr><tr>
+            <td colspan="4">\ref IPv6PacketParser::length() "Payload Length"</td>
+            <td colspan="2">\ref IPv6PacketParser::nextHeader() "Next Header"</td>
+            <td colspan="3">\ref IPv6PacketParser::hopLimit() "Hop Limit"</td>
+          </tr><tr>
+            <td colspan="9" style="height:8em">
+              \ref IPv6PacketParser::source() "Source Address"</td>
+          </tr><tr>
+            <td colspan="9" style="height:8em">
+              \ref IPv6PacketParser::destination()  "Destination Address"</td>
+          </tr>
+        </table>
+          
         \par Associated registries:
             \ref IpTypes
 
         \par Finalize action:
-            Set \a length from payload size\n
-            Set \a nextHeader from type of next packet if found in \ref IpTypes
-
-        \image html IPv6Packet.png
+            \copydetails finalize()
 
         \ingroup protocolbundle_default
      */
@@ -108,9 +129,10 @@ namespace senf {
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<IPv6PacketType, IpTypes> mixin;
-        typedef ConcretePacket<IPv6PacketType> packet;
-        typedef IPv6PacketParser parser;
 #endif
+        typedef ConcretePacket<IPv6PacketType> packet; ///< IPv6 packet typedef
+        typedef IPv6PacketParser parser;               ///< typedef to the parser of IPv6 packet
+
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
         using mixin::initSize;
@@ -119,9 +141,15 @@ namespace senf {
         static key_t nextPacketKey(packet p) 
             { return p->nextHeader(); }
         
-        static void dump(packet p, std::ostream & os);
-
-        static void finalize(packet p);
+        /** \brief Dump given IPv6Packet in readable form to given output stream */
+        static void dump(packet p, std::ostream & os); 
+        
+        static void finalize(packet p); ///< Finalize packet.
+                                        /**< \li set \ref IPv6PacketParser::length() "length" 
+                                               from payload size
+                                             \li set \ref IPv6PacketParser::nextHeader() 
+                                               "nextHeader" from type of next packet if found 
+                                               in \ref IpTypes */
     };
 
     /** \brief IPv6 packet typedef */
index df1d155..5d0f7e9 100644 (file)
@@ -38,6 +38,7 @@ namespace senf {
 
     /** \brief Parse a LLC/SNAP header
         
+        \image html LlcSnapPacket.png
         \todo document me
      */
     struct LlcSnapPacketParser : public PacketParserBase
@@ -77,8 +78,6 @@ namespace senf {
         \par Finalize action:
             XXXX
 
-        \image html LlcSnapPacket.png
-
         \ingroup protocolbundle_default
      */
     struct LlcSnapPacketType
@@ -87,18 +86,21 @@ namespace senf {
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<LlcSnapPacketType, EtherTypes> mixin;
-        typedef ConcretePacket<LlcSnapPacketType> packet;
-        typedef LlcSnapPacketParser parser;
 #endif
+        typedef ConcretePacket<LlcSnapPacketType> packet; ///< LLC/SNAP packet typedef
+        typedef LlcSnapPacketParser parser;               ///< typedef to the parser of LLC/SNAP packet
+
         using mixin::nextPacketRange;
         using mixin::initSize;
         using mixin::init;
         
         static factory_t nextPacketType(packet p);
-        static void dump(packet p, std::ostream & os);
+        /** \brief Dump given LlcSnapPacket in readable form to given output stream */
+        static void dump(packet p, std::ostream & os); 
         static void finalize(packet p);
     };
 
+    /** \brief LLC/SNAP packet typedef */
     typedef ConcretePacket<LlcSnapPacketType> LlcSnapPacket;
 }
 
index 1aeb6a5..b26eabe 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: main.test.cc 206 2008-06-08 14:20:52Z pug $
+// $Id$
 //
 // Copyright (C) 2006
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
index a09a89f..4e512ab 100644 (file)
@@ -1,9 +1,9 @@
-// $Id: main.test.cc 206 2008-08-06 14:20:52Z pug $
+// $Id$
 //
-// Copyright (C) 2006
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
-//     Stefan Bund <g0dil@berlios.de>
+//     Philipp Batroff <pug@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+/** \file 
+    \brief RTPPacket non-inline non-template implementation */
 
-// Custom includes
 #include "RTPPacket.hh"
-#include "../../Packets/Packets.hh"
-#include "../../Scheduler/ClockService.hh"
-#include <boost/io/ios_state.hpp>
+//#include "UDPPacket.ih"
 
+// Custom includes
+#include <boost/io/ios_state.hpp>
 
 #define prefix_
 
index c65360e..403d994 100644 (file)
@@ -1,9 +1,9 @@
-// $Id: main.test.cc 206 2008-08-06 14:20:52Z pug $
+// $Id$
 //
 // Copyright (C) 2006
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
-//     Stefan Bund <g0dil@berlios.de>
+//     Philipp Batroff <pug@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -20,7 +20,8 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+/** \file
+    \brief RTPPacket public header */
 
 // Custom includes
 #ifndef HH_SENF_Packets_DefaultBundle_RTPPacket_
 
 #include "../../Packets/Packets.hh"
 #include "../../Socket/Protocols/INet/INet6Address.hh"
-#include "../../Socket/Protocols/INet.hh"
-#include "../../Utils/Logger/SenfLog.hh"
+
 
 namespace senf {
     
-    struct RTPPacketParser : public senf::PacketParserBase
+    struct RTPPacketParser : public PacketParserBase
     {
-        SENF_LOG_CLASS_AREA();
 #       include SENF_PARSER()
         SENF_PARSER_BITFIELD  ( version,        2, unsigned     );      //Version (RFC 3550)
         SENF_PARSER_BITFIELD  ( padding,        1, bool         );      //1 if padding behind payload
@@ -43,22 +42,21 @@ namespace senf {
         SENF_PARSER_BITFIELD_RO  ( csrcCount,      4, unsigned     );   //0-15,define the number of contributing sources
         SENF_PARSER_BITFIELD  ( marker,         1, bool         );      //Marker M=1, used to signal speech silent compression; further use in combination with PT to be defined
         SENF_PARSER_BITFIELD  ( payloadType,    7, unsigned     );      //Payload Type; e.g. PCM=8 (RFC 3550)
-        SENF_PARSER_FIELD     ( seqNumber,      senf::UInt16Parser );   //random number to identify initial segment of  a stream, increment by 1 used to resequence segments at receiver
-        SENF_PARSER_FIELD     ( timeStamp,      senf::UInt32Parser );   //signals sampling time of 1st byte of payload; initialised; used to calculate Jitter between segments
-        SENF_PARSER_FIELD     ( synSourceId,    senf::UInt32Parser );   //Synchronisation source identifier; identifier of RFTP stream source (random number) in case of conferencing identifier of mixer
-        SENF_PARSER_VECTOR    (csrcOpt, csrcCount, senf::UInt32Parser );
+        SENF_PARSER_FIELD     ( seqNumber,      UInt16Parser );   //random number to identify initial segment of  a stream, increment by 1 used to resequence segments at receiver
+        SENF_PARSER_FIELD     ( timeStamp,      UInt32Parser );   //signals sampling time of 1st byte of payload; initialised; used to calculate Jitter between segments
+        SENF_PARSER_FIELD     ( synSourceId,    UInt32Parser );   //Synchronisation source identifier; identifier of RFTP stream source (random number) in case of conferencing identifier of mixer
+        SENF_PARSER_VECTOR    (csrcOpt, csrcCount, UInt32Parser );
         
         bool valid() const {return version() == 2;}
         SENF_PARSER_FINALIZE(RTPPacketParser);
     };
     
     struct RTPPacketType 
-        : public senf::PacketTypeBase,
-          public senf::PacketTypeMixin<RTPPacketType>
+        : public PacketTypeBase,
+          public PacketTypeMixin<RTPPacketType>
     {
-        SENF_LOG_CLASS_AREA();
-        typedef senf::PacketTypeMixin<RTPPacketType> mixin;
-        typedef senf::ConcretePacket<RTPPacketType> packet;
+        typedef PacketTypeMixin<RTPPacketType> mixin;
+        typedef ConcretePacket<RTPPacketType> packet;
         typedef RTPPacketParser parser;
     
         using mixin::nextPacketRange;
index 8a8446f..9cff4af 100644 (file)
@@ -1,9 +1,9 @@
-// $Id: main.test.cc 206 2008-08-06 14:20:52Z pug $
+// $Id$
 //
-// Copyright (C) 2006
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
-//     Stefan Bund <g0dil@berlios.de>
+//     Philipp Batroff <pug@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+// Unit tests
 
 // Custom includes
+#include "RTPPacket.hh"
 
-#include "../../Packets/Packets.hh"
 #include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
-#include "RTPPacket.hh"
+
+
 BOOST_AUTO_UNIT_TEST(RTPPacket_packet)
 {
     unsigned char data[] = {0x80 , 0x08 , 0x1b , 0xbb , 0x02 , 0xcb , 0xad , 0x80 , 0x50 , 0x48 , 0xa7, 0x8c };
index fb71f44..e85c182 100644 (file)
@@ -37,7 +37,8 @@ namespace senf {
     /** \brief Parse a UDP packet
 
         Parser implementing the UDP header. The fields implemented are:
-
+        \image html UDPPacket.png
+        
         \see UDPPacketType \n
             <a href="http://tools.ietf.org/html/rfc768">RFC 768</a>
      */
@@ -52,11 +53,14 @@ namespace senf {
 
         SENF_PARSER_FINALIZE(UDPPacketParser);
 
-        boost::uint16_t calcChecksum() const;
-
+        boost::uint16_t calcChecksum() const; ///< calculate (pseudo-)header checksum
+                                              /**< calculate and return the checksum of the
+                                                   (pseudo-)header \see \ref senf::IpChecksum */
         bool validateChecksum() const {
             return checksum() == 0u || checksum() == calcChecksum();
-        }
+        }                               ///< validate header checksum
+                                        /**< return \c true if the \ref checksum() "checksum"
+                                             field is equal to the \ref calcChecksum() "calculated checksum" */
     };
 
     /** \brief UDP packet
@@ -67,11 +71,21 @@ namespace senf {
         \par Fields:
             \ref UDPPacketParser
 
+        <table class="packet" cellpadding="5" cellspacing="1" border="1">
+          <tr>
+            <th width="25%">0</th> <th width="25%">8</th> <th width="25%">16</th>
+            <th width="15%">24</th> <th style="text-align:right" width="10%">31</th>
+          </tr><tr>
+            <td colspan="2">\ref UDPPacketParser::source() "Source Port"</td>
+            <td colspan="3">\ref UDPPacketParser::destination() "Destination Port"</td>
+          </tr><tr>
+            <td colspan="2">\ref UDPPacketParser::length() "Length"</td>
+            <td colspan="3">\ref UDPPacketParser::checksum() "Checksum"</td>
+          </tr>
+        </table>
+          
         \par Finalize action:
-            Set \a length from payload size\n
-            Calculate \a checksum
-
-        \image html UDPPacket.png
+            \copydetails finalize()
 
         \ingroup protocolbundle_default
      */
@@ -81,16 +95,22 @@ namespace senf {
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<UDPPacketType> mixin;
-        typedef ConcretePacket<UDPPacketType> packet;
-        typedef UDPPacketParser parser;
 #endif
+        typedef ConcretePacket<UDPPacketType> packet; ///< UDP packet typedef
+        typedef UDPPacketParser parser;               ///< typedef to the parser of UDP packet
+
         using mixin::nextPacketRange;
         using mixin::initSize;
         using mixin::init;
 
+        /** \brief Dump given UDPPacket in readable form to given output stream */
         static void dump(packet p, std::ostream & os);
-
-        static void finalize(packet p);
+        
+        static void finalize(packet p); ///< Finalize packet.
+                                        /**< \li set \ref UDPPacketParser::length() "length" from 
+                                               payload size
+                                             \li calculate and set \ref UDPPacketParser::checksum() 
+                                               "checksum" */
     };
 
     /** \brief UDP packet typedef */
@@ -101,7 +121,7 @@ namespace senf {
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
 #ifndef SENF_PACKETS_DECL_ONLY
-//#include UDPPacket.cci"
+//#include "UDPPacket.cci"
 //#include "UDPPacket.ct"
 //#include "UDPPacket.cti"
 #endif
index e617691..5b80e05 100644 (file)
@@ -121,20 +121,27 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<MPESectionType>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<MPESectionType> mixin;
-        typedef ConcretePacket<MPESectionType> packet;
-        typedef MPESectionParser parser;
+#endif
+        typedef ConcretePacket<MPESectionType> packet; ///< MPESection packet typedef
+        typedef MPESectionParser parser;               ///< typedef to the parser of MPESection
 
         using mixin::nextPacketRange;
         using mixin::init;
 
+        /** \brief Dump given MPESection in readable form to given output stream */
         static void dump(packet p, std::ostream & os);
+        
         static void finalize(packet p);
+        
         static factory_t nextPacketType(packet p);
+        
         static PacketParserBase::size_type initSize();
         static PacketParserBase::size_type initHeadSize();
     };
 
+    /** \brief MPESection packet typedef */
     typedef ConcretePacket<MPESectionType> MPESection;
 }
 
diff --git a/Packets/MPEGDVBBundle/TLV.dia b/Packets/MPEGDVBBundle/TLV.dia
deleted file mode 100644 (file)
index 77dc6eb..0000000
Binary files a/Packets/MPEGDVBBundle/TLV.dia and /dev/null differ
index 13eff46..38200d5 100644 (file)
 
 namespace senf {
 
-//    struct PSIPayloadPacketParser : public PacketParserBase
-//    {
-//        static const size_type fixed_bytes = 184;
-//
-//    };
-
-
     /** \brief Parse a Transport Stream packet
 
         Parser implementing the header of a MPEG Transport Stream packet.
+        \image html TransportPacket.png
         
         \see TransportPacketType
      */
@@ -117,7 +111,6 @@ namespace senf {
 
         \par Fields:
             \ref TransportPacketParser
-            \image html TransportPacket.png
 
         \ingroup protocolbundle_mpegdvb
      */
@@ -125,14 +118,17 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<TransportPacketType>
     {
+#ifndef DOXYGEN
         typedef PacketTypeMixin<TransportPacketType> mixin;
-        typedef ConcretePacket<TransportPacketType> packet;
-        typedef TransportPacketParser parser;
+#endif
+        typedef ConcretePacket<TransportPacketType> packet; ///< Transport packet typedef
+        typedef TransportPacketParser parser; ///< typedef to the parser of Transport packet
     
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
         
+        /** \brief Dump given Transport packet in readable form to given output stream */
         static void dump(packet p, std::ostream & os);
         static const byte SYNC_BYTE = 0x47;
     };
index 21b1900..640269c 100644 (file)
@@ -11,7 +11,7 @@ SENFSCons.StandardTargets(env)
 SENFSCons.Lib(env, sources)
 SENFSCons.Doxygen(env, extra_sources = [
     env.Dia2Png("structure.dia"),
-    env.Dia2Png("MPEGDVBBundle/TLV.dia"),
+    env.Dia2Png("80221Bundle/TLV.dia"),
     env.PkgDraw("MPEGDVBBundle/DTCPPacket.hh"),
     env.PkgDraw("DefaultBundle/EthernetPacket.hh",
                 PKGDRAWPACKETS = "EthernetPacketParser"),
index dcf5af8..73df063 100644 (file)
@@ -51,10 +51,6 @@ namespace senf {
                                              received from the network. This allows precise network
                                              timing.
 
-                                             The returned value can be converted to the
-                                             senf::ClockService::clock_type representation using
-                                             semf::ClockService::from_timeval().
-
                                              \pre The \c SO_TIMESTAMP socket option must not be set
                                                  on the socket.
                                              \returns timestamp when last packet was received */