X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e1f8528eb15323de349aff34f3dba7dcfdfbd15d..840d8fe043e441e30b337b1af470b33bc866418f:/include/raw_ip_packet.h?ds=inline diff --git a/include/raw_ip_packet.h b/include/raw_ip_packet.h index bca44b3d..a1bdda71 100644 --- a/include/raw_ip_packet.h +++ b/include/raw_ip_packet.h @@ -1,7 +1,7 @@ #ifndef RAW_IP_PACKET_H #define RAW_IP_PACKET_H -#ifdef FREE_BSD +#if defined(FREE_BSD) || defined(FREE_BSD5) #include // n_long in netinet/ip.h #endif @@ -46,7 +46,7 @@ bool operator<(const RAW_PACKET & rvalue) const; union { - uint8_t pckt[pcktSize]; // îÁÞÁÌÏ ÐÁËÅÔÁ ÚÁÈ×ÁÞÅÎÎÏÇÏ ÉÚ ÓÅÔÉ + uint8_t pckt[pcktSize]; // Packet header as a raw data struct { struct ip ipHeader; @@ -55,7 +55,7 @@ union 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 @@ -128,26 +128,6 @@ if (header.ipHeader.ip_p != rvalue.header.ipHeader.ip_p) 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 { @@ -184,33 +164,5 @@ if (header.ipHeader.ip_p < rvalue.header.ipHeader.ip_p) 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