4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Joachim Kaeber <joachim.kaeber@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief GREPacket public header */
27 #define HH_GREPacket 1
31 #include "../../Packets/Packets.hh"
33 //#include "GREPacket.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
38 /** \brief Parse a GRE packet
40 Parser implementing the header of a General Routing Encapsulation (GRE, RFC 2784) Packet
44 struct GREChecksumParser : public PacketParserBase {
45 # include SENF_PARSER()
46 SENF_PARSER_FIELD ( checksum1_, Parse_UInt16 );
47 SENF_PARSER_PRIVATE_FIELD ( reserved1_, Parse_UInt16 );
48 SENF_PARSER_FINALIZE(GREChecksumParser);
51 struct Parse_GREPacket : public PacketParserBase
53 # include SENF_PARSER()
55 SENF_PARSER_BITFIELD ( checksum_present, 1, bool );
56 SENF_PARSER_PRIVATE_BITFIELD ( reserved0_, 12, unsigned ); // TODO: SKIP !!
57 SENF_PARSER_BITFIELD_RO ( version_number, 3, unsigned ); // TODO: Always Zero !!
58 SENF_PARSER_FIELD ( protocol_type, Parse_UInt16 );
59 SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present,
60 (VoidPacketParser) (GREChecksumParser) );
62 SENF_PARSER_FINALIZE( Parse_GREPacket );
65 Parse_UInt16 checksum() const /// only defined if checksum_present() == \c true
66 { return checksum_().get<1>().checksum1_(); }
71 \par Packet type (typedef):
77 \ingroup protocolbundle_mpegdvb
80 : public PacketTypeBase,
81 public PacketTypeMixin<GREPacketType>
83 typedef PacketTypeMixin<GREPacketType> mixin;
84 typedef ConcretePacket<GREPacketType> packet;
85 typedef Parse_GREPacket parser;
87 using mixin::nextPacketRange;
89 using mixin::initSize;
91 static void dump(packet p, std::ostream & os);
94 /** \brief GRE packet typedef */
95 typedef GREPacketType::packet GREPacket;
101 ///////////////////////////////hh.e////////////////////////////////////////
102 //#include "TransportPacket.cci"
103 //#include "TransportPacket.ct"
104 //#include "TransportPacket.cti"
111 // c-file-style: "senf"
112 // indent-tabs-mode: nil
113 // ispell-local-dictionary: "american"
114 // compile-command: "scons -u test"
115 // comment-column: 40