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::ENV (3)

.ds Aq ’

NAME

Net::Packet::Env - environment object used for frame capture/injection

CONTENTS

SYNOPSIS



   use Net::Packet::Env qw($Env);

   # Get default values from system
   my $env = Net::Packet::Env->new;

   # Get values from a specific device
   my $env2 = Net::Packet::Env->new(dev => vmnet1);

   print "dev: ", $env->dev, "\n";
   print "mac: ", $env->mac, "\n";
   print "ip : ", $env->ip,  "\n" if $env->ip;
   print "ip6: ", $env->ip6, "\n" if $env->ip6;



DESCRIPTION

Basically, this module is used to tell where to inject a frame, and <B>Net::Packet::FrameB> default behaviour regarding auto creation of <B>Net::Packet::DescB> and <B>Net::Packet::DumpB> objects.

ATTRIBUTES

<B>devB> The device on which frames will be injected.
<B>ipB> The IPv4 address of <B>devB>. It will be used by default for all created frames.
<B>ip6B> The IPv6 address of <B>devB>. It will be used by default for all created frames.
<B>macB> The MAC address of <B>devB>. It will be used by default for all created frames.
<B>subnetB> The subnet address of <B>devB>. It will be set automatically.
<B>gatewayIpB> The gateway IP address of <B>devB>. It is set automatically under all platforms.
<B>gatewayMacB> The gateway MAC address of <B>devB>. It will not be set automatically. Due to the implementation of ARP lookup within <B>Net::PacketB>, we can’t do it within this module. It is done within <B>Net::Packet::DescL3B> under Windows, to automatically build the layer 2 header.
<B>descB> The <B>Net::Packet::DescB> object used to inject frames to network.
<B>dumpB> The <B>Net::Packet::DumpB> object used to receive frames from network.
<B>noFrameAutoDescB> This attribute controls <B>Net::Packet::FrameB> behaviour regarding <B>Net::Packet::DescB> autocreation. If set to 0, when a <B>Net::Packet::FrameB> is created for the first time, a <B>Net::Packet::DescB> object will be created if none has been set in <B>descB> attribute for default <B>B>$Env<B>B> object. Setting it to 1 avoids this behaviour.
<B>noFrameAutoDumpB> Same as above, but for <B>Net::Packet::DumpB> object.
<B>noDescAutoSetB> This attribute controls <B>Net::Packet::DescB> behaviour regarding global <B>B>$Env<B>B> autosetting behaviour. If set to 0, when a <B>Net::Packet::DescB> is created for the first time, the created <B>Net::Packet::DescB> object will have a pointer to it stored in <B>descB> attribute of <B>B>$Env<B>B> default object. Setting it to 1 avoids this behaviour.
<B>noDumpAutoSetB> Same as above, but for <B>Net::Packet::DumpB> object.
<B>noFramePaddingB> By default, when a <B>Net::Packet::FrameB> object is created from analyzing a raw string (either by taking from <B>Net::Packet::DumpB> object or from user), padding is achieved to complete the size of 60 bytes. Set this attribute to 1 if you do not want this behaviour.
<B>doFrameReturnListB> By default, when a <B>Net::Packet::FrameB> object is created from analyzing a raw string (either by taking from <B>Net::Packet::DumpB> object or from user), only the first found frame is returned. If you set it to true, an arrayref of <B>Net::Packet::FrameB> objects will be returned. For example, if you put an IPv6 frame within IPv4, or you get one from network, you will need to use this attribute.
<B>noFrameComputeChecksumsB>
<B>noFrameComputeLengthsB> By default, when a <B>Net::Packet::FrameB> object is packed, all layers checksums and lengths are computed (if respective layers implement that). If you want to do it yourself, set this to true. See <B>doIPv4ChecksumB> for the exception.
<B>doIPv4ChecksumB> This parameter exists to improve performances of the framework. When you send an IPv4 frame at layer 3 (using a <B>Net::Packet::DescL3B> object), under Unix systems, you MUST not compute IPv4 checksum. The kernel does it. Because this is the more general case (sending IPv4 at layer 3), this parameter is set to false by default. Note: under Windows, because <B>Net::Packet::DescL3B> is a wrapper around <B>Net::Packet::DescL2B>, this parameter will be set to true on <B>Net::Packet::DescL3B> object creation.

So, even if you let the framework compute checksums, IPv4 checksum will not be computed. If you want to send IPv4 frames at layer 2, you will need to also set this parameter to true.

<B>doMemoryOptimizationsB> By default, no memory optimizations are made to improve speed. You can enable those optimizations (mostly done in <B>Net::Packet::FrameB>) in order to gain ~ 10% in memory, at the cost of ~ 10% in speed.
<B>debugB> The environment debug directive. Set it to a number greater than 0 to increase the level of debug messages. Up to 3, default 0.

METHODS

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

debug: 0

noFrameAutoDesc: 0

noFrameAutoDump: 0

noDescAutoSet: 0

noDumpAutoSet: 0

dev: if not user provided, default interface is used, by calling <B>getDevInfoB> method. If user provided, all <B>ipB>, <B>ip6B> and <B>macB> attributes will be used for that <B>devB>.

ip: if not user provided, default interface IP is used, by calling <B>getIpB> method. If user provided, it is overwritten by the user.

ip6: if not user provided, default interface IPv6 is used, by calling <B>getIp6B> method. If user provided, it is overwritten by the user.

mac: if not user provided, default interface MAC is used, by calling <B>getMacB> method. If user provided, it is overwritten by the user.

<B>getDevInfoB> [ (scalar) ] By default, network device to use is the one used by default gateway. If you provide an IP address as a parameter, the interface used will be the one which have direct access to this IP address.
<B>getDevInfoForB> (scalar) Will set internal attributes for network interface passed as a parameter. Those internal attributes are used to get IP, IPv6 and MAC attributes.
<B>updateDevInfoB> (scalar) This is a helper method. You pass an IP address as a parameter, and all attributes for elected network interface will be updated (<B>devB>, <B>ipB>, <B>ip6B>, <B>macB>, <B>subnetB>, <B>gatewayIpB>).
<B>getDevB> Returns network interface, by looking at internal attribute.
<B>getMacB> Returns MAC address, by looking at internal attribute.
<B>getSubnetB> Returns subnet address, by looking at internal attribute.
<B>getIpB> Returns IP address, by looking at internal attribute.
<B>getIp6B> Returns IPv6 address, by looking at internal attribute.

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::ENV (3) 2009-11-09

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