NAME
DOCSIS::ConfigFile::Encode - Encode functions for a DOCSIS config-file.
VERSION
See DOCSIS::ConfigFile
FUNCTIONS
Every function can return either a list or an array-ref.
snmp_object(\%h)
Takes a hash-ref (keys: oid, type, value), and returns a byte-encoded snmp- object.
#-type---length---------value-----type---
0x30, $total_length, # object
0x06, int(@oid), @oid, # oid
$type, int(@value), @value, # value
bigint(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value could be any number.
uint(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value has to be an unsigned int.
ushort(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value has to be an unsigned short int.
uchar(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value has to be an unsigned char.
vendorspec(\%h)
Takes a hash-ref, and byte-encodes it.
Example of the hash-ref:
{
value => "0x001337", # vendors ID
nested => {
type => "24", # vendor specific type
value => "42", # vendor specific value
},
}
ip(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value need to an IPv4 address.
ether(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value need to be a six or twelve byte ethernet address.
string(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The string could be anything in theory, but is often human-readable or a hex-string (leading 0x)
hexstr(\%h)
Takes a hash-ref, and byte-encodes $h->{'value'}
. The value can have leading '0x'.
mic
Cannot encode CM/CMTS mic without complete information about the config file, so this function returns an empty list.