encode_int_0()-encodetheinteger0.
This is functionally identical to encode_int(0).
encode_int()-encodeanintegerusingthegeneric"integer"typetag.encode_uinteger32()-encodeanintegerusingtheSNMPUInteger32tag.encode_counter32()-encodeanintegerusingtheSNMPCounter32tag.encode_counter64()-encodeanintegerusingtheSNMPCounter64tag.encode_gauge32()-encodeanintegerusingtheSNMPGauge32tag.encode_oid()-encodeanobjectID,passedasalistofsub-IDs.
$encoded = encode_oid (1,3,6,1,...);
encode_null()-encodeanullobject.
This is used e.g. in binding lists for variables that don't have a value (yet)
encode_sequence()encode_tagged_sequence()
$encoded = encode_sequence (encoded1, encoded2, ...);
$encoded = encode_tagged_sequence (tag, encoded1, encoded2, ...);
Take already encoded values, and extend them to an encoded sequence. "encoded_sequence" uses the generic
sequence tag, while with "encode_tagged_sequence" you can specify your own tag.
encode_string()-encodeaPerlstringasanOCTETSTRING.encode_ip_address()-encodeanIPv4address.
This can either be passed as a four-octet sequence in networkbyteorder, or as a text string in dotted-
quad notation, e.g. "192.0.2.234".
encode_timeticks()-encodeanintegerasa"TimeTicks"object.
The integer should count hundredths of a second since the epoch defined by "sysUpTime.0".
pretty_print()-convertanencodedbytesequenceintohuman-readableform.
This function can be extended by registering pretty-printing methods for specific type codes. Most BER
type codes used in SNMP already have such methods pre-registered by default. See
"register_pretty_printer" for how new methods can be added.
hex_string()-convertOCTETSTRINGtohexadecimalnotation.hex_string_of_type()-convertoctetstringtohex,andchecktypeagainstgiventag.decode_by_template()-decodecomplexobjectaccordingtoatemplate.
($var1, ...) = decode_by_template ($pdu, $template, ...);
The template can contain various %X directives. Some directives consume additional arguments following
the template itself. Most directives will cause values to be returned. The values are returned as a
sequence in the order of the directives that generated them.
%{ - decode sequence.
This doesn't assign any return value, just checks and skips the tag/length fields of the sequence.
By default, the tag should be the generic sequence tag, but a tag can also be specified in the
directive. The directive can either specify the tag as a prefix, e.g. "%99{" will require a sequence
tag of 99, or if the directive is given as "%*{", the tag will be taken from the next argument.
%s - decode string
%i - decode integer
%u - decode unsigned integer
%O - decode Object ID (OID)
%A - decode IPv4 address
%@ - assigns the remaining undecoded part of the PDU to the next return value.
decode_sequence()-Splitsequenceintocomponents.
($first, $rest) = decode_sequence ($pdu);
Checks whether the PDU has a sequence type tag and a plausible length field. Splits the initial element
off the list, and returns both this and the remainder of the PDU.
register_pretty_printer()-registerpretty-printingmethodsfortypecodes.
This function takes a hashref that specifies functions to call when the specified value type is being
printed. It returns the number of functions that were registered.