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

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

Copy this ICMP 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 228 of file ICMPHeader.cc.

References getHeaderLength().

Referenced by ICMPProbe::ICMPProbe().

                                                     {
  uint8* ptr = data + offset;

  // Check if the data structure can contain the ICMP header
  if (offset + getHeaderLength() > length)
    throw TrException("Not enough space in data array");

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


Generated by  Doxygen 1.6.0   Back to index