Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Net::Packet::Env(3)   User Contributed Perl Documentation  Net::Packet::Env(3)

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

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
       Net::Packet::Frame default behaviour regarding auto creation of
       Net::Packet::Desc and Net::Packet::Dump objects.

ATTRIBUTES
       dev The device on which frames will be injected.

       ip  The IPv4 address of dev. It will be used by default for all created
	   frames.

       ip6 The IPv6 address of dev. It will be used by default for all created
	   frames.

       mac The MAC address of dev. It will be used by default for all created
	   frames.

       subnet
	   The subnet address of dev. It will be set automatically.

       gatewayIp
	   The gateway IP address of dev. It is	set automatically under	all
	   platforms.

       gatewayMac
	   The gateway MAC address of dev. It will not be set automatically.
	   Due to the implementation of	ARP lookup within Net::Packet, we
	   can't do it within this module. It is done within
	   Net::Packet::DescL3 under Windows, to automatically build the layer
	   2 header.

       desc
	   The Net::Packet::Desc object	used to	inject frames to network.

       dump
	   The Net::Packet::Dump object	used to	receive	frames from network.

       noFrameAutoDesc
	   This	attribute controls Net::Packet::Frame behaviour	regarding
	   Net::Packet::Desc autocreation. If set to 0,	when a
	   Net::Packet::Frame is created for the first time, a
	   Net::Packet::Desc object will be created if none has	been set in
	   desc	attribute for default $Env object. Setting it to 1 avoids this
	   behaviour.

       noFrameAutoDump
	   Same	as above, but for Net::Packet::Dump object.

       noDescAutoSet
	   This	attribute controls Net::Packet::Desc behaviour regarding
	   global $Env autosetting behaviour. If set to	0, when	a
	   Net::Packet::Desc is	created	for the	first time, the	created
	   Net::Packet::Desc object will have a	pointer	to it stored in	desc
	   attribute of	$Env default object. Setting it	to 1 avoids this
	   behaviour.

       noDumpAutoSet
	   Same	as above, but for Net::Packet::Dump object.

       noFramePadding
	   By default, when a Net::Packet::Frame object	is created from
	   analyzing a raw string (either by taking from Net::Packet::Dump
	   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.

       doFrameReturnList
	   By default, when a Net::Packet::Frame object	is created from
	   analyzing a raw string (either by taking from Net::Packet::Dump
	   object or from user), only the first	found frame is returned. If
	   you set it to true, an arrayref of Net::Packet::Frame 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.

       noFrameComputeChecksums
       noFrameComputeLengths
	   By default, when a Net::Packet::Frame 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
	   doIPv4Checksum for the exception.

       doIPv4Checksum
	   This	parameter exists to improve performances of the	framework.
	   When	you send an IPv4 frame at layer	3 (using a Net::Packet::DescL3
	   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 Net::Packet::DescL3 is a wrapper around
	   Net::Packet::DescL2,	this parameter will be set to true on
	   Net::Packet::DescL3 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.

       doMemoryOptimizations
	   By default, no memory optimizations are made	to improve speed. You
	   can enable those optimizations (mostly done in Net::Packet::Frame)
	   in order to gain ~ 10% in memory, at	the cost of ~ 10% in speed.

       debug
	   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
       new 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 getDevInfo method. If user provided, all ip, ip6 and mac
	   attributes will be used for that dev.

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

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

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

       getDevInfo [ (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.

       getDevInfoFor (scalar)
	   Will	set internal attributes	for network interface passed as	a
	   parameter. Those internal attributes	are used to get	IP, IPv6 and
	   MAC attributes.

       updateDevInfo (scalar)
	   This	is a helper method. You	pass an	IP address as a	parameter, and
	   all attributes for elected network interface	will be	updated	(dev,
	   ip, ip6, mac, subnet, gatewayIp).

       getDev
	   Returns network interface, by looking at internal attribute.

       getMac
	   Returns MAC address,	by looking at internal attribute.

       getSubnet
	   Returns subnet address, by looking at internal attribute.

       getIp
	   Returns IP address, by looking at internal attribute.

       getIp6
	   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

perl v5.32.1			  2009-11-09		   Net::Packet::Env(3)

NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | METHODS | AUTHOR | COPYRIGHT AND LICENSE | RELATED MODULES

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Net::Packet::Env&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help