From: tho Date: Wed, 17 Dec 2008 13:58:55 +0000 (+0000) Subject: some clean-ups X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=962f88fbbfc6f4da1502088dfa94273e7fbd3c80;p=senf.git some clean-ups git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1019 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/80211Bundle/RadiotapPacket.hh b/Packets/80211Bundle/RadiotapPacket.hh index e36308e..0269a08 100644 --- a/Packets/80211Bundle/RadiotapPacket.hh +++ b/Packets/80211Bundle/RadiotapPacket.hh @@ -35,7 +35,7 @@ namespace senf Re-ordering of bits due to LSB byte order */ - struct RadiotapPacketParser_Flags : public senf::PacketParserBase + struct RadiotapPacketParser_Flags : public PacketParserBase { # include SENF_FIXED_PARSER() @@ -55,7 +55,7 @@ namespace senf Re-ordering of bits due to LSB byte order */ - struct RadiotapPacketParser_ChannelOptions : public senf::PacketParserBase + struct RadiotapPacketParser_ChannelOptions : public PacketParserBase { # include SENF_FIXED_PARSER() @@ -95,7 +95,7 @@ namespace senf \todo extended present field (bit 31 of present field is set) */ - struct RadiotapPacketParser : public senf::PacketParserBase + struct RadiotapPacketParser : public PacketParserBase { # include SENF_PARSER() @@ -177,7 +177,7 @@ namespace senf version() = 0; } - SENF_PARSER_FINALIZE(RadiotapPacketParser); + SENF_PARSER_FINALIZE( RadiotapPacketParser ); }; /** \brief Radiotap packet @@ -193,12 +193,12 @@ namespace senf \ingroup protocolbundle_80211 */ struct RadiotapPacketType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef senf::RadiotapPacketParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef RadiotapPacketParser parser; using mixin::nextPacketRange; using mixin::init; @@ -209,7 +209,7 @@ namespace senf static factory_t nextPacketType(packet p); }; - typedef senf::ConcretePacket RadiotapPacket; + typedef ConcretePacket RadiotapPacket; } #endif diff --git a/Packets/DefaultBundle/EthernetPacket.hh b/Packets/DefaultBundle/EthernetPacket.hh index bac2554..cbaf6e3 100644 --- a/Packets/DefaultBundle/EthernetPacket.hh +++ b/Packets/DefaultBundle/EthernetPacket.hh @@ -109,11 +109,10 @@ namespace senf { : public PacketTypeBase, public PacketTypeMixin { -#ifndef DOXYGEN typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef EthernetPacketParser parser; -#endif + using mixin::nextPacketRange; using mixin::initSize; using mixin::init; @@ -165,11 +164,10 @@ namespace senf { : public PacketTypeBase, public PacketTypeMixin { -#ifndef DOXYGEN typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef EthVLanPacketParser parser; -#endif + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::initSize; diff --git a/Packets/DefaultBundle/ICMPv6Packet.cc b/Packets/DefaultBundle/ICMPv6Packet.cc index 719b8d9..d70e7f5 100644 --- a/Packets/DefaultBundle/ICMPv6Packet.cc +++ b/Packets/DefaultBundle/ICMPv6Packet.cc @@ -1,7 +1,9 @@ +// $Id$ +// // Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY -// Philipp Batroff +// Philipp Batroff // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -32,7 +34,7 @@ namespace { registerICMPv6Packet (58); } -prefix_ void senf::ICMPV6PacketParser::calcChecksum() const { +prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() const { senf::IpChecksum summer; senf::IPv6Packet ipv6 (packet().rfind(senf::nothrow)); @@ -55,16 +57,16 @@ prefix_ void senf::ICMPV6PacketParser::calcChecksum() const { summer.feed( i()+checksum_offset+2, data().end() ); boost::uint16_t rv (summer.sum()); - this->checksum() << (rv ? rv : 0xffffu); + return rv ? rv : 0xffffu; } -prefix_ void senf::ICMPV6PacketType::dump(packet p, std::ostream &os) +prefix_ void senf::ICMPv6PacketType::dump(packet p, std::ostream &os) { boost::io::ios_all_saver ias(os); os << "ICMPv6 protocol:\n" - << "Type : " << p->type() <<"\n" - << "Code : " << p->code() <<"\n" - << "Checksum : " << p->checksumOutput() << "\n"; + << "Type : " << p->type() <<"\n" + << "Code : " << p->code() <<"\n" + << "Checksum : " << p->checksum() << "\n"; } #undef prefix_ diff --git a/Packets/DefaultBundle/ICMPv6Packet.hh b/Packets/DefaultBundle/ICMPv6Packet.hh index ad8bb00..44a4316 100644 --- a/Packets/DefaultBundle/ICMPv6Packet.hh +++ b/Packets/DefaultBundle/ICMPv6Packet.hh @@ -1,7 +1,9 @@ +// $Id$ +// // Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY -// Philipp Batroff +// Philipp Batroff // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -18,40 +20,40 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef HH_ICMPV6Packet -#define HH_ICMPV6Packet +#ifndef HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ +#define HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ 1 // Custom includes #include "../../Packets/Packets.hh" #include "../../Packets/DefaultBundle/IPv6Packet.hh" -namespace senf{ - struct ICMPV6PacketParser : public senf::PacketParserBase +namespace senf +{ + + struct ICMPv6PacketParser : public PacketParserBase { - # include SENF_FIXED_PARSER() - SENF_PARSER_FIELD ( type, senf::UInt8Parser ); - SENF_PARSER_FIELD ( code, senf::UInt8Parser ); - SENF_PARSER_PRIVATE_FIELD ( checksum, senf::UInt16Parser); +# include SENF_FIXED_PARSER() + SENF_PARSER_FIELD ( type, UInt8Parser ); + SENF_PARSER_FIELD ( code, UInt8Parser ); + SENF_PARSER_FIELD ( checksum, UInt16Parser ); - SENF_PARSER_FINALIZE ( ICMPV6PacketParser ); - - void calcChecksum() const; - boost::uint16_t checksumOutput() const - { return this->checksum();} + SENF_PARSER_FINALIZE ( ICMPv6PacketParser ); + + boost::uint16_t calcChecksum() const; }; - struct ICMPTypes { - // ICMP type registry - typedef boost::uint16_t key_t; - }; + struct ICMPTypes { + // ICMP type registry + typedef boost::uint16_t key_t; + }; - struct ICMPV6PacketType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6PacketType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6PacketParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6PacketParser parser; using mixin::nextPacketRange; using mixin::nextPacketType; @@ -59,15 +61,18 @@ namespace senf{ using mixin::initSize; static void dump(packet p, std::ostream & os); - static senf::IpTypes::key_t nextPacketKey(packet p) { + + static IpTypes::key_t nextPacketKey(packet p) { return p->type(); } + static void finalize(packet p) { - p->calcChecksum(); + p->checksum() << p->calcChecksum(); p->type() << key(p.next(senf::nothrow)); } }; - typedef ICMPV6PacketType::packet ICMPv6Packet; + typedef ConcretePacket ICMPv6Packet; } + #endif diff --git a/Packets/DefaultBundle/ICMPv6Packet.test.cc b/Packets/DefaultBundle/ICMPv6Packet.test.cc index 3b1bd02..aa14500 100644 --- a/Packets/DefaultBundle/ICMPv6Packet.test.cc +++ b/Packets/DefaultBundle/ICMPv6Packet.test.cc @@ -1,9 +1,9 @@ -// $Id: main.test.cc 206 2007-02-20 14:20:52Z g0dil $ +// $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY -// Philipp Batroff +// Philipp Batroff // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -24,21 +24,25 @@ // Custom includes -#include "ICMPv6Packet.hh" -#include "../../Packets/Packets.hh" #include "../../Utils/auto_unit_test.hh" #include +#include "ICMPv6Packet.hh" #include "ICMPv6TypePacket.hh" BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet) { - unsigned char data[] = { 0x8f, 0x00 ,0x8d ,0x54 ,0x00 ,0x00 ,0x00 ,0x01 ,0x04 ,0x00 ,0x00 ,0x00 ,0xff ,0x15 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x16}; + unsigned char data[] = { + 0x8f, 0x00, 0x8d, 0x54, 0x00, 0x00, 0x00, 0x01, + 0x04, 0x00, 0x00, 0x00, 0xff, 0x15, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x16 + }; senf::ICMPv6Packet p ( senf::ICMPv6Packet::create(data) ); - BOOST_CHECK_EQUAL( p->type(), 0x8f); - BOOST_CHECK_EQUAL( p->code(), 0x00); - BOOST_CHECK_EQUAL( p->checksumOutput(), 0x8d54); + BOOST_CHECK_EQUAL( p->type(), 0x8f ); + BOOST_CHECK_EQUAL( p->code(), 0x00 ); + BOOST_CHECK_EQUAL( p->checksum(), 0x8d54 ); BOOST_CHECK( p.next() ); BOOST_CHECK( p.next().is() ); BOOST_CHECK_EQUAL( p.next().size(), 24u ); diff --git a/Packets/DefaultBundle/ICMPv6TypePacket.cc b/Packets/DefaultBundle/ICMPv6TypePacket.cc index 6e5d9d8..520bb55 100644 --- a/Packets/DefaultBundle/ICMPv6TypePacket.cc +++ b/Packets/DefaultBundle/ICMPv6TypePacket.cc @@ -1,9 +1,9 @@ -// $Id: main.test.cc 206 2008-06-08 14:20:52Z pug $ +// $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY -// Philipp Batroff +// Philipp Batroff // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -31,16 +31,16 @@ namespace { //Implementing the ICMPv6 Type registry - senf::PacketRegistry::RegistrationProxy - registerICMPV6ErrDestUnreachable (1); - senf::PacketRegistry::RegistrationProxy - registerICMPV6ErrTooBig (2); - senf::PacketRegistry::RegistrationProxy - registerICMPV6ErrTimeExceeded (3); - senf::PacketRegistry::RegistrationProxy - registerICMPV6ErrParamProblem (4); - senf::PacketRegistry::RegistrationProxy - registerICMPv6EchoReq (128); + senf::PacketRegistry::RegistrationProxy + registerICMPv6ErrDestUnreachable (1); + senf::PacketRegistry::RegistrationProxy + registerICMPv6ErrTooBig (2); + senf::PacketRegistry::RegistrationProxy + registerICMPv6ErrTimeExceeded (3); + senf::PacketRegistry::RegistrationProxy + registerICMPv6ErrParamProblem (4); + senf::PacketRegistry::RegistrationProxy + registerICMPv6EchoRequest (128); senf::PacketRegistry::RegistrationProxy registerICMPv6EchoReply (129); senf::PacketRegistry::RegistrationProxy diff --git a/Packets/DefaultBundle/ICMPv6TypePacket.hh b/Packets/DefaultBundle/ICMPv6TypePacket.hh index 0b28c35..8741909 100644 --- a/Packets/DefaultBundle/ICMPv6TypePacket.hh +++ b/Packets/DefaultBundle/ICMPv6TypePacket.hh @@ -1,9 +1,9 @@ -// $Id: main.test.cc 206 2008-06-08 14:20:52Z pug $ +// $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY -// Philipp Batroff +// Philipp Batroff // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -22,76 +22,82 @@ // Definition of non-inline non-template functions -#ifndef HH_ICMPV6TYPEPacket -#define HH_ICMPV6TYPEPacket +#ifndef HH_SENF_Packets_DefaultBundle_ICMPv6TypePacket_ +#define HH_SENF_Packets_DefaultBundle_ICMPv6TypePacket_ 1 + // Custom includes #include "../../Packets/Packets.hh" #include "ICMPv6Packet.hh" -namespace senf{ +namespace senf { + //############################################################# //ICMPv6 Echo Request //############################################################# - struct ICMPV6EchoRequestParser : public senf::PacketParserBase + struct ICMPv6EchoRequestParser : public PacketParserBase { - # include SENF_FIXED_PARSER() - SENF_PARSER_FIELD ( identifier, senf::UInt16Parser ); - SENF_PARSER_FIELD ( seqNr, senf::UInt16Parser ); +# include SENF_FIXED_PARSER() + SENF_PARSER_FIELD ( identifier, UInt16Parser ); + SENF_PARSER_FIELD ( seqNr, UInt16Parser ); - SENF_PARSER_FINALIZE ( ICMPV6EchoRequestParser ); + SENF_PARSER_FINALIZE ( ICMPv6EchoRequestParser ); }; - struct ICMPV6EchoRequestType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6EchoRequestType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6EchoRequestParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6EchoRequestParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6EchoRequestType::packet ICMPv6EchoReq; + typedef ConcretePacket ICMPv6EchoRequest; //############################################################# //ICMPv6 Echo Reply //############################################################# - struct ICMPV6EchoReplyParser : public senf::PacketParserBase + struct ICMPv6EchoReplyParser : public PacketParserBase { - # include SENF_FIXED_PARSER() - SENF_PARSER_FIELD ( identifier, senf::UInt16Parser ); - SENF_PARSER_FIELD ( seqNr, senf::UInt16Parser ); +# include SENF_FIXED_PARSER() + SENF_PARSER_FIELD ( identifier, UInt16Parser ); + SENF_PARSER_FIELD ( seqNr, UInt16Parser ); - SENF_PARSER_FINALIZE ( ICMPV6EchoReplyParser ); + SENF_PARSER_FINALIZE ( ICMPv6EchoReplyParser ); }; - struct ICMPV6EchoReplyType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6EchoReplyType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6EchoReplyParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6EchoReplyParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6EchoReplyType::packet ICMPv6EchoReply; + + typedef ConcretePacket ICMPv6EchoReply; //############################################################# //ICMPv6 Error Destination Unreachable Message //############################################################# - struct ICMPV6ErrDestUnreachableParser : public senf::PacketParserBase + struct ICMPv6ErrDestUnreachableParser : public PacketParserBase { - # include SENF_FIXED_PARSER() +# include SENF_FIXED_PARSER() + //should be set static 0 by sender and ignored by receiver - SENF_PARSER_PRIVATE_FIELD ( unused, senf::UInt32Parser ); + SENF_PARSER_PRIVATE_FIELD ( unused, UInt32Parser ); - SENF_PARSER_INIT() { unused() = 0; } + SENF_PARSER_INIT() { + unused() = 0; + } /* Code 0 - No route to destination 1 - Communication with destination administratively prohibited @@ -100,35 +106,36 @@ namespace senf{ 4 - Port unreachable 5 - Source address failed ingress/egress policy 6 - Reject route to destination */ - void setErrCode(int code){ + void setErrCode(int code) { ICMPv6Packet icmpv6 (senf::Packet().rfind(senf::nothrow)); icmpv6->code() = code; } - SENF_PARSER_FINALIZE ( ICMPV6ErrDestUnreachableParser ); + SENF_PARSER_FINALIZE ( ICMPv6ErrDestUnreachableParser ); }; - struct ICMPV6ErrDestUnreachableType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6ErrDestUnreachableType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6ErrDestUnreachableParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6ErrDestUnreachableParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6ErrDestUnreachableType::packet ICMPV6ErrDestUnreachable; + + typedef ConcretePacket ICMPv6ErrDestUnreachable; //############################################################# //ICMPv6 Error Packet Too Big Message //############################################################# - struct ICMPV6ErrTooBigParser : public senf::PacketParserBase + struct ICMPv6ErrTooBigParser : public PacketParserBase { - # include SENF_FIXED_PARSER() - SENF_PARSER_FIELD ( MTU, senf::UInt32Parser ); +# include SENF_FIXED_PARSER() + SENF_PARSER_FIELD ( mtu, UInt32Parser ); /* Code static set to 0 */ // SENF_PARSER_INIT() { @@ -136,31 +143,32 @@ namespace senf{ // icmpv6->code() = 0; // } - SENF_PARSER_FINALIZE ( ICMPV6ErrTooBigParser ); + SENF_PARSER_FINALIZE ( ICMPv6ErrTooBigParser ); }; - struct ICMPV6ErrTooBigType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6ErrTooBigType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6ErrTooBigParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6ErrTooBigParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6ErrTooBigType::packet ICMPV6ErrTooBig; + + typedef ConcretePacket ICMPv6ErrTooBig; //############################################################# //ICMPv6 Error Time Exceeded Message //############################################################# - struct ICMPV6ErrTimeExceededParser : public senf::PacketParserBase + struct ICMPv6ErrTimeExceededParser : public PacketParserBase { - # include SENF_FIXED_PARSER() +# include SENF_FIXED_PARSER() //should be set static 0 by sender and ignored by receiver - SENF_PARSER_FIELD ( unused, senf::UInt32Parser ); + SENF_PARSER_FIELD ( unused, UInt32Parser ); /* Code 0 - Hop limit exceeded in transit 1 - Fragment reassembly time exceeded */ void setErrCode(int code){ @@ -168,31 +176,31 @@ namespace senf{ icmpv6->code() = code; } - SENF_PARSER_FINALIZE ( ICMPV6ErrTimeExceededParser ); + SENF_PARSER_FINALIZE ( ICMPv6ErrTimeExceededParser ); }; - struct ICMPV6ErrTimeExceededType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6ErrTimeExceededType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6ErrTimeExceededParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6ErrTimeExceededParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6ErrTimeExceededType::packet ICMPV6ErrTimeExceeded; + typedef ConcretePacket ICMPv6ErrTimeExceeded; //############################################################# //ICMPv6 Error Parameter Problem Message //############################################################# - struct ICMPV6ErrParamProblemParser : public senf::PacketParserBase + struct ICMPv6ErrParamProblemParser : public PacketParserBase { - # include SENF_FIXED_PARSER() +# include SENF_FIXED_PARSER() //should be set static 0 by sender and ignored by receiver - SENF_PARSER_FIELD ( pointer, senf::UInt32Parser ); + SENF_PARSER_FIELD ( pointer, UInt32Parser ); /* Code 0 - Erroneous header field encountered 1 - Unrecognized Next Header type encountered 2 - Unrecognized IPv6 option encountered */ @@ -201,30 +209,30 @@ namespace senf{ ICMPv6Packet icmpv6 (senf::Packet().rfind(senf::nothrow)); icmpv6->code() = code; } - SENF_PARSER_FINALIZE ( ICMPV6ErrParamProblemParser ); + SENF_PARSER_FINALIZE ( ICMPv6ErrParamProblemParser ); }; - struct ICMPV6ErrParamProblemType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + struct ICMPv6ErrParamProblemType + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; - typedef ICMPV6ErrParamProblemParser parser; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef ICMPv6ErrParamProblemParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef ICMPV6ErrParamProblemType::packet ICMPV6ErrParamProblem; + typedef ConcretePacket ICMPv6ErrParamProblem; //############################################################# //ICMPv6 MLDv2 (RFC 3810) Multicast Listener Query //############################################################# - struct MLDv2ListenerQueryParser : public senf::PacketParserBase + struct MLDv2ListenerQueryParser : public PacketParserBase { - # include SENF_PARSER() - //need a variant here +# include SENF_PARSER() + //need a variant here // a.) maxResponseCode < 32768 =>Interger // b.) maxResponseCode >=32768 => float (is there a float parser???) /* @@ -234,81 +242,86 @@ namespace senf{ |1| exp | mant | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - SENF_PARSER_FIELD ( maxResponseCode, senf::UInt16Parser ); - SENF_PARSER_FIELD ( reserved, senf::UInt16Parser ); //set to zero by default - SENF_PARSER_FIELD ( mcAddress, senf::INet6AddressParser); - SENF_PARSER_BITFIELD ( resv, 4, unsigned); //set to zero by default - SENF_PARSER_BITFIELD ( sFlag, 1, unsigned); - SENF_PARSER_BITFIELD ( qrv, 3, unsigned); - SENF_PARSER_FIELD ( qqic, senf::UInt8Parser ); - SENF_PARSER_PRIVATE_FIELD ( nrSources, senf::UInt16Parser ); - SENF_PARSER_VECTOR (srcAddresses, nrSources, senf::INet6AddressParser ); + SENF_PARSER_FIELD ( maxResponseCode, UInt16Parser ); + SENF_PARSER_FIELD ( reserved, UInt16Parser ); // set to zero by default + SENF_PARSER_FIELD ( mcAddress, INet6AddressParser ); + SENF_PARSER_BITFIELD ( resv, 4, unsigned ); // set to zero by default + SENF_PARSER_BITFIELD ( sFlag, 1, unsigned ); + SENF_PARSER_BITFIELD ( qrv, 3, unsigned ); + SENF_PARSER_FIELD ( qqic, UInt8Parser ); + SENF_PARSER_PRIVATE_FIELD ( nrSources, UInt16Parser ); + SENF_PARSER_VECTOR (srcAddresses, nrSources, INet6AddressParser ); + + SENF_PARSER_FINALIZE ( MLDv2ListenerQueryParser ); - SENF_PARSER_INIT() - { + SENF_PARSER_INIT() { reserved() = 0; resv() = 0; } - SENF_PARSER_FINALIZE ( MLDv2ListenerQueryParser ); - }; struct MLDv2ListenerQueryType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; typedef MLDv2ListenerQueryParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef MLDv2ListenerQueryType::packet MLDv2ListenerQuery; + + typedef ConcretePacket MLDv2ListenerQuery; //############################################################# //ICMPv6 MLDv2 (RFC 3810) Multicast Listener Report Message //############################################################# //First: the Multicast Address Record Parser - struct MLDv2AddressRecordParser : public senf::PacketParserBase + struct MLDv2AddressRecordParser : public PacketParserBase { - # include SENF_PARSER() - SENF_PARSER_FIELD ( recordType, senf::UInt8Parser ); - SENF_PARSER_PRIVATE_FIELD ( auxDataLen, senf::UInt8Parser ); - SENF_PARSER_PRIVATE_FIELD ( nrOfSrcs, senf::UInt16Parser ); - SENF_PARSER_FIELD ( mcAddress, senf::INet6AddressParser); - SENF_PARSER_VECTOR ( srcAddresses, nrOfSrcs, senf::INet6AddressParser ); - SENF_PARSER_VECTOR ( auxData, auxDataLen, senf::UInt32Parser ); +# include SENF_PARSER() + SENF_PARSER_FIELD ( recordType, UInt8Parser ); + SENF_PARSER_PRIVATE_FIELD ( auxDataLen, UInt8Parser ); + SENF_PARSER_PRIVATE_FIELD ( nrOfSrcs, UInt16Parser ); + SENF_PARSER_FIELD ( mcAddress, INet6AddressParser); + SENF_PARSER_VECTOR ( srcAddresses, nrOfSrcs, INet6AddressParser ); + SENF_PARSER_VECTOR ( auxData, auxDataLen, UInt32Parser ); SENF_PARSER_FINALIZE ( MLDv2AddressRecordParser ); }; - struct MLDv2ListenerReportParser : public senf::PacketParserBase + struct MLDv2ListenerReportParser : public PacketParserBase { - # include SENF_PARSER() - SENF_PARSER_FIELD ( reserved, senf::UInt16Parser ); //set to zero by default - SENF_PARSER_PRIVATE_FIELD ( nrMcastAddrRecords_, senf::UInt16Parser ); - SENF_PARSER_LIST ( mcastAddrRecords, nrMcastAddrRecords_, MLDv2AddressRecordParser ); +# include SENF_PARSER() - SENF_PARSER_INIT() { reserved() = 0; } + SENF_PARSER_FIELD ( reserved, UInt16Parser ); //set to zero by default + SENF_PARSER_PRIVATE_FIELD ( nrMcastAddrRecords_, UInt16Parser ); + SENF_PARSER_LIST ( mcastAddrRecords, nrMcastAddrRecords_, MLDv2AddressRecordParser ); SENF_PARSER_FINALIZE ( MLDv2ListenerReportParser ); + + SENF_PARSER_INIT() { + reserved() = 0; + } }; struct MLDv2ListenerReportType - : public senf::PacketTypeBase, - public senf::PacketTypeMixin + : public PacketTypeBase, + public PacketTypeMixin { - typedef senf::PacketTypeMixin mixin; - typedef senf::ConcretePacket packet; + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; typedef MLDv2ListenerReportParser parser; using mixin::nextPacketRange; using mixin::init; using mixin::initSize; }; - typedef MLDv2ListenerReportType::packet MLDv2ListenerReport; + + typedef ConcretePacket MLDv2ListenerReport; } + #endif