NAME

IPDevice::IPv4

DESCRIPTION

This module provides routines for IP Version 4 based checks and conversions.

SYNOPSIS

 use IPDevice::IPv4;
 if (IPDevice::IPv4::check_ip("10.131.10.1")) { print "Valid IP address.";  }
 else                         { print "Invalid IP address"; }
 if (IPDevice::IPv4::check_ip("10.131.10.1/24")) { print "Valid prefix.";  }
 else                            { print "Invalid prefix"; }

METHODS

check_ip($ip)

Check the syntax of an IP address for validity.

check_prefix($prefix)

Check the syntax of an IP address prefix for validity.

check_prefixlen($prefixlength)

Check the syntax of an IP prefix length.

pfxlen2mask($prefixlength)

Convert a prefixlength to an IP mask address.

mask2pfxlen($mask)

Convert an IP mask address to a prefixlength.

ip2integer($ip)

Convert a human readable (byte notated) ip address to a 4-byte integer value.

integer2ip($integer)

Convert a 4 byte integer value into a human readable (byte notated) ip address.

prefix_match($network, $mask, $lessequal, $greaterequal, $prefix)

Returns TRUE if $prefix matches all of the given criterias.

get_remote_ip_from_local_ip($local)

Given an IP address from a /30 network, this function returns the IP address of the remote site. If the IP address is invalid, the function returns FALSE.

COPYRIGHT

Copyright (c) 2004 Samuel Abels, Ronny Weinreich. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Samuel Abels <spam debain org> Ronny Weinreich <rw AD nmc-m dtag de>