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  -  DATA::IPV4::RANGE::PARSE (3)

.ds Aq ’ package Data::IPV4::Range::Parse;

NAME

Data::IPV4::Range::Parse - Perl extension parsing ipv4 ranges

CONTENTS

SYNOPSIS



  use Data::IPV4::Range::Parse;
  ($stat_int,$end_int)=auto_parse_ipv4_range(10/24);
  ($stat_int,$end_int)=auto_parse_ipv4_range(10.0.0 - 11);
  ($stat_int,$end_int)=auto_parse_ipv4_range(9);

  unless(($stat_int,$end_int)=auto_parse_ipv4_range(10/)) {
    print "failed to parse 10/\n";
  }



DESCRIPTION

Simple Interface for getting start and ending address of ranges as integers.

    EXPORT

:CONSTANTS



 ALL_BITS
 MAX_CIDR
 MIN_CIDR



:PARSE_IP



 int_to_ip
 ip_to_int



:SORT



 sort_quad
 sort_notations



:COMPUTE_FROM_INT



 broadcast_int
 base_int
 size_from_mask
 hostmask
 cidr_to_int



:PARSE_RANGE



 parse_ipv4_cidr
 parse_ipv4_range
 parse_ipv4_ip
 auto_parse_ipv4_range



    CONSTANTS

This section explains the Exportable constants.
o ALL_BITS

Same as 0xffffffff

o MAX_CIDR

Same as 32

o MIN_CIDR

Same as 0

    PARSE_IP

This section covers the parse ipv4 address functions.
o my $int=ip_to_int(’10.0.0.1’);
o my $int=Data::IPV4::Range::Parse->ip_to_int(’10.0.0.1’);

Returns a perl usable integer ipv4 representation of the ipv4 quad notation.

o my $ip=int_to_ip($int);
o my $ip=Data::IPV4::Range::Parse->int_to_ip($int);

Returns the integer formated in the standard quad notation.

    SORT

This section covers the Exportable sort functions.
o my @ips=sort sort_quad @usorted_ips

Low level sort function used to sort ipv4 addresses in quad notation.

o my @ranges=sort sort_notations @unsorted_notations

Low level sort function used to sort ipv4 ranges. This function will croak if a range cannot be parsed.

    COMPUTE_FROM_INT

This section covers the Exportable integer computation functions
o my $broadcast_int=broadcast_int($ip_int,$mask_int);
o my $broadcast_int=Data::IPV4::Range::Parse->broadcast_int( $ip_int, $mask_int );

Returns an integer representing the broadcast address from 2 integers.

o my $base_int=base_int($ip_int,$mask_int);
o my $base_int=Data::IPV4::Range::Parse->base_int( $ip_int, $mask_int );

Returns an integer representing the base address from 2 integers.

o my $size=size_from_mask($mask_int)
o my $size=Data::IPV4::Range::Parse->size_from_mask($mask_int)

Returns an integer representing the size of a network.

o my $hostmask_int=hostmask($ip_int,$mask_int);
o my $hostmask_int=Data::IPV4::Range::Parse->hostmask( $ip_int, $mask_int );

Returns an integer representing the hostmask from 2 integers.

o my $mask_int=cidr_to_int(0-32);
o my $mask_int=Data::IPV4::Range::Parse->cidr_to_int( 0-32 );

Returns an integer representing netmask from a given cidr size.

    PARSE_RANGE

This section covers the Exportable range parser functions. An empty set is returned when the range cannot be parsed.
o my ($start,$end)=parse_ipv4_cidr(’10/23’);
o my ($start,$end)=Data::IPV4::Range::Parse->parse_ipv4_cidr( ’10/23’ );

Returns 2 integers representing the base and broadcast of a CIDR.

o my ($start,$end)=parse_ipv4_range( ’10 - 11’ );
o my ($start,$end)=Data::IPV4::Range::Parse->parse_ipv4_range( ’10 - 11’ );

Returns 2 integers representing the start and end of a ip range.

o my ($start,$end)=parse_ipv4_ip(’10.0.0.1’)
o my ($start,$end)=Data::IPV4::Range::Parse->parse_ipv4_ip( ’10.0.0.1’ )

Returns 2 integers representing the input ip as a /32 range

o my ($start,$end)=auto_parse_ipv4_range(’10’);
o my ($start,$end)= Data::IPV4::Range::Parse->auto_parse_ipv4_range( ’10’ );

Attempts to figure out what type of range notation and calls the corresponding parse_ipv4_xxx function, returning an empty set on failure or 2 integers representing the start and end of the range.

AUTHOR

Michael Shipper

SourceForge Project

As of version 1.04 the Project has been moved to SourceForge.net

Data IPV4 Range Parse <https://sourceforge.net/projects/data-ipv4-range/>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Michael Shipper

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.

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


perl v5.20.3 DATA::IPV4::RANGE::PARSE (3) 2010-11-05

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