Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MPEGDVBBundle/SNDUPacket.hh

Go to the documentation of this file.
00001 // $Id: SNDUPacket.hh 1754 2010-12-09 15:45:42Z tho $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Thorsten Horstmann <tho@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Packets_MPEGDVBBundle_SNDUPacket_
00027 #define HH_SENF_Packets_MPEGDVBBundle_SNDUPacket_ 1
00028 
00029 // Custom includes
00030 #include <boost/crc.hpp>
00031 #include <senf/Packets/Packets.hh>
00032 #include <senf/Packets/DefaultBundle/EthernetPacket.hh>
00033 
00034 //#include "SNDUPacket.mpp"
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 
00037 namespace senf {
00038 
00045     struct SNDUPacketParser : public PacketParserBase
00046     {
00047 #       include SENF_PARSER()
00048 
00049         /* We first define the fields as they appear in the field. Some of the fields are declared
00050            private. We provide custom accessors for those fields further down. */
00051 
00052         SENF_PARSER_PRIVATE_BITFIELD ( d_bit_       ,  1 , unsigned );
00053         SENF_PARSER_BITFIELD         ( length       , 15 , unsigned );
00054         SENF_PARSER_FIELD            ( type         , UInt16Parser  );
00055         SENF_PARSER_PRIVATE_VARIANT  ( destination_ , d_bit_        ,
00056                                                       (MACAddressParser) (VoidPacketParser) );
00057 
00058         SENF_PARSER_FINALIZE( SNDUPacketParser );
00059 
00060         MACAddressParser destination()  
00061             { return destination_().get<0>(); }
00062 
00063         bool d_bit()                    
00064             { return d_bit_(); }
00065 
00066         void withDestination()          
00067             { destination_().init<0>(); }
00068 
00069         void withoutDestination()       
00070             { destination_().init<1>(); }
00071 
00072         UInt32Parser crc()
00073             { return parse<UInt32Parser>( data().size() - 4 ); }
00074 
00075         boost::uint32_t calcCrc() const;
00076     };
00077 
00078 
00079     struct ULEExtHeaderTypes {
00080         typedef boost::uint16_t key_t;
00081     };
00082 
00094     struct SNDUPacketType
00095         : public PacketTypeBase
00096 //          public PacketTypeMixin<SNDUPacketType, ULEExtHeaderTypes>
00097     {
00098 //        typedef PacketTypeMixin<SNDUPacketType, ULEExtHeaderType> mixin;
00099         typedef ConcretePacket<SNDUPacketType> packet;
00100         typedef SNDUPacketParser parser;
00101 
00102 //        using mixin::nextPacketRange;
00103 //        using mixin::nextPacketType;
00104 //        using mixin::init;
00105 
00106 //        static key_t nextPacketKey(packet p);
00107 
00108         static void init(packet p);
00109 
00110         static factory_t nextPacketType(packet p);
00111 
00112         static optional_range nextPacketRange(packet p);
00113 
00114         static void dump(packet p, std::ostream & os);
00115 
00116         static PacketParserBase::size_type initSize();
00117 
00118         static PacketParserBase::size_type initHeadSize();
00119     };
00120 
00121     typedef SNDUPacketType::packet SNDUPacket;
00122 
00123     typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> ule_crc32;
00124 
00125 
00131 #   define ULE_END_INDICATOR 0xffff
00132 }
00133 
00134 
00135 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00136 //#include "SNDUPacket.cci"
00137 //#include "SNDUPacket.ct"
00138 //#include "SNDUPacket.cti"
00139 #endif
00140 
00141 
00142 // Local Variables:
00143 // mode: c++
00144 // fill-column: 100
00145 // c-file-style: "senf"
00146 // indent-tabs-mode: nil
00147 // ispell-local-dictionary: "american"
00148 // compile-command: "scons -u test"
00149 // comment-column: 40
00150 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research