IP
NAME
Net::BGP::IP - IP Address Handling Functionality
SYNOPSIS
IPv4
use Net::BGP::IP;
my $ip = int-to-ipv4(1000); # Converts 1000 to an IPv4 string
my $int = ipv4-to-int('192.0.2.4'); # Converts to an integer
# Returns 192.0.2.1
my $cannonical = ip-cannonical('192.0.2.'1);
my $cannonical = ip-cannonical('::ffff:192.0.2.'1);
IPv6
use Net::BGP::IP;
# Returns 2001:db8::1
my $ip = int-to-ipv6(42540766411282592856903984951653826561); # 2001:db8::1
# Returns the integer value of 2001:db8::1
my $int = ipv6-to-int('2001:db8::1');
# Will return: 2001:0db8:0000:0000:0000:0000:0000:0000
my $expanded = ipv6-expand('2001:db8::1');
# Will return 2001:db8::1
my $compact = ipv6-compact('2001:0db8:0:000:0::01');
# Returns 2001:db8::1
my $cannonical = ip-cannonical('2001:0db8:0::0:1');
SUBROUTINES
buf8-to-ipv4
Takes a buffer (or any other list of numbers) 4 elements long and, assuming network ordering, returns an IPv4 address.
int-to-ipv4
Converts an integer into a string representation of an IPv4 address.
ipv4-to-int
Converts an IPv4 string into an integer.
ipv4-to-buf8
Converts an IPv4 string into a buf8 object (in network byte order).
int-to-ipv6
Converts an integer into a string representation of an IPv6 address.
ipv6-to-int
Converts an IPv6 string into an integer.
ipv6-to-buf8
Converts an IPv6 string into a buf8 object (in network byte order).
ipv6-expand
Expands an IPv6 address by expanding "::" and adding leading zeros.
ipv6-compact
Produces the shortest possible string representation of an IPv6 address.
ip-cannonical
Returns the shortest possible string representation of an IPv4 or IPv6 address.
ip-valid
Returns true if the IP address is a valid IPv4 or IPv6 address.
IPv4
AUTHOR
Joelle Maslak <[email protected]>
COPYRIGHT AND LICENSE
Copyright © 2018-2019 Joelle Maslak
This library is free software; you can redistribute it and/or modify it under the Artisitc License 2.0.