/** \brief Parse an Ethernet packet
- Parser implementing an ethernet header. The fields implemented are
-
- <table class="senf">
- <tr> <th>Field name</th> <th>Parser type</th> </tr>
- <tr> <td>destination</td> <td>\ref Parse_MAC</td> </tr>
- <tr> <td>source</td> <td>\ref Parse_MAC</td> </tr>
- <tr> <td>type</td> <td>\ref Parse_Type</td> </tr>
- </table>
+ Parser implementing an ethernet header.
\see EthernetPacketType
*/
struct Parse_Ethernet : public PacketParserBase
{
- SENF_PACKET_PARSER_INIT(Parse_Ethernet);
+ typedef Parse_UInt16 Parse_Type;
- ///////////////////////////////////////////////////////////////////////////
+# ifndef DOXYGEN
- typedef Parse_UInt16 Parse_Type;
+ SENF_PACKET_PARSER_INIT(Parse_Ethernet);
SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
((Field)( destination, Parse_MAC ))
((Field)( source, Parse_MAC ))
((Field)( type, Parse_Type )) );
+
+# else
+
+ Parse_MAC destination();
+ Parse_MAC source();
+ Parse_Type type();
+
+# endif
};
/** \brief EtherType registry
Parser interpreting the ethernet VLAN tag. Fields are
- <table class="senf">
- <tr> <th>Field name</th><th>Parser type</th></tr>
- <tr><td>priority</td><td>\ref Parse_Priority</td></tr>
- <tr><td>cfi</td><td>\ref Parse_CFI</td></tr>
- <tr><td>vlanId</td><td>\ref Parse_VLanId</td></tr>
- <tr><td>type</td><td>\ref Parse_Type</td></tr>
- </table>
-
\see EthVLanPacketType
*/
struct Parse_EthVLan : public PacketParserBase
{
- SENF_PACKET_PARSER_INIT(Parse_EthVLan);
-
- ///////////////////////////////////////////////////////////////////////////
-
typedef Parse_UIntField < 0, 3 > Parse_Priority;
typedef Parse_Flag < 3 > Parse_CFI;
typedef Parse_UIntField < 4, 16 > Parse_VLanId;
typedef Parse_UInt16 Parse_Type;
+# ifndef DOXYGEN
+
+ SENF_PACKET_PARSER_INIT(Parse_EthVLan);
+
SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
((OverlayField)( priority, Parse_Priority ))
((OverlayField)( cfi, Parse_CFI ))
((Field )( vlanId, Parse_VLanId ))
((Field )( type, Parse_Type )) );
+
+# else
+
+ Parse_Priority priority();
+ Parse_CFI cfi();
+ Parse_VLanId vlanId();
+ Parse_Type type();
+
+# endif
};
/** \brief Ethernet VLAN tag
Parser implementing the IpV4 header. The fields implemented are:
- <table class="senf">
- <tr><th>Field name</th><th>Parser type</th></tr>
- <tr><td>version</td><td>\ref Parse_Version</td></tr>
- <tr><td>ihl</td><td>\ref Parse_IHL</td></tr>
- <tr><td>tos</td><td>\ref Parse_8bit</td></tr>
- <tr><td>length</td><td>\ref Parse_16bit</td></tr>
- <tr><td>identifier</td><td>\ref Parse_16bit</td></tr>
- <tr><td>reserved</td><td>\ref Parse_R</td></tr>
- <tr><td>df</td><td>\ref Parse_DF</td></tr>
- <tr><td>mf</td><td>\ref Parse_MF</td></tr>
- <tr><td>frag</td><td>\ref Parse_Frag</td></tr>
- <tr><td>ttl</td><td>\ref Parse_8bit</td></tr>
- <tr><td>protocol</td><td>\ref Parse_8bit</td></tr>
- <tr><td>crc</td><td>\ref Parse_16bit</td></tr>
- <tr><td>source</td><td>\ref Parse_32bit</td></tr>
- <tr><td>destination</td><td>\ref Parse_32bit</td></tr>
- </table>
-
\see IpV4PacketType \n
<a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
*/
struct Parse_IpV4 : public PacketParserBase
{
- SENF_PACKET_PARSER_NO_INIT(Parse_IpV4);
-
- ///////////////////////////////////////////////////////////////////////////
-
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;
}
Parser implementing the IpV6 fragment extension. The fields implemented are:
- <table class="senf">
- <tr><th>Field name</th><th>Parser type</th></tr>
- <tr><td>nextHeader</td><td>\ref Parse_8bit</td></tr>
- <tr><td>reserved1</td><td>\ref Parse_8bit</td></tr>
- <tr><td>fragmentOffset</td><td>\ref Parse_Offset</td></tr>
- <tr><td>reserved2</td><td>\ref Parse_Reserved</td></tr>
- <tr><td>moreFragments</td><td>\ref Parse_More</td></tr>
- <tr><td>id</td><td>\ref Parse_32bit</td></tr>
- </table>
-
\see IpV6ExtensionType_Fragment \n
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
struct Parse_IpV6Extension_Fragment : public PacketParserBase
{
- SENF_PACKET_PARSER_INIT(Parse_IpV6Extension_Fragment);
-
- ///////////////////////////////////////////////////////////////////////////
-
typedef Parse_UInt8 Parse_8bit;
typedef Parse_UIntField < 0, 13 > Parse_Offset;
typedef Parse_UIntField < 13, 15 > Parse_Reserved;
typedef Parse_Flag < 15 > Parse_More;
typedef Parse_UInt32 Parse_32bit;
+# ifndef DOXYGEN
+
+ SENF_PACKET_PARSER_INIT(Parse_IpV6Extension_Fragment);
+
SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
((Field )( nextHeader , Parse_8bit ))
((Field )( reserved1 , Parse_8bit ))
((OverlayField)( reserved2 , Parse_Reserved ))
((Field )( moreFragments , Parse_More ))
((Field )( id , Parse_32bit )) );
+
+# else
+
+ Parse_8bit nextHeader();
+ Parse_8bit reserved1();
+ Parse_Offset fragmentOffset();
+ Parse_Reserved reserved2();
+ Parse_More moreFragments();
+ Parse_32bit id();
+
+# endif
};
/** \brief IpV6 fragment extension
Parser implementing the IpV6 header. The fields implemented are:
- <table class="senf">
- <tr><th>Field name</th><th>Parser type</th></tr>
- <tr><td>version</td><td>\ref Parse_Version</td></tr>
- <tr><td>trafficClass</td><td>\ref Parse_Class</td></tr>
- <tr><td>flowLabel</td><td>\ref Parse_FlowLabel</td></tr>
- <tr><td>length</td><td>\ref Parse_16bit</td></tr>
- <tr><td>nextHeader</td><td>\ref Parse_8bit</td></tr>
- <tr><td>hopLimit</td><td>\ref Parse_8bit</td></tr>
- <tr><td>source</td><td>\ref Parse_Addr</td></tr>
- <tr><td>destination</td><td>\ref Parse_Addr</td></tr>
- </table>
-
\see IpV6PacketType \n
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
struct Parse_IpV6 : public PacketParserBase
{
- SENF_PACKET_PARSER_NO_INIT(Parse_IpV6);
-
- ///////////////////////////////////////////////////////////////////////////
-
typedef Parse_UIntField < 0, 4 > Parse_Version;
typedef Parse_UIntField < 4, 12 > Parse_Class;
typedef Parse_UIntField < 12, 32 > Parse_FlowLabel;
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 ))
((OverlayField)( trafficClass, Parse_Class ))
((Field )( source, Parse_Addr ))
((Field )( destination, Parse_Addr )) );
+# else
+
+ Parse_Version version();
+ Parse_Class trafficClass();
+ Parse_FlowLabel flowLabel();
+ Parse_16bit length();
+ Parse_8bit nextHeader();
+ Parse_8bit hopLimit();
+ Parse_Addr source();
+ Parse_Addr destination();
+
+# endif
+
void init() {
version() = 6;
}
Parser implementing the UDP header. The fields implemented are:
- <table class="senf">
- <tr><th>Field name</th><th>Parser type</th></tr>
- <tr><td>source</td><td>\ref Parse_16bit</td></tr>
- <tr><td>destination</td><td>\ref Parse_16bit</td></tr>
- <tr><td>length</td><td>\ref Parse_16bit</td></tr>
- <tr><td>crc</td><td>\ref Parse_16bit</td></tr>
- </table>
-
\see UDPPacketType
<a href="http://tools.ietf.org/html/rfc768">RFC 768</a>
*/
struct Parse_UDP : public PacketParserBase
{
- SENF_PACKET_PARSER_INIT(Parse_UDP);
+ typedef Parse_UInt16 Parse_16bit;
- ///////////////////////////////////////////////////////////////////////////
+# ifndef DOXYGEN
- typedef Parse_UInt16 Parse_16bit;
+ SENF_PACKET_PARSER_INIT(Parse_UDP);
SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
((Field)( source, Parse_16bit ))
((Field)( destination, Parse_16bit ))
((Field)( length, Parse_16bit ))
((Field)( crc, Parse_16bit )) );
+
+# else
+
+ Parse_16bit source();
+ Parse_16bit destination();
+ Parse_16bit length();
+ Parse_16bit crc();
+
+# endif
};
/** \brief UDP packet