Exemple #1
0
void UDPHeader::setCheckSum(IPAddress src,IPAddress dst,IPLen len,PtrLen<const uint8> data)
 {
  CheckSum sum;
  
  uint16 proto=IP_UDP;
  
  sum(src.get(),dst.get(),proto,len,src_port,dst_port,len);
  
  sum.add(data);
  
  check_sum=sum.complete();
 }
Exemple #2
0
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();
 }