#ifndef RAW_IP_PACKET_H
#define RAW_IP_PACKET_H
-#ifdef FREE_BSD
+#if defined(FREE_BSD) || defined(FREE_BSD5)
#include <netinet/in_systm.h> // n_long in netinet/ip.h
#endif
union
{
- uint8_t pckt[pcktSize]; // îÁÞÁÌÏ ÐÁËÅÔÁ ÚÁÈ×ÁÞÅÎÎÏÇÏ ÉÚ ÓÅÔÉ
+ uint8_t pckt[pcktSize]; // Packet header as a raw data
struct
{
struct ip ipHeader;
uint16_t dPort;
} header __attribute__ ((packed));
};
-int32_t dataLen; // äÌÉÎÁ IP ÐÁËÅÔÁ. åÓÌÉ -1, ÔÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÄÌÉÎÕ ÉÚ ÚÁÇÏÌÏ×ËÁ ÓÁÍÏÇÏ ÐÁËÅÔÁ.
+int32_t dataLen; // IP packet length. Set to -1 to use length field from the header
};
//-----------------------------------------------------------------------------
inline uint16_t RAW_PACKET::GetIPVersion() const
return true;
}
-/*//-----------------------------------------------------------------------------
-inline bool operator==(const RAW_PACKET & lhs, const RAW_PACKET & rhs)
-{
-if (lhs.GetSrcIP() != rhs.GetSrcIP())
- return false;
-
-if (lhs.GetDstIP() != rhs.GetDstIP())
- return false;
-
-if (lhs.GetSrcPort() != rhs.GetSrcPort())
- return false;
-
-if (lhs.GetDstPort() != rhs.GetDstPort())
- return false;
-
-if (lhs.GetProto() != rhs.GetProto())
- return false;
-
-return true;
-}*/
//-----------------------------------------------------------------------------
inline bool RAW_PACKET::operator<(const RAW_PACKET & rvalue) const
{
return false;
}
//-----------------------------------------------------------------------------
-/*inline bool operator<(const RAW_PACKET & lhs, const RAW_PACKET & rhs)
-{
-if (lhs.GetSrcIP() < rhs.GetSrcIP())
- return true;
-if (lhs.GetSrcIP() > rhs.GetSrcIP())
- return false;
-
-if (lhs.GetDstIP() < rhs.GetDstIP())
- return true;
-if (lhs.GetDstIP() > rhs.GetDstIP())
- return false;
-
-if (lhs.GetSrcPort() < rhs.GetSrcPort())
- return true;
-if (lhs.GetSrcPort() > rhs.GetSrcPort())
- return false;
-
-if (lhs.GetDstPort() < rhs.GetDstPort())
- return true;
-if (lhs.GetDstPort() > rhs.GetDstPort())
- return false;
-
-if (lhs.GetProto() < rhs.GetProto())
- return true;
-
-return false;
-}*/
-//-----------------------------------------------------------------------------
#endif