Skip to content
Snippets Groups Projects
Commit c9d52185 authored by tho's avatar tho
Browse files

first steps to a MIHPacket

parent ff40d33d
No related branches found
No related tags found
No related merge requests found
...@@ -27,11 +27,33 @@ ...@@ -27,11 +27,33 @@
//#include "MIHPacket.ih" //#include "MIHPacket.ih"
// Custom includes // Custom includes
#include "MIHPacket.hh"
#include "../../Packets/Packets.hh"
#include <boost/io/ios_state.hpp>
#define prefix_ #define prefix_
prefix_ void senf::MIHPacketType::dump(packet p, std::ostream &os)
{
boost::io::ios_all_saver ias(os);
os << "MIH Packet:\n"
<< " protocol header:\n" << "\n"
<< " Version: " << unsigned( p->version()) << "\n"
<< " Ack-Request: " << p->ackRequest() << "\n"
<< " Ack-Response: " << p->ackResponse() << "\n"
<< " UIR: " << p->uir() << "\n"
<< " more fragment: " << p->moreFragment() << "\n"
<< " fragment number: " << p->fragmentNr() << "\n"
<< " message ID (MID):\n"
<< " SID: " << unsigned( p->sid()) << "\n"
<< " Opcode: " << unsigned( p->opcode()) << "\n"
<< " AID: " << unsigned( p->aid()) << "\n"
<< " Transaction ID: " << unsigned( p->transactionId()) << "\n"
<< " payload length: " << unsigned( p->payloadLength()) << "\n";
}
#undef prefix_ #undef prefix_
......
...@@ -34,6 +34,48 @@ ...@@ -34,6 +34,48 @@
namespace senf { namespace senf {
struct MIHPacketParser : public senf::PacketParserBase
{
# include SENF_PARSER()
SENF_PARSER_BITFIELD ( version, 4, unsigned );
SENF_PARSER_BITFIELD ( ackRequest, 1, bool );
SENF_PARSER_BITFIELD ( ackResponse, 1, bool );
SENF_PARSER_BITFIELD ( uir, 1, bool );
SENF_PARSER_BITFIELD ( moreFragment, 1, bool );
SENF_PARSER_BITFIELD ( fragmentNr, 7, unsigned );
SENF_PARSER_SKIP_BITS ( 1 );
// MIH message ID (MID)
SENF_PARSER_BITFIELD ( sid, 4, unsigned );
SENF_PARSER_BITFIELD ( opcode, 2, unsigned );
SENF_PARSER_BITFIELD ( aid, 10, unsigned );
SENF_PARSER_SKIP_BITS ( 4 );
SENF_PARSER_BITFIELD ( transactionId, 12, unsigned );
SENF_PARSER_FIELD_RO ( payloadLength, UInt16Parser );
SENF_PARSER_FINALIZE ( MIHPacketParser );
};
struct MIHPacketType
: public PacketTypeBase,
public PacketTypeMixin<MIHPacketType>
{
typedef PacketTypeMixin<MIHPacketType> mixin;
typedef ConcretePacket<MIHPacketType> packet;
typedef MIHPacketParser parser;
using mixin::nextPacketRange;
using mixin::init;
using mixin::initSize;
static void dump(packet p, std::ostream &os);
// static void finalize(packet p);
};
typedef ConcretePacket<MIHPacketType> MIHPacket;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment