MIHPacket.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Packets_80221Bundle_MIHPacket_
18 #define HH_SENF_Packets_80221Bundle_MIHPacket_ 1
19 
20 // Custom includes
21 #include <senf/Packets/Packets.hh>
23 #include "TLVParser.hh"
24 #include "MIHMessageRegistry.hh"
25 
26 //#include "MIHPacket.mpp"
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 
39  {
40  # include SENF_PARSER()
41 
42  SENF_PARSER_BITFIELD_RO( version, 4, unsigned );
43  SENF_PARSER_BITFIELD ( ackRequest, 1, bool );
44  SENF_PARSER_BITFIELD ( ackResponse, 1, bool );
45  SENF_PARSER_BITFIELD ( uir, 1, bool );
47  SENF_PARSER_BITFIELD ( fragmentNr, 7, unsigned );
49 
50  // MIH message ID (MID)
53  SENF_PARSER_BITFIELD( sid, 4, unsigned );
54  SENF_PARSER_BITFIELD( opcode, 2, unsigned );
55  SENF_PARSER_BITFIELD( aid, 10, unsigned );
56 
58  SENF_PARSER_BITFIELD ( transactionId, 12, unsigned );
60 
61  SENF_PARSER_GOTO_OFFSET( 8, 8); // just to limit the offset calculation
62 
63  // Source MIHF Id
65  // Destination MIHF Id
67 
69 
71  defaultInit();
72  version_() = 1;
73  }
74 
75  friend struct MIHPacketType;
76  };
77 
89  : public PacketTypeBase,
90  public PacketTypeMixin<MIHPacketType, MIHMessageRegistry>
91  {
95 
96  using mixin::nextPacketRange;
97  using mixin::init;
98  using mixin::initSize;
99 
101  static void dump(packet p, std::ostream & os);
102  static void finalize(packet p);
103  static factory_t nextPacketType(packet p);
104  static void validate(packet p);
105 
106  static const EtherTypes::key_t etherType = 0x8917;
107  };
108 
114 
115 
117  {
118  # include SENF_PARSER()
119  SENF_PARSER_TLV_LIST( tlvList, packetSize(), MIHGenericTLVParser );
121  };
122 
124  : public PacketTypeBase,
125  public PacketTypeMixin<MIHGenericPayloadPacketType>
126  {
130 
131  using mixin::nextPacketRange;
132  using mixin::init;
133  using mixin::initSize;
134 
136  static void dump(packet p, std::ostream & os);
137  static void finalize(packet p);
138  };
139 
144  SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION( MIHGenericPayloadPacket );
145 }
146 
147 
148 //-/////////////////////////////////////////////////////////////////////////////////////////////////
149 //#include "MIHPacket.cci"
150 //#include "MIHPacket.ct"
151 //#include "MIHPacket.cti"
152 #endif
153 
154 
155 
156 // Local Variables:
157 // mode: c++
158 // fill-column: 100
159 // c-file-style: "senf"
160 // indent-tabs-mode: nil
161 // ispell-local-dictionary: "american"
162 // compile-command: "scons -u test"
163 // comment-column: 40
164 // End:
senf::UIntFieldParser<?,?+10 > aid() const
ConcretePacket< MIHPacketType > MIHPacket
MIH packet typedef.
Definition: MIHPacket.hh:112
senf::FlagParser<?> moreFragment() const
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
senf::FlagParser<?> ackRequest() const
PacketTypeMixin< MIHPacketType, MIHMessageRegistry > mixin
Definition: MIHPacket.hh:92
ConcretePacket< MIHPacketType > packet
MIH packet typedef.
Definition: MIHPacket.hh:93
Mixin to provide standard implementations for nextPacketRange and nextPacketType. ...
Definition: PacketType.hh:300
MIH Message-Registry public header.
ConcretePacket< MIHGenericPayloadPacketType > packet
MIH Payload packet typedef.
Definition: MIHPacket.hh:128
Packets public header.
DefaultBundle packet registries public header.
Parser for 802.21 source MIHF_ID TLV.
Definition: TLVParser.hh:160
senf::UIntFieldParser<?,?+12 > transactionId() const
senf::FlagParser<?> uir() const
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_GOTO(name)
Change current offset.
MIHGenericPayloadPacketParser parser
typedef to the parser of MIH Payload packet
Definition: MIHPacket.hh:129
PacketTypeMixin< MIHGenericPayloadPacketType > mixin
Definition: MIHPacket.hh:127
senf::UIntFieldParser<?,?+4 > sid() const
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
#define SENF_PARSER_TLV_LIST
Definition: GenericTLV.hh:301
void dump(std::ostream &os, DirectoryNode &dir=root())
Protocol specific packet handle.
Definition: Packet.hh:87
void defaultInit() const
Default implementation.
Helper base-class implementing the PacketType interface.
Definition: PacketType.hh:100
Parse a MIH packet.
Definition: MIHPacket.hh:38
#define SENF_PARSER_BITFIELD_RO(name, bits, type)
Define bit-field (read-only)
#define SENF_PARSER_INIT()
Define parser initialization routine.
#define SENF_PARSER_FIELD_RO(name, type)
Define parser field (read-only)
senf::UIntFieldParser<?,?+2 > opcode() const
MIHFSrcIdTLVParser src_mihfId() const
MIHFDstIdTLVParser dst_mihfId() const
SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION(RadiotapPacket)
senf::UIntFieldParser<?,?+4 >::value_type version() const
MIH packet.
Definition: MIHPacket.hh:88
TLVParser public header.
senf::FlagParser<?> ackResponse() const
ConcretePacket< MIHGenericPayloadPacketType > MIHGenericPayloadPacket
MIH Payload packet typedef.
Definition: MIHPacket.hh:143
UInt16Parser messageId() const
MIHPacketParser parser
typedef to the parser of MIH packet
Definition: MIHPacket.hh:94
#define SENF_PARSER_SKIP_BITS(bits)
Skip bits within bitfield group.
Parser Base class.
PacketInterpreterBase::factory_t factory_t
Definition: PacketType.hh:112
#define SENF_PARSER_GOTO_OFFSET(offset)
Change current offset to explicit value.
void validate(size_type size) const
Validate size of data container.
Parser for 802.21 destination MIHF_ID TLV.
Definition: TLVParser.hh:175
Parse 16bit unsigned byte aligned integer.
Definition: IntParser.hh:174
senf::UIntFieldParser<?,?+7 > fragmentNr() const
boost::uint16_t key_t
Definition: Registries.hh:35
Parser for a generic TLV packet.
Definition: TLVParser.hh:31
UInt16Parser ::value_type payloadLength() const