From: jkaeber Date: Fri, 14 Dec 2007 09:35:16 +0000 (+0000) Subject: Set some packet attributes inside the finalize() method. X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=ea2f773d1bf79ff787f2c68766ecd154bd9f3631;p=senf.git Set some packet attributes inside the finalize() method. git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@562 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/MPEGDVBBundle/GREPacket.hh b/Packets/MPEGDVBBundle/GREPacket.hh index f056b51..bbf21f8 100644 --- a/Packets/MPEGDVBBundle/GREPacket.hh +++ b/Packets/MPEGDVBBundle/GREPacket.hh @@ -55,7 +55,7 @@ namespace senf { SENF_PARSER_BITFIELD ( checksum_present, 1, bool ); SENF_PARSER_PRIVATE_BITFIELD ( reserved0_, 12, unsigned ); // TODO: SKIP !! - SENF_PARSER_BITFIELD_RO ( version_number, 3, unsigned ); // TODO: Always Zero !! + SENF_PARSER_BITFIELD ( version_number, 3, unsigned ); // TODO: Always Zero !! SENF_PARSER_FIELD ( protocol_type, Parse_UInt16 ); SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present, (VoidPacketParser) (GREChecksumParser) ); @@ -91,8 +91,19 @@ namespace senf { using mixin::initSize; static void dump(packet p, std::ostream & os); - static EtherTypes::key_t nextPacketKey(packet p) { return p->protocol_type(); } - static void finalize(packet p) { p->protocol_type() << key(p.next()); } + static EtherTypes::key_t nextPacketKey(packet p) { + return p->protocol_type(); + } + static void finalize(packet p) { + p->protocol_type() << key(p.next()); + p->version_number() = 0; // as per RFC2784, 2.3.1 + + if (p->checksum_present()) { + // compute checksum + } else { + // ??? + } + } }; /** \brief GRE packet typedef */