%/test %/doc:
$(SCONS) $@
+%/build:
+ $(SCONS) $*
+
#----------------------------------------------------------------------
# Subversion stuff
#----------------------------------------------------------------------
// 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
{
}
};
+ /** \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()
\par Fields:
\ref MIHPacketParser
- \image html MIHPacket.png
\ingroup protocolbundle_80221
*/
: 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;
: 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;
-
-
}
};
+ /** \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()
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;
}
\ref PacketRegistry
*/
struct EtherTypes {
- // See
typedef boost::uint16_t key_t;
};
: public PacketTypeBase,
public PacketTypeMixin<EthernetPacketType, EtherTypes>
{
+#ifndef DOXYGEN
typedef PacketTypeMixin<EthernetPacketType, EtherTypes> mixin;
+#endif
typedef ConcretePacket<EthernetPacketType> packet;
typedef EthernetPacketParser parser;
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);
};
: public PacketTypeBase,
public PacketTypeMixin<EthVLanPacketType, EtherTypes>
{
+#ifndef DOXYGEN
typedef PacketTypeMixin<EthVLanPacketType, EtherTypes> mixin;
+#endif
typedef ConcretePacket<EthVLanPacketType> packet;
typedef EthVLanPacketParser parser;
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);
};
Parser implementing the IPv4 header.
+ \image html IPv4Packet.png
+
\see IPv4PacketType \n
<a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
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 );
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
};
/** \brief IPv4 packet
+
+ \par Packet type (typedef):
+ \ref IPv4Packet
+
+ \par Fields:
+ see \ref IPv4PacketParser
<table class="packet" cellpadding="5" cellspacing="1" border="1">
<tr>
<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>
<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
{
#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;
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;
}
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
-//#include IPv4Packet.cci"
+//#include "IPv4Packet.cci"
//#include "IPv4Packet.ct"
//#include "IPv4Packet.cti"
#endif
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 );
/** \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>
\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
{
#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;
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 */
/** \brief Parse an IPv6 packet
+ \image html IPv6Packet.png
\see IPv6PacketType \n
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
\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
*/
{
#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;
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 */
/** \brief Parse a LLC/SNAP header
+ \image html LlcSnapPacket.png
\todo document me
*/
struct LlcSnapPacketParser : public PacketParserBase
\par Finalize action:
XXXX
- \image html LlcSnapPacket.png
-
\ingroup protocolbundle_default
*/
struct LlcSnapPacketType
{
#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;
}
-// $Id: main.test.cc 206 2008-06-08 14:20:52Z pug $
+// $Id$
//
// Copyright (C) 2006
// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// $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_
-// $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
// 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
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;
-// $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 };
/** \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>
*/
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
\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
*/
{
#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 */
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
-//#include UDPPacket.cci"
+//#include "UDPPacket.cci"
//#include "UDPPacket.ct"
//#include "UDPPacket.cti"
#endif
: 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;
}
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
*/
\par Fields:
\ref TransportPacketParser
- \image html TransportPacket.png
\ingroup protocolbundle_mpegdvb
*/
: 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;
};
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"),
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 */