snmpa_mpd(3)
π 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 asend_pduorsend_pdu_reqmessage 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 asend_pduorsend_pdu_reqmessage 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 theLocalEngineIDargument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value ofSnmpEngineID(seeSNMP-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 theLocalEngineIDargument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value ofSnmpEngineID(seeSNMP-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 theLocalEngineIDargument is only intended for special cases, if the agent is to "emulate" multiple EngineIDs! By default, the agent uses the value ofSnmpEngineID(seeSNMP-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
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms