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::FRAME::LAYER::IPV4 (3)

.ds Aq ’

NAME

Net::Frame::Layer::IPv4 - Internet Protocol v4 layer object

CONTENTS

SYNOPSIS



   use Net::Frame::Layer::IPv4 qw(:consts);

   # Build a layer
   my $layer = Net::Frame::Layer::IPv4->new(
      version  => 4,
      tos      => 0,
      id       => getRandom16bitsInt(),
      length   => NF_IPv4_HDR_LEN,
      hlen     => 5,
      flags    => 0,
      offset   => 0,
      ttl      => 128,
      protocol => NF_IPv4_PROTOCOL_TCP,
      checksum => 0,
      src      => 127.0.0.1,
      dst      => 127.0.0.1,
      options  => ,
      noFixLen => 0,
   );
   $layer->pack;

   print RAW: .$layer->dump."\n";

   # Read a raw layer
   my $layer = Net::Frame::Layer::IPv4->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 IPv4 layer.

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

See also <B>Net::Frame::LayerB> for other attributes and methods.

ATTRIBUTES

<B>idB> IP ID of the datagram.
<B>ttlB> Time to live.
<B>srcB>
<B>dstB> Source and destination IP addresses.
<B>protocolB> Of which type the layer 4 is.
<B>checksumB> IP checksum.
<B>flagsB> IP Flags.
<B>offsetB> IP fragment offset.
<B>versionB> IP version, here it is 4.
<B>tosB> Type of service flag.
<B>lengthB> Total length in bytes of the packet, including IP headers (that is, layer 3 + layer 4 + layer 7).
<B>hlenB> Header length in number of words, including IP options.
<B>optionsB> IP options, as a hexadecimal string.
<B>noFixLenB> Since the byte ordering of <B>lengthB> attribute varies from system to system, a subroutine inside this module detects which byte order to use. Sometimes, like when you build <B>Net::Frame::Layer::8021QB> layers, you may have the need to avoid this. So set it to 1 in order to avoid fixing. Default is 0 (that is to fix).
The following are inherited attributes. See <B>Net::Frame::LayerB> for more information.
<B>rawB>
<B>payloadB>
<B>nextLayerB>

METHODS

<B>newB>
<B>newB> (hash) Object constructor. You can pass attributes that will overwrite default ones. See <B>SYNOPSISB> for default values.
<B>getHeaderLengthB> Returns the header length in bytes, not including IP options.
<B>getOptionsLengthB> Returns the length in bytes of IP options. 0 if none.
<B>computeLengthsB> ({ payloadLength => VALUE }) In order to compute lengths attributes within IPv4 header, you need to pass via a hashref the number of bytes contained in IPv4 payload (that is, the sum of all layers after the IPv4 one).
<B>computeChecksumsB> Computes the IPv4 checksum.
The following are inherited methods. Some of them may be overridden in this layer, and some others may not be meaningful in this layer. See <B>Net::Frame::LayerB> for more information.
<B>layerB>
<B>computeLengthsB>
<B>computeChecksumsB>
<B>packB>
<B>unpackB>
<B>encapsulateB>
<B>getLengthB>
<B>getPayloadLengthB>
<B>printB>
<B>dumpB>

CONSTANTS

Load them: use Net::Frame::Layer::IPv4 qw(:consts);
<B>NF_IPv4_PROTOCOL_ICMPv4B>
<B>NF_IPv4_PROTOCOL_IGMPB>
<B>NF_IPv4_PROTOCOL_IPIPB>
<B>NF_IPv4_PROTOCOL_TCPB>
<B>NF_IPv4_PROTOCOL_EGPB>
<B>NF_IPv4_PROTOCOL_IGRPB>
<B>NF_IPv4_PROTOCOL_CHAOSB>
<B>NF_IPv4_PROTOCOL_UDPB>
<B>NF_IPv4_PROTOCOL_IDPB>
<B>NF_IPv4_PROTOCOL_DCCPB>
<B>NF_IPv4_PROTOCOL_IPv6B>
<B>NF_IPv4_PROTOCOL_IPv6ROUTINGB>
<B>NF_IPv4_PROTOCOL_IPv6FRAGMENTB>
<B>NF_IPv4_PROTOCOL_IDRPB>
<B>NF_IPv4_PROTOCOL_RSVPB>
<B>NF_IPv4_PROTOCOL_GREB>
<B>NF_IPv4_PROTOCOL_ESPB>
<B>NF_IPv4_PROTOCOL_AHB>
<B>NF_IPv4_PROTOCOL_ICMPv6B>
<B>NF_IPv4_PROTOCOL_EIGRPB>
<B>NF_IPv4_PROTOCOL_OSPFB>
<B>NF_IPv4_PROTOCOL_ETHERIPB>
<B>NF_IPv4_PROTOCOL_PIMB>
<B>NF_IPv4_PROTOCOL_VRRPB>
<B>NF_IPv4_PROTOCOL_STPB>
<B>NF_IPv4_PROTOCOL_SCTPB>
<B>NF_IPv4_PROTOCOL_UDPLITEB> Various protocol type constants.
<B>NF_IPv4_MORE_FRAGMENTB>
<B>NF_IPv4_DONT_FRAGMENTB>
<B>NF_IPv4_RESERVED_FRAGMENTB> Various possible flags.

SEE ALSO

Net::Frame::Layer

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Copyright (c) 2006-2015, Patrice <GomoR> Auffret

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::FRAME::LAYER::IPV4 (3) 2015-11-16

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