Method Protocols.SNMP.agent()->set_set_oid_callback()


Method set_set_oid_callback

void set_set_oid_callback(string oid, function(:void) cb)

Description

set the Set request callback function for an Object Identifier

Parameter oid

the string object identifier, such as 1.3.6.1.4.1.132.2 or an asterisk (*) to serve as the handler for all requests for which a handler is specified.

Parameter cb

the function to call when oid is requested by a manager the function should take 3 arguments: a string containing the requested oid, the desired value, and the body of the request as a mapping. The function should return an array containing 3 elements: The first is a boolean indicating success or failure. If success, the next 2 elements should be the SNMP data type of the result followed by the result itself. If failure, the next 2 elements should be the error-status such as Protocols.SNMP.ERROR_TOOBIG and the second is the error-index, if any.

Note

there can be only one callback per object identifier. calling this function more than once with the same oid will result in the new callback replacing the existing one.