NAME

FusionInventory::Agent::Tools::Network - Network-related patterns and functions

DESCRIPTION

This module provides some network-related patterns and functions.

PATTERNS

mac_address_pattern

This pattern matches a MAC address in canonical form (aa:bb:cc:dd:ee:ff).

ip_address_pattern

This pattern matches an IP address in canonical form (xyz.xyz.xyz.xyz).

alt_mac_address_pattern

This pattern matches a MAC address in alternative form (aabbccddeeff).

hex_ip_address_pattern

This pattern matches an IP address in hexadecimal form (aabbccdd).

FUNCTIONS

hex2canonical($address)

Convert an ip address from hexadecimal to canonical form.

alt2canonical($address)

Convert a mac address from alternative to canonical form.

getSubnetAddress($address, $mask)

Returns the subnet address for IPv4.

getSubnetAddressIPv6($address, $mask)

Returns the subnet address for IPv6.

getNetworkMask($prefix)

Returns the network mask for IPv4.

getNetworkMaskIPv6($prefix)

Returns the network mask for IPv6.

isSameNetwork($address1, $address2, $mask)

Returns true if both addresses belongs to the same network, for IPv4.

isSameNetworkIPv6($address1, $address2, $mask)

Returns true if both addresses belongs to the same network, for IPv6.

resolve($host, $logger)

Returns a list of addresses, as Net::IP objects, for the given host name, as a string.

compile($spec, $logger)

Returns a list of addresses, as Net::IP objects, for the given IP address or host name, as a string.

isPartOf($address, $addresses, $logger)

Returns true if the given address, as a string, is part of any address from the given list, as Net::IP objects.