X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FIpV6Packet.hh;h=b93a81b42639b268f51bdde28dc88771833612bb;hb=81ffa1c459b96dd44472bcef37e1e373934ee138;hp=0f1aafbf9baec42bd572d775b925c7276b9b0855;hpb=64e170521a221effc1ba11a0544f753544d03bac;p=senf.git
diff --git a/Packets/DefaultBundle/IpV6Packet.hh b/Packets/DefaultBundle/IpV6Packet.hh
index 0f1aafb..b93a81b 100644
--- a/Packets/DefaultBundle/IpV6Packet.hh
+++ b/Packets/DefaultBundle/IpV6Packet.hh
@@ -25,11 +25,8 @@
#define HH_IpV6Packet_ 1
// Custom includes
-#include "Packets/PacketType.hh"
-#include "Packets/ParseInt.hh"
-#include "Packets/PacketRegistry.hh"
-#include "Packets/PacketParser.hh"
-#include "Packets/ParseArray.hh"
+#include "Socket/Protocols/INet/INet6Address.hh"
+#include "Packets/Packets.hh"
#include "IpV4Packet.hh"
//#include "IpV6Packet.mpp"
@@ -37,23 +34,44 @@
namespace senf {
- ///\addtogroup protocolbundle_default
- ///@{
-
- // See RFC2460
- struct Parse_IpV6 : public PacketParserBase
+ /** \brief Parse an IpV6 address
+
+ \see INet6Address
+ */
+ struct Parse_INet6Address : public PacketParserBase
{
- SENF_PACKET_PARSER_NO_INIT(Parse_IpV6);
+ Parse_INet6Address(data_iterator i, state_type s) : PacketParserBase(i,s,fixed_bytes) {}
///////////////////////////////////////////////////////////////////////////
+ typedef INet6Address value_type;
+ static const size_type fixed_bytes = 16u;
+
+ value_type value() const { return value_type::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); }
+ Parse_INet6Address const & operator= (value_type const & other)
+ { value(other); return *this; }
+ };
+
+ /** \brief Parse an IpV6 packet
+
+ \see IpV6PacketType \n
+ RFC 2460
+ */
+ struct Parse_IpV6 : public PacketParserBase
+ {
typedef Parse_UIntField < 0, 4 > Parse_Version;
typedef Parse_UIntField < 4, 12 > Parse_Class;
typedef Parse_UIntField < 12, 32 > Parse_FlowLabel;
typedef Parse_UInt8 Parse_8bit;
typedef Parse_UInt16 Parse_16bit;
+ typedef Parse_INet6Address Parse_Addr;
- typedef Parse_Array < 16, Parse_8bit > Parse_Addr;
+# ifndef DOXYGEN
+
+ SENF_PACKET_PARSER_NO_INIT(Parse_IpV6);
SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
((OverlayField)( version, Parse_Version ))
@@ -65,11 +83,37 @@ namespace senf {
((Field )( source, Parse_Addr ))
((Field )( destination, Parse_Addr )) );
+# else
+
+ Parse_Version version() const;
+ Parse_Class trafficClass() const;
+ Parse_FlowLabel flowLabel() const;
+ Parse_16bit length() const;
+ Parse_8bit nextHeader() const;
+ Parse_8bit hopLimit() const;
+ Parse_Addr source() const;
+ Parse_Addr destination() const;
+
+# endif
+
void init() {
version() = 6;
}
};
+ /** \brief IpV6 packet
+
+ \par Packet type (typedef):
+ \ref IpV6Packet
+
+ \par Fields:
+ \ref Parse_IpV6
+
+ \par Associated registries:
+ \ref IpTypes
+
+ \ingroup protocolbundle_default
+ */
struct IpV6PacketType
: public PacketTypeBase,
public PacketTypeMixin
@@ -89,12 +133,15 @@ namespace senf {
static void dump(packet p, std::ostream & os);
};
+ /** \brief IpV6 packet typedef */
typedef IpV6PacketType::packet IpV6Packet;
///@}
}
///////////////////////////////hh.e////////////////////////////////////////
+#endif
+#ifndef SENF_PACKETS_DECL_ONLY
//#include "IpV6Packet.cci"
//#include "IpV6Packet.ct"
//#include "IpV6Packet.cti"