X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FEthernetPacket.hh;h=b317c32e9b0edd2b3f64a657bd60e83f475b8904;hb=e3179a2123ad51d0d9eb63834a581145c4f77c92;hp=8eed2ecdd3df79854aeddf016f5b7da440ee55d2;hpb=a3f9296f648c4991a1576d4200abfdc72788bc16;p=senf.git diff --git a/senf/Packets/DefaultBundle/EthernetPacket.hh b/senf/Packets/DefaultBundle/EthernetPacket.hh index 8eed2ec..b317c32 100644 --- a/senf/Packets/DefaultBundle/EthernetPacket.hh +++ b/senf/Packets/DefaultBundle/EthernetPacket.hh @@ -27,39 +27,32 @@ #define HH_SENF_Packets_DefaultBundle_EthernetPacket_ 1 // Custom includes -#include #include #include //#include "EthernetPacket.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace senf { - /** \brief Parse an Ethernet MAC address + /** \brief Parse an Ethernet MAC address The ethernet MAC is returned by value as a 6-byte sequence \see MACAddress \n EthernetPacket */ - struct MACAddressParser : public PacketParserBase + struct MACAddressParser + : public ValueParserBase { - MACAddressParser(data_iterator i, state_type s) : PacketParserBase(i,s,fixed_bytes) {} - - /////////////////////////////////////////////////////////////////////////// - - typedef MACAddress value_type; - static const size_type fixed_bytes = 6u; + MACAddressParser(data_iterator i, state_type s) : Base(i,s) {} value_type value() const { return MACAddress::from_data(i()); } void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); } - operator value_type () { return value(); } - byte & operator[](size_type index) { return *boost::next(i(),index); } - MACAddressParser const & operator= (value_type const & other) { value(other); return *this; } + using Base::operator=; }; - + /** \brief Parse an Ethernet packet Parser implementing an ethernet header. @@ -80,7 +73,7 @@ namespace senf { /** \brief EtherType registry This registry registers packet types with their EtherType number. - + \see Ethernet numbers \n \ref PacketRegistry */ @@ -121,7 +114,7 @@ namespace senf { static factory_t nextPacketType(packet p); /// Dump given EthernetPacket in readable form to given output stream - static void dump(packet p, std::ostream & os); + static void dump(packet p, std::ostream & os); static void finalize(packet p); }; @@ -130,9 +123,9 @@ namespace senf { */ typedef ConcretePacket EthernetPacket; - + /** \brief Parse an ethernet VLAN tag - + Parser interpreting the ethernet VLAN tag. Fields are \see EthVLanPacketType @@ -158,7 +151,7 @@ namespace senf { \par Fields: \ref EthVLanPacketParser \image html EthVLanPacket.png - + \par Associated registries: \ref EtherTypes @@ -168,7 +161,7 @@ namespace senf { \ingroup protocolbundle_default */ struct EthVLanPacketType - : public PacketTypeBase, + : public PacketTypeBase, public PacketTypeMixin { #ifndef DOXYGEN @@ -184,7 +177,7 @@ namespace senf { /** \todo Add LLC/SNAP support -> only use the registry for type() values >=1536, otherwise expect an LLC header */ - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->type(); } /// Dump given EthVLanPacket in readable form to given output stream @@ -199,7 +192,7 @@ namespace senf { } -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// //#include "EthernetPacket.cci" //#include "EthernetPacket.ct" //#include "EthernetPacket.cti"