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

.ds Aq ’

NAME

Net::Packet::Utils - useful subroutines used in Net::Packet

CONTENTS

SYNOPSIS



   # Load all subroutines
   use Net::Packet::Utils qw(:all);

   # Load only specific subroutines
   use Net::Packet::Utils qw(explodeIps explodePorts);

   my @ips   = explodeIps(192.168.0.1-254,192.168.1.1);
   my @ports = explodePorts(1-1024,6000);

   print "@ips\n";
   print "@ports\n";



DESCRIPTION

This module is not object oriented, it just implements some utilities used accros Net::Packet framework. They may be useful in other modules too, so here lies their descriptions.

SUBROUTINES

<B>getHostIpv4AddrB> (scalar) Tries to resolve hostname passed as an argument. Returns its IP address.
<B>getHostIpv4AddrsB> (scalar) Tries to resolve hostname passed as an argument. Returns an array of IP addresses.
<B>getHostIpv6AddrB> (scalar) Tries to resolve hostname passed as an argument. Returns its IPv6 address.
<B>inetAtonB> (scalar) Returns numeric value of IP address passed as an argument.
<B>inetNtoaB> (scalar) Returns IP address of numeric value passed as an argument.
<B>inet6AtonB> (scalar) Returns numeric value of IPv6 address passed as an argument.
<B>inet6NtoaB> (scalar) Returns IPv6 address of numeric value passed as an argument.
<B>getRandomHighPortB> Returns a port number for direct use as source in a TCP or UDP header (that is a port between 1025 and 65535).
<B>getRandom32bitsIntB> Returns a random integer of 32 bits in length.
<B>getRandom16bitsIntB> Returns a random integer of 16 bits in length.
<B>convertMacB> (scalar) Converts a MAC address from network format to human format.
<B>unpackIntFromNetB> (scalar, scalar, scalar, scalar, scalar) Almost used internally, to convert network bits to integers. First argument is what to convert, second is an unpack format, third the offset of first argument where bits to get begins, the fourth are padding bits to achieve the length we need, and the last is the number of bits to get from offset argument.
<B>packIntToNetB> (scalar, scalar, scalar, scalar) Almost used internally, to convert integers to network bits. First argument is what to convert, second is a pack format, third the offset where to store the first argument, and the last the number of bits the integer will be once packed.
<B>inetChecksumB> (scalar) Compute the INET checksum used in various layers.
<B>explodePortsB>
<B>explodeIpsB> See <B>SYNOPSISB>.
<B>getGatewayIpB> [ (scalar) ] Returns the gateway IP address for IP address passed as a parameter. If none provided, returns the default gateway IP address.
<B>getGatewayMacB> (scalar) Returns the gateway MAC address of specified gateway IP address. It first looks up from ARP cache table, then tries an ARP lookup if none was found, and adds it to ARP cache table.
<B>getIpMacB> (scalar) Returns the MAC address of specified IP address. It first looks up from ARP cache table. If nothing is found, it checks to see if the specified IP address is on the same subnet. If not, it returns the gateway MAC address, otherwise does an ARP lookup. Then, the ARP cache table is updated if an ARP resolution has been necessary.
<B>debugDeviceListB> If you have problem under Windows concerning network interfaces, please send me the output of this method.

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

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