NAME

Net::IPAM::Util - A selection of general utility subroutines for Net::IPAM

SYNOPSIS

use Net::IPAM::Util qw(incr_n);

$n = incr_n("\x0a\x00\x00\x01");                                  # 10.0.0.2
$n = incr_n( pack( 'n8', 0x2001, 0xdb8, 0, 0, 0, 0, 0, 1, ) );    # 2001:db8::2

FUNCTIONS

incr_n

Increment a packed IPv4 or IPv6 address in network byte order. Returns undef on overflow.

This increment function is needed in Net::IPAM::IP and Net::IPAM::Block for transparent handling of IPv4 and IPv6 addresses and blocks.

This is the only math operation needed for iterating over blocks, splitting blocks to CIDRs or aggregate IPs and blocks to CIDRs.

No need for Math::BigInt, this pure perl algorithm works for all uint_n in network byte order, where n is a multiple of 32: uint_32, uint_64, uint_96, uint_128, ...

AUTHOR

Karl Gaissmaier, <karl.gaissmaier(at)uni-ulm.de>

BUGS

Please report any bugs or feature requests to bug-net-ipam-util at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IPAM-Util. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::IPAM::Util

You can also look for information at:

  • on github

    TODO

SEE ALSO

Net::IPAM::IP Net::IPAM::Block Net::IPAM::Tree

LICENSE AND COPYRIGHT

This software is copyright (c) 2020 by Karl Gaissmaier.

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