pf::MAC
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.
Cleans a MAC address.
Returns an untainted pf::MAC with MAC in format: xx:xx:xx:xx:xx:xx (lowercased).
Returns the MAC address stripped of any delimiter (base is preserved).
Returns a string containing the MAC address in hex base, stripped of any delimiter (uppercased).
Returns a string with the MAC as a decimal without delimiter.
Returns the OUI for the MAC as an lowercased hex string with : delimiters.
This is the format PF uses.
Returns the OUI for the MAC as an uppercased hex string with - delimiters.
This is the format the IEEE uses.
Returns a decimal value of the OUI stripped of any delimiters.
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'
Returns an uppercased, hex based and : delimited pf::MAC object (formatted for PacketFence acounting).
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.
Provided for backwards compatibility with pf::util::macoui2nb.
Equivalent to get_dec_oui().
Provided for backwards compatibility with pf::util::mac2nb.
Equivalent to get_dec_stripped().
Intended for backward compatibility with pf::util::format_mac_for_acct.
Equivalent to as_acct();
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.
Inverse inc. <info@inverse.ca>
Copyright (C) 2005-2015 Inverse inc.
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.