X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FEthernetPacket.hh;h=5a38c98b604d8b80b809e8498853937290cb9a8b;hb=9bc655e14d2d8c204ed835896cb51e42d49bd68f;hp=8eed2ecdd3df79854aeddf016f5b7da440ee55d2;hpb=a3f9296f648c4991a1576d4200abfdc72788bc16;p=senf.git diff --git a/senf/Packets/DefaultBundle/EthernetPacket.hh b/senf/Packets/DefaultBundle/EthernetPacket.hh index 8eed2ec..5a38c98 100644 --- a/senf/Packets/DefaultBundle/EthernetPacket.hh +++ b/senf/Packets/DefaultBundle/EthernetPacket.hh @@ -36,30 +36,24 @@ 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 +74,7 @@ namespace senf { /** \brief EtherType registry This registry registers packet types with their EtherType number. - + \see Ethernet numbers \n \ref PacketRegistry */ @@ -121,7 +115,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 +124,9 @@ namespace senf { */ typedef ConcretePacket EthernetPacket; - + /** \brief Parse an ethernet VLAN tag - + Parser interpreting the ethernet VLAN tag. Fields are \see EthVLanPacketType @@ -158,7 +152,7 @@ namespace senf { \par Fields: \ref EthVLanPacketParser \image html EthVLanPacket.png - + \par Associated registries: \ref EtherTypes @@ -168,7 +162,7 @@ namespace senf { \ingroup protocolbundle_default */ struct EthVLanPacketType - : public PacketTypeBase, + : public PacketTypeBase, public PacketTypeMixin { #ifndef DOXYGEN @@ -184,7 +178,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