Logo Search packages:      
Sourcecode: paris-traceroute version File versions  Download package

void IP4Header::packPseudo ( uint16  dgram_len,
uint8 *  data,
int  data_len,
int  offset 
)

Exceptions:
TrException There isn't enough place in the array data to hold the pseudo header

Definition at line 315 of file IP4Header.cc.

References getDestAddress(), getProtocol(), getSourceAddress(), Util::write32(), and Util::writebe16().

Referenced by UDPProbe::UDPProbe().

                                                                             {
  uint8* ptr = data + offset;

  // Check if the data structure can contain the IP pseudo header
  if (offset + 12 > data_len)
    throw TrException(str_log(ERROR, "Not enough space in data array"));

  // Create the pseudo header
  memset(ptr, 0, 12);
  Util::write32(ptr, 0, getSourceAddress());
  Util::write32(ptr, 4, getDestAddress());
  ptr[9] = getProtocol();
  Util::writebe16(ptr, 10, dgram_len);
}


Generated by  Doxygen 1.6.0   Back to index