00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #ifndef HH_SENF_Packets_MPEGDVBBundle_SNDUPacket_
00027 #define HH_SENF_Packets_MPEGDVBBundle_SNDUPacket_ 1
00028
00029
00030 #include <boost/crc.hpp>
00031 #include <senf/Packets/Packets.hh>
00032 #include <senf/Packets/DefaultBundle/EthernetPacket.hh>
00033
00034
00035
00036
00037 namespace senf {
00038
00045 struct SNDUPacketParser : public PacketParserBase
00046 {
00047 # include SENF_PARSER()
00048
00049
00050
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
00097 {
00098
00099 typedef ConcretePacket<SNDUPacketType> packet;
00100 typedef SNDUPacketParser parser;
00101
00102
00103
00104
00105
00106
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
00137
00138
00139 #endif
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150