//-----------------------------------------------------------------------------
// IcmpHeader
//-----------------------------------------------------------------------------
-//
-// ICMP Generic Header Format
-//
-// 0 8 16 31
-// +---------------+---------------+------------------------------+ ---
-// | | | | ^
-// | type | code | checksum | 4 bytes
-// | | | | v
-// +---------------+---------------+------------------------------+ ---
-// | |
-// | specific to each message |
-// | |
-// +-------------------------------+------------------------------+
-//
-//-----------------------------------------------------------------------------
+/**
+ * @brief This class represents the ICMP Packet Header.
+ *
+ * The ICMP Generic Header Format is:
+ *
+ * @code
+ * 0 8 16 31
+ * +---------------+---------------+------------------------------+ ---
+ * | | | | ^
+ * | type | code | checksum | 4 bytes
+ * | | | | v
+ * +---------------+---------------+------------------------------+ ---
+ * | |
+ * | specific to each message |
+ * | |
+ * +-------------------------------+------------------------------+
+ * @endcode
+ */
class IcmpHeader
{
public:
);
private:
- /// changeable pointer to different ICMP messages types
+ /// Changeable pointer to different ICMP messages types.
boost::shared_ptr<IcmpMessage> MessageFormat;
};
//-----------------------------------------------------------------------------
// Ipv4Header
//-----------------------------------------------------------------------------
-// IPv4 header format:
-//
-// 0 8 16 31
-// +-------+-------+---------------+------------------------------+ ---
-// | | | | | ^
-// |version|header | type of | total length in bytes | |
-// | (4) | length| service | | |
-// +-------+-------+---------------+-+-+-+------------------------+ |
-// | | | | | | |
-// | identification |0|D|M| fragment offset | |
-// | | |F|F| | |
-// +---------------+---------------+-+-+-+------------------------+ |
-// | | | | |
-// | time to live | protocol | header checksum | 20 bytes
-// | | | | |
-// +---------------+---------------+------------------------------+ |
-// | | |
-// | source IPv4 address | |
-// | | |
-// +--------------------------------------------------------------+ |
-// | | |
-// | destination IPv4 address | |
-// | | v
-// +--------------------------------------------------------------+ ---
-// | | ^
-// | | |
-// / options (if any) / 0 - 40
-// / / bytes
-// | | |
-// | | v
-// +--------------------------------------------------------------+ ---
-//
-//-----------------------------------------------------------------------------
+/**
+ * @brief This class represents the IP version 4 Packet Header.
+ *
+ * The IPv4 header format is:
+ *
+ * @code
+ * 0 8 16 31
+ * +-------+-------+---------------+------------------------------+ ---
+ * | | | | | ^
+ * |version|header | type of | total length in bytes | |
+ * | (4) | length| service | | |
+ * +-------+-------+---------------+-+-+-+------------------------+ |
+ * | | | | | | |
+ * | identification |0|D|M| fragment offset | |
+ * | | |F|F| | |
+ * +---------------+---------------+-+-+-+------------------------+ |
+ * | | | | |
+ * | time to live | protocol | header checksum | 20 bytes
+ * | | | | |
+ * +---------------+---------------+------------------------------+ |
+ * | | |
+ * | source IPv4 address | |
+ * | | |
+ * +--------------------------------------------------------------+ |
+ * | | |
+ * | destination IPv4 address | |
+ * | | v
+ * +--------------------------------------------------------------+ ---
+ * | | ^
+ * | | |
+ * / options (if any) / 0 - 40
+ * / / bytes
+ * | | |
+ * | | v
+ * +--------------------------------------------------------------+ ---
+ * @endcode
+ */
class Ipv4Header
{
public:
//-----------------------------------------------------------------------------
// PseudoIpv4Header
//-----------------------------------------------------------------------------
-// Pseudo IPv4 header format used by TCP and UDP checksums:
-//
-// 0 8 16 31
-// +--------------------------------------------------------------+ ---
-// | | ^
-// | source IPv4 address | |
-// | | |
-// +--------------------------------------------------------------+ |
-// | | |
-// | destination IPv4 address | 12 bytes
-// | | |
-// +---------------+---------------+------------------------------+ |
-// | | | | |
-// | zero | protocol | header length | |
-// | | | | v
-// +---------------+---------------+------------------------------+ ---
-//
-//-----------------------------------------------------------------------------
+/**
+ * @brief This class represents a Pseudo IP header used to compute checksum of
+ * transport level protocols.
+ *
+ * Pseudo IPv4 header format used by TCP and UDP checksums:
+ *
+ * @code
+ * 0 8 16 31
+ * +--------------------------------------------------------------+ ---
+ * | | ^
+ * | source IPv4 address | |
+ * | | |
+ * +--------------------------------------------------------------+ |
+ * | | |
+ * | destination IPv4 address | 12 bytes
+ * | | |
+ * +---------------+---------------+------------------------------+ |
+ * | | | | |
+ * | zero | protocol | header length | |
+ * | | | | v
+ * +---------------+---------------+------------------------------+ ---
+ * @endcode
+ */
class PseudoIpv4Header
{
public:
+ /// Source IPv4 address
uint32_t source_address;
+ /// Destination IPv4 address
uint32_t destination_address;
+ /// Zero
uint8_t zero_byte;
- uint8_t protocol; // protocol
- uint16_t header_length; // TCP or UDP header length
+ /// Transport layer protocol
+ uint8_t protocol;
+ /// TCP or UDP header length
+ uint16_t header_length;
};
#endif /* PSEUDO_IPV4_HEADER_H */
//-----------------------------------------------------------------------------
// TcpHeader
//-----------------------------------------------------------------------------
-//
-// TCP Segment header.
-//
-// The wire format of a TCP header is:
-//
-// 0 4 8 16 24 31
-// +-------------------------------+------------------------------+ ---
-// | | | ^
-// | source port | destination port | |
-// | | | |
-// +--------------------------------------------------------------+ |
-// | | |
-// | sequence number | |
-// | | |
-// +--------------------------------------------------------------+ |
-// | | |
-// | acknowledgment number (if ACK set) | 20 bytes
-// | | |
-// +-------+-------+-+-+-+-+-+-+-+-+------------------------------+ |
-// | data | reser-|C|E|U|A|P|R|S|F| | |
-// |offset | ved |W|C|R|C|S|S|Y|I| window size | |
-// | | |R|E|G|K|H|T|N|N| | |
-// +---------------+-+-+-+-+-+-+-+-+------------------------------+ |
-// | | | |
-// | checksum | urgent pointer (if URG set) | |
-// | | | v
-// +-----------------------------------------------+--------------+ ---
-// | | | ^
-// | | | |
-// | options (if Data Offset > 5) | padding / 0 - 40
-// | | / bytes
-// | | | |
-// | | | v
-// +-----------------------------------------------+--------------+ ---
-//
-//-----------------------------------------------------------------------------
+/**
+ * @brief This class represents the TCP Segment Header.
+ *
+ * The wire format of a TCP header is:
+ *
+ * @code
+ * 0 4 8 16 24 31
+ * +-------------------------------+------------------------------+ ---
+ * | | | ^
+ * | source port | destination port | |
+ * | | | |
+ * +--------------------------------------------------------------+ |
+ * | | |
+ * | sequence number | |
+ * | | |
+ * +--------------------------------------------------------------+ |
+ * | | |
+ * | acknowledgment number (if ACK set) | 20 bytes
+ * | | |
+ * +-------+-------+-+-+-+-+-+-+-+-+------------------------------+ |
+ * | data | reser-|C|E|U|A|P|R|S|F| | |
+ * |offset | ved |W|C|R|C|S|S|Y|I| window size | |
+ * | | |R|E|G|K|H|T|N|N| | |
+ * +---------------+-+-+-+-+-+-+-+-+------------------------------+ |
+ * | | | |
+ * | checksum | urgent pointer (if URG set) | |
+ * | | | v
+ * +-----------------------------------------------+--------------+ ---
+ * | | | ^
+ * | | | |
+ * | options (if Data Offset > 5) | padding / 0 - 40
+ * | | / bytes
+ * | | | |
+ * | | | v
+ * +-----------------------------------------------+--------------+ ---
+ * @endcode
+ */
class TcpHeader
{
public: