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_GREPacket_
00027 #define HH_SENF_Packets_MPEGDVBBundle_GREPacket_ 1
00028
00029
00030 #include <senf/Packets/DefaultBundle/EthernetPacket.hh>
00031
00032
00033
00034
00035 namespace senf {
00036
00043 struct GREChecksumParser : public PacketParserBase {
00044 # include SENF_PARSER()
00045 SENF_PARSER_FIELD ( checksum1_, UInt16Parser );
00046 SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt16Parser );
00047 SENF_PARSER_FINALIZE(GREChecksumParser);
00048 };
00049
00050 struct GREPacketParser : public PacketParserBase
00051 {
00052 # include SENF_PARSER()
00053
00054 SENF_PARSER_BITFIELD ( checksum_present, 1, bool );
00055 SENF_PARSER_PRIVATE_BITFIELD ( reserved0_, 12, unsigned );
00056 SENF_PARSER_BITFIELD ( version_number, 3, unsigned );
00057 SENF_PARSER_FIELD ( protocol_type, UInt16Parser );
00058 SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present,
00059 (VoidPacketParser) (GREChecksumParser) );
00060
00061 SENF_PARSER_FINALIZE( GREPacketParser );
00062
00063 private:
00064 UInt16Parser checksum() const
00065 { return checksum_().get<1>().checksum1_(); }
00066 };
00067
00079 struct GREPacketType
00080 : public PacketTypeBase,
00081 public PacketTypeMixin<GREPacketType, EtherTypes>
00082 {
00083 typedef PacketTypeMixin<GREPacketType, EtherTypes> mixin;
00084 typedef ConcretePacket<GREPacketType> packet;
00085 typedef GREPacketParser parser;
00086
00087 using mixin::nextPacketRange;
00088 using mixin::nextPacketType;
00089 using mixin::init;
00090 using mixin::initSize;
00091
00092 static void dump(packet p, std::ostream & os);
00093 static EtherTypes::key_t nextPacketKey(packet p) {
00094 return p->protocol_type();
00095 }
00096 static void finalize(packet p) {
00097 p->protocol_type() << key(p.next(nothrow));
00098 p->version_number() = 0;
00099
00100 if (p->checksum_present()) {
00101
00102 } else {
00103
00104 }
00105 }
00106 };
00107
00109 typedef GREPacketType::packet GREPacket;
00110
00111
00112 }
00113
00114
00115
00116
00117
00118
00119 #endif
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130