man snmpm_user () - Behaviour module for the SNMP manager user.
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/5
- *
- handle_trap/4
- *
- handle_inform/4
- *
- handle_report/4
The semantics of them and their exact signatures are explained below.
EXPORTS
handle_error(ReqId, Reason, UserData) -> Reply
- Types
- ReqId = integer()
Reason = {unexpected_pdu, SnmpInfo} | term()
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 asynchroneous 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.
handle_agent(Addr, Port, SnmpInfo, UserData) -> Reply
- Types
- Addr = ip_address()
Port = integer()
SnmpInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | {register, UserId, agent_info()}
UserId = term()
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 only user which would return {register, UserId, agent_info()} is the default user.
handle_pdu(Addr, Port, ReqId, SnmpResponse, UserData) -> Reply
- Types
- Addr = ip_address()
Port = integer()
ReqId = term()
SnmpResponse = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore
Handle the reply to an asynchroneous request, such as ag, agn or as.
It could also be a late reply to a synchroneous request.
ReqId is returned by the asynchroneous request function.
handle_trap(Addr, Port, SnmpTrapInfo, UserData) -> Reply
- Types
- Addr = ip_address()
Port = integer()
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, 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, agent_info()} is the default user.
handle_inform(Addr, Port, SnmpInfo, UserData) -> Reply
- Types
- Addr = ip_address()
Port = integer()
SnmpInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | unregister | {register, UserId, 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, agent_info()} is the default user.
handle_report(Addr, Port, SnmpInfo, UserData) -> Reply
- Types
- Addr = ip_address()
Port = integer()
SnmpInfo = {ErrorStatus, ErrorIndex, Varbinds}
ErrorStatus = atom()
ErrorIndex = integer()
Varbinds = [varbind()]
varbind() = #varbind
UserData = term()
Reply = ignore | unregister | {register, UserId, 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, agent_info()} is the default user.
AUTHOR
Micael Karlberg - support@erlang.ericsson.se