various cleanups

This commit is contained in:
Arnout Engelen
2004-08-30 14:29:18 +00:00
parent b4073a4cf5
commit 3b5ac96754
5 changed files with 29 additions and 13 deletions

View File

@@ -107,7 +107,7 @@ Packet * getPacket (const struct pcap_pkthdr * header, const u_char * packet)
if (ethernet->ether_type != 8)
{
#if DEBUG
cerr << "Dropped non-ip packet of type " << ethernet->ether_type << endl;
std::cerr << "Dropped non-ip packet of type " << ethernet->ether_type << std::endl;
#endif
return NULL;
}
@@ -116,7 +116,7 @@ Packet * getPacket (const struct pcap_pkthdr * header, const u_char * packet)
if (ip->ip_p != 6)
{
#if DEBUG
cerr << "Dropped non-tcp packet of type " << (int)(ip->ip_p) << endl;
std::cerr << "Dropped non-tcp packet of type " << (int)(ip->ip_p) << std::endl;
#endif
return NULL;
}
@@ -166,8 +166,11 @@ char * Packet::gethashstring ()
return retval;
}
/* 2 packets match if they have the same
* source and destination ports and IP's,
* or inverted. */
bool Packet::match (Packet * other)
{
return ((sport == other->sport) && (dport == other->dport)
&& (sameinaddr(sip, other->sip)) && (sameinaddr(dip, other->dip)));
return (sport == other->sport) && (dport == other->dport)
&& (sameinaddr(sip, other->sip)) && (sameinaddr(dip, other->dip));
}