snmpa_mpd(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– snmpa_mpd πŸ’–

okay bestie, welcome to the Erlang module definition for snmpa_mpd (that's the Message Processing and Dispatch module for the SNMP agent, and yes, the name is a mouthful, we move).

This page lives in the snmp manual, version 5.20.5, brought to you by the lovely people at Ericsson AB. More on that at the end 🫢


✨ NAME ✨

snmpa_mpd β€” the Message Processing and Dispatch module for the SNMP agent. she processes, she dispatches, she serves πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So the module snmpa_mpd implements the version independent Message Processing and Dispatch functionality in SNMP for the agent. It is supposed to be used from a Network Interface process (Definition of Agent Net if).

Like, it's the whole vibe of handling messages, but make it version-independent. no cap.

🌸 DATA TYPES 🌸

For more information, see the data types in snmpa_conf.


πŸŽ€ DATA TYPES πŸŽ€

Let's go through them one by one, bestie. No skipping, we don't do that here.

  • acm_data() :: acm_data_cmy() | acm_data_v3(). β€” This is the message specific data used in the SNMP message. This value is received in a send_pdu or send_pdu_req message from the agent (by the net-if process).
    • -opaque acm_data_cmy() β€” This is the message specific data used in the SNMPv1 and SNMPv2c message.
    • -opaque acm_data_v3() β€” This is the message specific data used in the SNMPv3 message.
  • logger() :: fun((Type :: snmp_pdus:pdu_type(), Data :: binary() | {V3Hdr :: snmp_pdus:v3_hdr(), ScopedPDUBytes :: binary()}) -> snmp:void()). β€” A fun that handles audit trail logging. she logs. she audits. she trails. πŸ‘‘
  • -opaque mpd_state() β€” the state, and it's giving mysterious on purpose, we don't peek inside.
  • msg_data() :: msg_data_cmy() | msg_data_ctx(). β€” This is the message specific data used in the SNMP message. This value is received in a send_pdu or send_pdu_req message from the agent (by the net-if process).
    • -opaque msg_data_cmy() β€” This is the message specific data used in the SNMP message. In SNMPv1 and SNMPv2c, this message data is the community string.
    • -opaque msg_data_ctx() β€” This is the message specific data used in the SNMP message. In SNMPv3, it is the context information.

πŸ”₯ FUNCTIONS πŸ”₯

buckle up, this is the main character section ✨

πŸ’œ discarded_pdu(Variable) -> snmp:void() when Variable :: snmpa:name() | false.

Increments the variable associated with a discarded pdu. This function can be used when the net_if process receives a discarded_pdu message from the agent.

rip to that pdu, but the counter goes up πŸ’€

πŸ’œ generate_msg(Vsn, NoteStore, Pdu, MsgData, LocalEngineID, To) -> {ok, PacketsAndAddresses} | {discarded, Reason}

when
    Vsn :: snmp_pdus:version(),
    NoteStore :: pid(),
    Pdu :: snmp_pdus:pdu(),
    MsgData :: msg_data(),
    LocalEngineID ::
        snmp_framework_mib:engine_id(),
    To :: [DestAddr],
    DestAddr ::
        {Domain, Address} |
        {{Domain, Address}, SecData},
    SecData :: term(),
    PacketsAndAddresses ::
        [{Domain, Address, Packet}],
    Domain :: snmpa_conf:transportDomain(),
    Address :: snmpa_conf:transportAddress(),
    Packet :: binary(),
    Reason :: term().

Generates a possibly encrypted request packet to be sent to the network.

MsgData is the message specific data used in the SNMP message. This value is received in a send_pdu or send_pdu_req message from the agent. In SNMPv1 and SNMPv2c, this message data is the community string. In SNMPv3, it is the context information.

To is a list of destination addresses and their corresponding security parameters. This value is received in the same message from the agent and then transformed through process_taddrs before passed to this function.

NOTE: Note that the use of the LocalEngineID argument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value of SnmpEngineID (see SNMP-FRAMEWORK-MIB).

πŸ’œ generate_response_msg(Vsn, RePdu, Type, ACMData, LocalEngineID, Log) -> {ok, Packet} | {discarded, Reason}

when
    Vsn :: snmp_pdus:version(),
    RePdu :: snmp_pdus:pdu(),
    Type :: snmp_pdus:pdu_type(),
    ACMData :: acm_data(),
    LocalEngineID ::
        snmp_framework_mib:engine_id(),
    Log :: logger(),
    Packet :: binary(),
    Reason :: term().

Generates a possibly encrypted response packet to be sent to the network. Type is the #pdu.type of the original request.

like yes, she responds, and she does it encrypted if that's the vibe πŸ”

NOTE: Note that the use of the LocalEngineID argument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value of SnmpEngineID (see SNMP-FRAMEWORK-MIB).

πŸ’œ init(Vsns) -> MPDState when Vsns :: [snmp:version()], MPDState :: mpd_state().

This function can be called from the net_if process at start-up. The options list defines which versions to use.

It also initializes some SNMP counters. little counters waking up for their first day of work 🐣

πŸ’œ process_packet(Packet, TDomain, TAddress, State, NoteStore, Log) -> {ok, Vsn, Pdu, PduMS, ACMData} | {discarded, Reason} | {discovery, DiscoPacket}

when
    Packet :: binary(),
    TDomain :: snmpa_conf:transportDomain(),
    TAddress :: {IpAddr, IpPort},
    IpAddr :: inet:ip_address(),
    IpPort :: inet:port_number(),
    State :: mpd_state(),
    NoteStore :: pid(),
    Log :: logger(),
    Vsn :: snmp_pdus:version(),
    Pdu :: snmp_pdus:pdu(),
    PduMS :: pos_integer(),
    ACMData :: acm_data(),
    Reason :: term(),
    DiscoPacket :: binary();

πŸ’œ process_packet(Packet, From, LocalEngineID, State, NoteStore, Log) -> {ok, Vsn, Pdu, PduMS, ACMData} | {discarded, Reason} | {discovery, DiscoPacket}

when
    Packet :: binary(),
    From :: {TDomain, TAddress},
    TDomain :: snmpa_conf:transportDomain(),
    TAddress :: {IpAddr, IpPort},
    IpAddr :: inet:ip_address(),
    IpPort :: inet:port_number(),
    LocalEngineID ::
        snmp_framework_mib:engine_id(),
    State :: mpd_state(),
    NoteStore :: pid(),
    Log :: logger(),
    Vsn :: snmp_pdus:version(),
    Pdu :: snmp_pdus:pdu(),
    PduMS :: pos_integer(),
    ACMData :: acm_data(),
    Reason :: term(),
    DiscoPacket :: binary().

Processes an incoming packet. Performs authentication and decryption as necessary. The return values should be passed to the agent.

(Yes bestie, there are two clauses up there β€” one with From, one with TDomain, TAddress, and the second one also takes a LocalEngineID. They're both listed up top, we don't do duplicates erasure around here πŸ’…)

NOTE: Note that the use of the LocalEngineID argument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value of SnmpEngineID (see SNMP-FRAMEWORK-MIB).

πŸ’œ process_taddrs(InDests) -> OutDests

when
    InDests :: [InDest],
    InDest ::
        {{InDomain, InAddress}, SecData} |
        {InDomain, InAddress},
    InDomain :: term(),
    InAddress :: term(),
    SecData :: term(),
    OutDests :: [OutDest],
    OutDest ::
        {{OutDomain, OutAddress}, SecData} |
        {OutDomain, OutAddress},
    OutDomain :: snmpa_conf:transportDomain(),
    OutAddress :: snmpa_conf:transportAddress().

Transforms addresses from internal MIB format to one more useful to Agent Net if.

See also generate_msg.


🌈 SEE ALSO 🌈

  • generate_msg

okay that's the whole page bestie, you ate that reading session πŸ’–βœ¨πŸŽ€

Ericsson AB β€” snmp 5.20.5 β€” snmpa_mpd(3) πŸŒΈπŸ¦‹ xoxo, go process some messages πŸ’…

πŸ“¦ where this page comes from