bool IPHeader::testCheckSum() const { CheckSum sum; sum(vhl,tos,len,id,flags_offset,ttl,proto.get(),check_sum,src.get(),dst.get()); return sum.test(); }
bool ICMPEcho::testCheckSum(PtrLen<const uint8> data) const { CheckSum sum; sum(type.get(),code,check_sum,id,num); sum.add(data); return sum.test(); }
bool UDPHeader::testCheckSum(IPAddress src,IPAddress dst,IPLen len,PtrLen<const uint8> data) const { if( !check_sum ) return true; CheckSum sum; uint16 proto=IP_UDP; sum(src.get(),dst.get(),proto,len,src_port,dst_port,len,check_sum); sum.add(data); return sum.test(); }