GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::PACKET::ICMPV4 (3)

.ds Aq ’

NAME

Net::Packet::ICMPv4 - Internet Control Message Protocol v4 layer 4 object

CONTENTS

SYNOPSIS



   use Net::Packet::Consts qw(:icmpv4);
   require Net::Packet::ICMPv4;

   # Build echo-request header
   my $echo = Net::Packet::ICMPv4->new(data => 0123456789);

   # Build information-request header
   my $info = Net::Packet::ICMPv4->new(
      type => NP_ICMPv4_TYPE_INFORMATION_REQUEST,
      data => 0123456789,
   );

   # Build address-mask request header
   my $mask = Net::Packet::ICMPv4->new(
      type => NP_ICMPv4_TYPE_ADDRESS_MASK_REQUEST,
      data => 0123456789,
   );

   # Build timestamp request header
   my $timestamp = Net::Packet::ICMPv4->new(
      type => NP_ICMPv4_TYPE_TIMESTAMP_REQUEST,
      data => 0123456789,
   );
   $timestamp->pack;

   print RAW: .unpack(H*, $timestamp->raw)."\n";

   # Read a raw layer
   my $layer = Net::Packet::ICMPv4->new(raw => $raw);

   print $layer->print."\n";
   print PAYLOAD: .unpack(H*, $layer->payload)."\n"
      if $layer->payload;



DESCRIPTION

This modules implements the encoding and decoding of the ICMPv4 layer.

RFC: ftp://ftp.rfc-editor.org/in-notes/rfc792.txt

See also <B>Net::Packet::LayerB> and <B>Net::Packet::Layer4B> for other attributes a nd methods.

ATTRIBUTES

<B>typeB>
<B>codeB> Type and code fields. See <B>CONSTANTSB>.
<B>checksumB> The checksum of ICMPv4 header.
<B>identifierB> Identification number.
<B>sequenceNumberB> Sequence number.
<B>originateTimestampB>
<B>receiveTimestampB>
<B>transmitTimestampB> Three timestamps used by the <B>NP_ICMPv4_TYPE_TIMESTAMP_REQUESTB> message.
<B>addressMaskB> Used by the <B>NP_ICMPv4_TYPE_ADDRESS_MASK_REQUESTB> message.
<B>gatewayB> Used by the <B>NP_ICMPv4_TYPE_REDIRECTB> message.
<B>unusedB> Zero value field used in various ICMP messages.
<B>errorB> A pointer to a <B>Net::Packet::FrameB> object, usually set when an ICMP error message has been returned.
<B>dataB> Additionnal data can be added to an ICMP message, traditionnaly used in <B>NP_ICMPv4_TYPE_ECHO_REQUESTB>.

METHODS

<B>newB> Object constructor. You can pass attributes that will overwrite default ones. Default values:

type: NP_ICMPv4_TYPE_ECHO_REQUEST

code: NP_ICMPv4_CODE_ZERO

checksum: 0

identifier: getRandom16bitsInt()

sequenceNumber: getRandom16bitsInt()

originateTimestamp: time()

receiveTimestamp: 0

transmitTimestamp: 0

addressMask: 0

gateway: 127.0.0.1

unused: 0

data: ""

<B>recvB> Will search for a matching replies in <B>framesSortedB> or <B>framesB> from a <B>Net::Packet::DumpB> object.
<B>getDataLengthB> Returns the length in bytes of <B>dataB> attribute.
<B>packB> Packs all attributes into a raw format, in order to inject to network. Returns 1 on success, undef otherwise.
<B>unpackB> Unpacks raw data from network and stores attributes into the object. Returns 1 on success, undef otherwise.
<B>isTypeEchoRequestB>
<B>isTypeEchoReplyB>
<B>isTypeTimestampRequestB>
<B>isTypeTimestampReplyB>
<B>isTypeInformationRequestB>
<B>isTypeInformationReplyB>
<B>isTypeAddressMaskRequestB>
<B>isTypeAddressMaskReplyB>
<B>isTypeDestinationUnreachableB> Returns 1 if the <B>typeB> attribute is of specified type.

CONSTANTS

Load them: use Net::Packet::Consts qw(:icmpv4);
<B>NP_ICMPv4_CODE_ZEROB> ICMP code zero, used by various ICMP messages.
<B>NP_ICMPv4_TYPE_DESTINATION_UNREACHABLEB>
<B>NP_ICMPv4_CODE_NETWORKB>
<B>NP_ICMPv4_CODE_HOSTB>
<B>NP_ICMPv4_CODE_PROTOCOLB>
<B>NP_ICMPv4_CODE_PORTB>
<B>NP_ICMPv4_CODE_FRAGMENTATION_NEEDEDB>
<B>NP_ICMPv4_CODE_SOURCE_ROUTE_FAILEDB> Destination unreachable type, with possible code numbers.
<B>NP_ICMPv4_TYPE_REDIRECTB>
<B>NP_ICMPv4_CODE_FOR_NETWORKB>
<B>NP_ICMPv4_CODE_FOR_HOSTB>
<B>NP_ICMPv4_CODE_FOR_TOS_AND_NETWORKB>
<B>NP_ICMPv4_CODE_FOR_TOS_AND_HOSTB> Redirect type message, with possible code numbers.
<B>NP_ICMPv4_TYPE_TIME_EXCEEDEDB>
<B>NP_ICMPv4_CODE_TTL_IN_TRANSITB>
<B>NP_ICMPv4_CODE_FRAGMENT_REASSEMBLYB> Time exceeded message, with possible code numbers.
<B>NP_ICMPv4_TYPE_ECHO_REQUESTB>
<B>NP_ICMPv4_TYPE_ECHO_REPLYB>
<B>NP_ICMPv4_TYPE_TIMESTAMP_REQUESTB>
<B>NP_ICMPv4_TYPE_TIMESTAMP_REPLYB>
<B>NP_ICMPv4_TYPE_INFORMATION_REQUESTB>
<B>NP_ICMPv4_TYPE_INFORMATION_REPLYB>
<B>NP_ICMPv4_TYPE_ADDRESS_MASK_REQUESTB>
<B>NP_ICMPv4_TYPE_ADDRESS_MASK_REPLYB> Other request/reply ICMP messages types.

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Copyright (c) 2004-2009, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.

RELATED MODULES

NetPacket, Net::RawIP, Net::RawSock
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::PACKET::ICMPV4 (3) 2009-11-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.