X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMPEGDVBBundle%2FDatagramSection.hh;h=bf5d87a32e968331fac0de7a7f903da32b11c688;hb=ab243554f940af9f873e1a920d0a6b7886c6f5cf;hp=467fdbd94ea94358e6390f3e7d7aaf91629d8bff;hpb=f42f550e611b7cb1f0c729c12b09931319a7d41c;p=senf.git diff --git a/Packets/MPEGDVBBundle/DatagramSection.hh b/Packets/MPEGDVBBundle/DatagramSection.hh index 467fdbd..bf5d87a 100644 --- a/Packets/MPEGDVBBundle/DatagramSection.hh +++ b/Packets/MPEGDVBBundle/DatagramSection.hh @@ -3,7 +3,7 @@ // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Thorsten Horstmann // // 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,16 +20,16 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \brief + \file DatagramSection public header */ + #ifndef HH_DatagramSection_ #define HH_DatagramSection_ 1 // Custom includes #include -#include "Packets/PacketType.hh" -#include "Packets/ParseInt.hh" -#include "Packets/PacketRegistry.hh" -#include "Packets/PacketParser.hh" -#include "Packets/MPEGDVBBundle/DSMCCSection.hh" +#include "../../Packets/Packets.hh" +#include "DSMCCSection.hh" //#include "DatagramSection.mpp" @@ -37,46 +37,47 @@ namespace senf { - ///\addtogroup protocolbundle_mpegdvb - ///@{ - + /** \brief Parse a Datagram Section + + Parser implementing the Datagram Section. + + \see DatagramSectionType + */ struct Parse_DatagramSection : public Parse_DSMCCSection { - //SENF_PACKET_PARSER_NO_INIT(Parse_DatagramSection); - Parse_DatagramSection(data_iterator i, state_type s) : senf::Parse_DSMCCSection(i,s) {} - - /////////////////////////////////////////////////////////////////////////// - - typedef Parse_UIntField < 2, 4 > Parse_payload_scrmbl_ctrl; - typedef Parse_UIntField < 4, 6 > Parse_addr_scrmbl_ctrl; - typedef Parse_Flag < 6 > Parse_llc_snap_flag; - - SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS_OFFSET(Parse_DSMCCSection::fixed_bytes, - ((Field ) ( mac_addr_4, Parse_UInt8 )) - ((Field ) ( mac_addr_3, Parse_UInt8 )) - ((Field ) ( mac_addr_2, Parse_UInt8 )) - ((Field ) ( mac_addr_1, Parse_UInt8 )) - ); - - Parse_UInt8 mac_addr_6() const { return parse( 3 ); } - Parse_UInt8 mac_addr_5() const { return parse( 4 ); } - Parse_payload_scrmbl_ctrl payload_scrmbl_ctrl() const { - return parse( 5 ); - } - Parse_addr_scrmbl_ctrl addr_scrmbl_ctrl() const { - return parse( 5 ); - } - Parse_llc_snap_flag llc_snap_flag() const { - return parse( 5 ); - } - - void init() - { - Parse_DSMCCSection::init(); - defaultInit(); - } +# include SENF_FIXED_PARSER() + + SENF_PARSER_INHERIT( Parse_DSMCCSection ); + + SENF_PARSER_FIELD ( mac_addr_4 , Parse_UInt8 ); + SENF_PARSER_FIELD ( mac_addr_3 , Parse_UInt8 ); + SENF_PARSER_FIELD ( mac_addr_2 , Parse_UInt8 ); + SENF_PARSER_FIELD ( mac_addr_1 , Parse_UInt8 ); + + SENF_PARSER_FINALIZE( Parse_DatagramSection ); + + // Parse table_id_extension as two bytes + SENF_PARSER_GOTO( table_id_extension ); + SENF_PARSER_FIELD ( mac_addr_6 , Parse_UInt8 ); + SENF_PARSER_FIELD ( mac_addr_5 , Parse_UInt8 ); + + // Divide 5 bit version_num field into several subfields. + SENF_PARSER_SKIP_BITS( 2 ); + SENF_PARSER_BITFIELD ( payload_scrmbl_ctrl , 2, unsigned ); + SENF_PARSER_BITFIELD ( addr_scrmbl_ctrl , 2, unsigned ); + SENF_PARSER_BITFIELD ( llc_snap_flag , 1, bool ); }; + /** \brief Datagram Section + + \par Packet type (typedef): + \ref DatagramSection + + \par Fields: + \ref Parse_DatagramSection + + \ingroup protocolbundle_mpegdvb + */ struct DatagramSectionType : public DSMCCSectionType, public PacketTypeMixin @@ -86,8 +87,6 @@ namespace senf { typedef Parse_DatagramSection parser; using mixin::nextPacketRange; -// using mixin::nextPacketType; - //using mixin::initSize; using mixin::init; static void dump(packet p, std::ostream & os); @@ -97,8 +96,6 @@ namespace senf { }; typedef DatagramSectionType::packet DatagramSection; - - ///@} }