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

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

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

Parameters:
data The destination array
length The length of the destination array
offset The offset where the header has to be copied
Exceptions:
TrException There isn't enough place in the array data to hold the header

Implements Header.

Definition at line 299 of file IP4Header.cc.

                                                    {
  uint8* ptr = data + offset;

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

  // Copy the header
  memcpy(ptr, header, 20);
}


Generated by  Doxygen 1.6.0   Back to index