table of contents
other versions
- wheezy 1:15.b.1-dfsg-4+deb7u1
- wheezy-backports 1:17.3-dfsg-4~bpo70+1
- jessie 1:17.3-dfsg-4+deb8u1
- jessie-backports 1:19.2.1+dfsg-2~bpo8+1
- testing 1:19.2.1+dfsg-2
- unstable 1:19.2.1+dfsg-2
- experimental 1:19.3.1+dfsg-1
snmpm_user(3erl) | Erlang Module Definition | snmpm_user(3erl) |
NAME¶
snmpm_user - Behaviour module for the SNMP manager user.DESCRIPTION¶
This module defines the behaviour of the manager user. A snmpm_user compliant module must export the following functions:- *
- handle_error/3
- *
- handle_agent/4
- *
- handle_pdu/4
- *
- handle_trap/3
- *
- handle_inform/3
- *
- handle_report/3
EXPORTS¶
handle_error(ReqId, Reason, UserData) -> Reply
Types:
ReqId = integer()
Reason = {unexpected_pdu, SnmpInfo} | {invalid_sec_info, SecInfo, SnmpInfo} |
{empty_message, Addr, Port} | term()
Addr = ip_address()
Port = integer()
UserData = term()
Reply = ignore
This function is called when the manager needs to communicate an
"asynchronous" error, to the user: e.g. failure to send an
asynchronous message (i.e. encoding error), a received message was discarded
due to security error, the manager failed to generate a response message to a
received inform-request, or when receiving an unexpected PDU from an agent
(could be an expired async request).
If ReqId is less then 0, it means that this information was not available
to the manager (that info was never retrieved before the message was
discarded).
For SnmpInfo see handle_agent below.
Types:
Addr = ip_address()
Port = integer()
Type = pdu | trap | report | inform
SnmpInfo = SnmpPduInfo | SnmpTrapInfo | SnmpReportInfo | SnmpInformInfo
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | {register, UserId, TargetName, agent_info()}
UserId = term()
TargetName = target_name()
agent_info() = [{agent_info_item(), agent_info_value()}]
This function is called when a message is received from an unknown agent.
Note that this will always be the default user that is called.
For more info about the agent_info(), see register_agent.
The arguments Type and SnmpInfo relates in the following way:
The only user which would return {register, UserId, TargetName,
agent_info()} is the default user.
- *
- pdu - SnmpPduInfo (see handle_pdu for more info).
- *
- trap - SnmpTrapInfo (see handle_trap for more info).
- *
- report - SnmpReportInfo (see handle_report for more info).
- *
- inform - SnmpInformInfo (see handle_inform for more info).
Types:
TargetName = target_name()
ReqId = term()
SnmpPduInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore
Handle the reply to an asynchronous request, such as async_get,
async_get_next or async_set.
It could also be a late reply to a synchronous request.
ReqId is returned by the asynchronous request function.
Types:
TargetName = TargetName2 = target_name()
SnmpTrapInfo = {Enteprise, Generic, Spec, Timestamp, Varbinds} | {ErrorStatus,
ErrorIndex, Varbinds}
Enterprise = oid()
Generic = integer()
Spec = integer()
Timestamp = integer()
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | unregister | {register, UserId, TargetName2, agent_info()}
UserId = term()
agent_info() = [{agent_info_item(), agent_info_value()}]
Handle a trap/notification message from an agent.
For more info about the agent_info(), see register_agent
The only user which would return {register, UserId, TargetName2,
agent_info()} is the default user.
Types:
TargetName = TargetName2 = target_name()
SnmpInformInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | unregister | {register, UserId, TargetName2, agent_info()}
UserId = term()
agent_info() = [{agent_info_item(), agent_info_value()}]
Handle a inform message.
For more info about the agent_info(), see register_agent
The only user which would return {register, UserId, TargetName2,
agent_info()} is the default user.
If the inform request behaviour configuration option is set to
user or {user, integer()}, the response (acknowledgment) to this
inform-request will be sent when this function returns.
Types:
TargetName = TargetName2 = target_name()
Addr = ip_address()
Port = integer()
SnmpReportInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | unregister | {register, UserId, TargetName2, agent_info()}
UserId = term()
agent_info() = [{agent_info_item(), agent_info_value()}]
Handle a report message.
For more info about the agent_info(), see register_agent
The only user which would return {register, UserId, TargetName2,
agent_info()} is the default user.
snmp 4.22 | Ericsson AB |