snmpm_user(3)

MODULE
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 = term()
        UserData = term()
        Reply = ignore

    This function is called when the manager failes to sent a asynchroneous message. I.e. encoding error.

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