X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FEthernetPacket.hh;h=f40d7551e79cb305b9353d636da22fcfe94d67c0;hb=d53c168dbfd70ffea9ebad8953193163e113ff3a;hp=f01dab2b1c3574b400d0f9c3ed7a55e4ef6da156;hpb=47368f306a577d1e46df69a7f729bd3893cbe5e7;p=senf.git diff --git a/Packets/DefaultBundle/EthernetPacket.hh b/Packets/DefaultBundle/EthernetPacket.hh index f01dab2..f40d755 100644 --- a/Packets/DefaultBundle/EthernetPacket.hh +++ b/Packets/DefaultBundle/EthernetPacket.hh @@ -26,16 +26,19 @@ // Custom includes #include #include -#include "Packets/PacketType.hh" -#include "Packets/ParseInt.hh" -#include "Packets/PacketRegistry.hh" -#include "Packets/PacketParser.hh" +#include "Packets/Packets.hh" //#include "EthernetPacket.mpp" ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { + /** \brief Ethernet MAC address + + The Ethernet MAC is modelled as a fixed-size container/sequence of 6 bytes. + + \todo Move to someplace else when implementing the addressing classes + */ struct MACAddress : boost::array { @@ -47,6 +50,13 @@ namespace senf { { virtual char const * what() const throw() { return "invalid mac address syntax"; } }; }; + /** \brief Parse an Ethernet MAC address + + The ethernet MAC is returned by value as a 6-byte sequence + + \see MACAddress \n + EthernetPacket + */ struct Parse_MAC : public PacketParserBase { Parse_MAC(data_iterator i, state_type s) : PacketParserBase(i,s,fixed_bytes) {} @@ -63,7 +73,20 @@ namespace senf { Parse_MAC const & operator= (value_type const & other) { value(other); return *this; } }; + + /** \brief Parse an Ethernet packet + + Parser implementing an ethernet header. The fields implemented are + + + + + + +
Field name Parser type
destination \ref Parse_MAC
source \ref Parse_MAC
type \ref Parse_Type
+ \see EthernetPacketType + */ struct Parse_Ethernet : public PacketParserBase { SENF_PACKET_PARSER_INIT(Parse_Ethernet); @@ -78,11 +101,31 @@ namespace senf { ((Field)( type, Parse_Type )) ); }; + /** \brief EtherType registry + + This registry registers packet types with their EtherType number. + + \see Ethernet numbers + \ref PacketRegistry + */ struct EtherTypes { - // See http://www.iana.org/assignments/ethernet-numbers + // See typedef boost::uint16_t key_t; }; + /** \brief Ethernet packet + + \par Packet type (typedef): + \ref EthernetPacket + + \par Fields: + \ref Parse_Ethernet + + \par Associated registries: + \ref EtherTypes + + \ingroup protocolbundle_default + */ struct EthernetPacketType : public PacketTypeBase, public PacketTypeMixin @@ -104,8 +147,23 @@ namespace senf { static void dump(packet p, std::ostream & os); }; + /** \brief Ethernet packet typedef */ typedef EthernetPacketType::packet EthernetPacket; + /** \brief Parse an ethernet VLAN tag + + Parser interpreting the ethernet VLAN tag. Fields are + + + + + + + +
Field nameParser type
priority\ref Parse_Priority
cfi\ref Parse_CFI
vlanId\ref Parse_VLanId
type\ref Parse_Type
+ + \see EthVLanPacketType + */ struct Parse_EthVLan : public PacketParserBase { SENF_PACKET_PARSER_INIT(Parse_EthVLan); @@ -124,6 +182,19 @@ namespace senf { ((Field )( type, Parse_Type )) ); }; + /** \brief Ethernet VLAN tag + + \par Packet type (typedef): + \ref EthVLanPacket + + \par Fields: + \ref Parse_EthVLan + + \par Associated registries: + \ref EtherTypes + + \ingroup protocolbundle_default + */ struct EthVLanPacketType : public PacketTypeBase, public PacketTypeMixin @@ -145,11 +216,14 @@ namespace senf { static void dump(packet p, std::ostream & os); }; + /** \brief Ethernet VLAN tag typedef */ typedef EthVLanPacketType::packet EthVLanPacket; } ///////////////////////////////hh.e//////////////////////////////////////// +#endif +#ifndef SENF_PACKETS_DECL_ONLY //#include "EthernetPacket.cci" #include "EthernetPacket.ct" //#include "EthernetPacket.cti"