DOCSIS::ConfigFile::Decode - Decode functions for a DOCSIS config-file
{ oid => $str, type => $str, value = $str, } = snmp_object($binary_str); $bigint_object = bigint($binary_str); $int = int($binary_str); $uint = uint($binary_str); $ushort = ushort($binary_str); $uchar = uchar($binary_str); ( '0x001337' => [ { type => 24, # vendor specific type value => 42, # vendor specific value length => 1, # the length of the value meassured in bytes }, ... ], ) = vendorspec($binary_str); $ip_str = ip($binary_str); $hex_str = ether($binary_str); $uint = ether($binary_str); $str = string($binary_str); $hex_str = string($binary_str); $hex_str = hexstr($binary_str); $hex_str = mic($binary_str);
This module has functions which is used to decode binary data into either plain strings or complex data structures, dependent on the function called.
Will take a binary string and decode it into a complex datastructure, with "oid", "type" and "value".
$bigint_obj = bigint($bytestring);
Returns a Math::BigInt object.
Math::BigInt
Will unpack the input string and return an integer, from -2147483648 to 2147483647.
Will unpack the input string and return an integer, from 0 to 4294967295.
Will unpack the input string and return a short integer, from 0 to 65535.
Will unpack the input string and return a short integer, from 0 to 255.
Will unpack the input string and return a complex datastructure, representing the vendor specific data.
Will unpack the input string and return a human readable IPv4 address.
Will unpack the input string and return a MAC address in this format: "00112233" or "00112233445566".
Returns human-readable string, where special characters are "uri encoded". Example: "%" = "%25" and " " = "%20". It can also return the value from "hexstr" if it starts with a weird character, such as \x00.
\x00
Same as string above. However this string is zero-terminated in encoded form, but this function remove the last "\0" seen in the string.
Will unpack the input string and a string with leading "0x", followed by hexidesimal characters.
Returns a value, printed as hex.
This method will return an empty string. It is used by DOCSIS types, which has zero length.
See DOCSIS::ConfigFile
To install DOCSIS::ConfigFile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DOCSIS::ConfigFile
CPAN shell
perl -MCPAN -e shell install DOCSIS::ConfigFile
For more information on module installation, please visit the detailed CPAN module installation guide.