X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FIpV4Packet.hh;h=7fca40ee43e72a8eca2122248c2407c86ee12a66;hb=aa8de2975f5365cd4f29f6f337f93ad328f6685c;hp=a38b59d421c653e6e961ebea562e5975040e4f43;hpb=47368f306a577d1e46df69a7f729bd3893cbe5e7;p=senf.git diff --git a/Packets/DefaultBundle/IpV4Packet.hh b/Packets/DefaultBundle/IpV4Packet.hh index a38b59d..7fca40e 100644 --- a/Packets/DefaultBundle/IpV4Packet.hh +++ b/Packets/DefaultBundle/IpV4Packet.hh @@ -20,26 +20,31 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + \brief IpV4Packet public header */ + #ifndef HH_IpV4Packet_ #define HH_IpV4Packet_ 1 // Custom includes -#include "Packets/PacketType.hh" -#include "Packets/ParseInt.hh" -#include "Packets/PacketRegistry.hh" -#include "Packets/PacketParser.hh" +#include "Packets/Packets.hh" //#include "IpV4Packet.mpp" ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - struct Parse_IpV4 : public PacketParserBase - { - SENF_PACKET_PARSER_NO_INIT(Parse_IpV4); + /** \brief Parse an IpV4 packet + + Parser implementing the IpV4 header. The fields implemented are: - /////////////////////////////////////////////////////////////////////////// + \see IpV4PacketType \n + RFC 791 + \todo Implement options + */ + struct Parse_IpV4 : public PacketParserBase + { typedef Parse_UIntField < 0, 4 > Parse_Version; typedef Parse_UIntField < 4, 8 > Parse_IHL; typedef Parse_UInt8 Parse_8bit; @@ -50,6 +55,10 @@ namespace senf { typedef Parse_UIntField < 3, 16 > Parse_Frag; typedef Parse_UInt32 Parse_32bit; +# ifndef DOXYGEN + + SENF_PACKET_PARSER_NO_INIT(Parse_IpV4); + SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS( ((OverlayField)( version, Parse_Version )) ((Field )( ihl, Parse_IHL )) @@ -66,17 +75,54 @@ namespace senf { ((Field )( source, Parse_32bit )) ((Field )( destination, Parse_32bit )) ); +# else + + Parse_Version version() const; + Parse_IHL ihl() const; + Parse_8bit tos() const; + Parse_16bit length() const; + Parse_16bit identifier() const; + Parse_R reserved() const; + Parse_DF df() const; + Parse_MF mf() const; + Parse_Frag frag() const; + Parse_8bit ttl() const; + Parse_8bit protocol() const; + Parse_16bit crc() const; + Parse_32bit source() const; + Parse_32bit destination() const; + +# endif + void init() { version() = 4; } }; + /** \brief IP protocol number registry + + This registeres packets with their IP protocol number. + + \see Protocol numbers \n + PacketRegistry + */ struct IpTypes { - // See http://www.iana.org/assignments/protocol-numbers - // Also used by IPv6 typedef boost::uint16_t key_t; }; + /** \brief IpV4 packet + + \par Packet type (typedef): + \ref IpV4Packet + + \par Fields: + \ref Parse_IpV4 + + \par Associated registries: + \ref IpTypes + + \ingroup protocolbundle_default + */ struct IpV4PacketType : public PacketTypeBase, public PacketTypeMixin @@ -96,12 +142,14 @@ namespace senf { static void dump(packet p, std::ostream & os); }; + /** \brief IpV4 packet typedef */ typedef IpV4PacketType::packet IpV4Packet; - } ///////////////////////////////hh.e//////////////////////////////////////// +#endif +#ifndef SENF_PACKETS_DECL_ONLY //#include IpV4Packet.cci" //#include "IpV4Packet.ct" //#include "IpV4Packet.cti"