#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
+ <a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
+
+ \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;
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 ))
((Field )( source, Parse_32bit ))
((Field )( destination, Parse_32bit )) );
+# else
+
+ Parse_Version version();
+ Parse_IHL ihl();
+ Parse_8bit tos();
+ Parse_16bit length();
+ Parse_16bit identifier();
+ Parse_R reserved();
+ Parse_DF df();
+ Parse_MF mf();
+ Parse_Frag frag();
+ Parse_8bit ttl();
+ Parse_8bit protocol();
+ Parse_16bit crc();
+ Parse_32bit source();
+ Parse_32bit destination();
+
+# endif
+
void init() {
version() = 4;
}
};
+ /** \brief IP protocol number registry
+
+ This registeres packets with their IP protocol number.
+
+ \see <a href="http://www.iana.org/assignments/protocol-numbers">Protocol numbers</a> \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<IpV4PacketType, IpTypes>
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"