/** \brief Parse a GRE packet
Parser implementing the header of a General Routing Encapsulation (GRE, RFC 2784) Packet
-
+
\see GREPacketType
*/
struct GREChecksumParser : public PacketParserBase {
-# include SENF_PARSER()
+# include SENF_PARSER()
SENF_PARSER_FIELD ( checksum1_, UInt16Parser );
SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt16Parser );
SENF_PARSER_FINALIZE(GREChecksumParser);
SENF_PARSER_FIELD ( protocol_type, UInt16Parser );
SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present,
(VoidPacketParser) (GREChecksumParser) );
-
+
SENF_PARSER_FINALIZE( GREPacketParser );
- private:
+ private:
UInt16Parser checksum() const /// only defined if checksum_present() == \c true
{ return checksum_().get<1>().checksum1_(); }
};
-
+
/** \brief GRE packet
-
+
\par Packet type (typedef):
\ref GREPacket
typedef PacketTypeMixin<GREPacketType, EtherTypes> mixin;
typedef ConcretePacket<GREPacketType> packet;
typedef GREPacketParser parser;
-
+
using mixin::nextPacketRange;
using mixin::nextPacketType;
using mixin::init;
using mixin::initSize;
-
+
static void dump(packet p, std::ostream & os);
static EtherTypes::key_t nextPacketKey(packet p) {
return p->protocol_type();
p->protocol_type() << key(p.next(nothrow));
p->version_number() = 0; // as per RFC2784, 2.3.1
- if (p->checksum_present()) {
+ if (p->checksum_present()) {
// compute checksum
} else {
// ???
}
}
};
-
+
/** \brief GRE packet typedef */
typedef GREPacketType::packet GREPacket;
-
-
+
+
}