<<

NAME

pf::MAC

DESCRIPTION pf::MAC implements a class that instantiates MAC addresses objects.

At the moment it is rather minimalist, inheriting from Net::MAC which already does 90% of what PacketFence needs.

The purpose of this class is to allow us to extend it or later rewrite it without worrying about Net::MAC's implementation.

Since passing the Net::MAC object to a function actually passes the string version of the constructors initial argument, it should be safe to keps calling things like `mac2oid($mac)'.

The get_* methods return a string or integer.

The as_* methods return a new pf::MAC object with the given notation as constructor.

clean

Cleans a MAC address.

Returns an untainted pf::MAC with MAC in format: xx:xx:xx:xx:xx:xx (lowercased).

get_stripped

Returns the MAC address stripped of any delimiter (base is preserved).

get_hex_stripped

Returns a string containing the MAC address in hex base, stripped of any delimiter (uppercased).

get_dec_stripped

Returns a string with the MAC as a decimal without delimiter.

get_oui

Returns the OUI for the MAC as an lowercased hex string with : delimiters.

This is the format PF uses.

get_IEEE_oui

Returns the OUI for the MAC as an uppercased hex string with - delimiters.

This is the format the IEEE uses.

get_dec_oui

Returns a decimal value of the OUI stripped of any delimiters.

as_oid

Returns a pf::MAC object with the MAC formatted as an SNMP OID.

example: '00-12-f0-13-32-ba' -> '0.18.240.19.50.186'

as_acct

Returns an uppercased, hex based and : delimited pf::MAC object (formatted for PacketFence acounting).

as_Cisco

Returns a new pf::MAC object formatted for Cisco ( example: 0002.03aa.abff ).

Documented here for consistency with the other methods implementing functions from pf::util.

See Net::MAC for implementation.

macoui2nb

Provided for backwards compatibility with pf::util::macoui2nb.

Equivalent to get_dec_oui().

mac2nb

Provided for backwards compatibility with pf::util::mac2nb.

Equivalent to get_dec_stripped().

format_for_acct

Intended for backward compatibility with pf::util::format_mac_for_acct.

Equivalent to as_acct();

in_OUI

Checks whether a MAC is part of an OUI. It expects the OUI to be passed as a string of hexadecimal digits, with or without separators. Returns 0 or 1.

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<<