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

void UDPHeader::pack ( uint8 *  data,
int  length,
int  offset 
) [virtual]

Copy this UDP header at offset offset in the array data.

data The destination array
length The length of the destination array (in bytes).
offset The offset where the jeader has to be copied
TrException There isn't enough place in the array data to hold the header

Implements Header.

Definition at line 127 of file UDPHeader.cc.

Referenced by UDPProbe::UDPProbe().

  uint8* ptr = data + offset;

  // Check if the data structure can contain the UDP header
  if (offset + 8 > length)
    throw TrException(str_log(ERROR, "Not enough space in data array"));

  // Copy the header
  memcpy(ptr, header, 8);

Generated by  Doxygen 1.6.0   Back to index