snmpm_mpd(3)
π NAME π
snmpm_mpd β bestie, this is the Message Processing and Dispatch module for the SNMP manager π
(It's an Erlang module definition page, hence the (3) β iykyk β¨)
β¨ DESCRIPTION β¨
okay so, the module snmpm_mpd implements the version independent Message Processing and Dispatch functionality in SNMP for the manager. It is supposed to be used from a Network Interface process (Definition of Manager Net if). That's the whole vibe β it's the plug that sits between the network and the manager π«Ά
And for the ogs: the legacy API function process_msg/7, which has got separate IpAddr and PortNumber arguments, still works as before for backwards compatibility reasons. Not deprecated, not broken, just still chugging along. periodt π
π DATA TYPES π
logger()
logger() ::
fun((Data ::
binary() |
snmp_pdus:pdu() |
snmp_pdus:trappdu() |
snmp_pdus:message() |
{V3Hdr :: snmp_pdus:v3_hdr(),
ScopedPDUBytes :: binary()}) ->
snmp:void()).
A fun that handles audit trail logging. That's literally it β you hand it a fun, it gets fed the stuff, it returns snmp:void(). Gorgeous πΈ
-opaque mpd_state()β an opaque data structure, absolutely none of your business what's inside π-opaque msg_data_acm()β Is an opaque data structure containing necessary security information for (incoming) v3 messages. π-opaque msg_data_cmy()β Is an opaque data structure containing necessary security information for v1 and v2 messages. β¨-opaque msg_data_cmyt()β Is an opaque data structure containing necessary security and transport information for v1 and v2 messages. π¦-opaque msg_data_v3()β Is an opaque data structure containing necessary security information for v3 messages. π
bestie these are opaque β do not go poking around inside them, that's not the move π
π₯ FUNCTIONS π₯
generate_msg
generate_msg(Vsn, NoteStore, Pdu, MsgData, Log) ->
{ok, Packet} | {discarded, Reason}
when
Vsn :: snmp_pdus:version(),
NoteStore :: pid(),
Pdu :: snmp_pdus:pdu(),
MsgData :: msg_data_cmy() | msg_data_v3(),
Log :: logger(),
Packet :: binary(),
Reason :: term().
Generates a possibly encrypted packet to be sent to the network. ya girl is packing it up and shipping it out π¦β¨
NoteStoreis thepid()of the note-store process.MsgDatais the message specific data used in the SNMP message. In SNMPv1 and SNMPv2c, this message data is the community string. In SNMPv3, it is the context information. different eras, same energy πLoggeris the function used for audit trail logging.
generate_response_msg
generate_response_msg(Vsn, Pdu, MsgData, Log) ->
{ok, Packet} |
{discarded, Reason} |
{error, Reason}
when
Vsn :: snmp_pdus:version(),
Pdu :: snmp_pdus:pdu(),
MsgData ::
msg_data_cmy() |
msg_data_cmyt() |
msg_data_v3(),
Log :: logger(),
Packet :: binary(),
Reason :: term().
Generates a possibly encrypted response packet to be sent to the network. It's giving reply-girl energy fr fr π
MsgData is the message specific data used in the SNMP message. This value is received from the process_msg/6 function. like, you literally got handed it, bestie, just pass it through π«Ά
init
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, doing their thing, iconic β
process_msg
process_msg(Msg, Domain, Addr, State, NoteStore, Log) ->
{ok, Vsn, PduV2, PduMS, MsgDataV2} |
{ok, 'version-3', PduV3, PduMS, MsgDataV3} |
{discarded, Reason}
when
Msg :: binary(),
Domain :: snmpUDPDomain | snmp:tdomain(),
Addr :: {Ip, Port},
Ip :: inet:ip_address(),
Port :: inet:port_number(),
State :: mpd_state(),
NoteStore :: pid(),
Log :: logger(),
Vsn :: 'version-1' | 'version-2',
PduV2 :: snmp_pdus:pdu() | snmp_pdus:trappdu(),
PduV3 :: snmp_pdus:pdu(),
PduMS :: pos_integer(),
MsgDataV2 :: msg_data_cmyt(),
MsgDataV3 ::
ok |
{error, ReqId, ACM} |
undefined |
msg_data_acm(),
ReqId :: snmpm:request_id(),
ACM :: term(),
Reason :: term().
Processes an incoming message. Performs authentication and decryption as necessary. The return values should be passed the manager server. So like β it does the security check, then hands you the goods to walk over to the manager server. main character courier behavior π
NoteStoreis thepid()of the note-store process.Loggeris the function used for audit trail logging.
heads up bestie: in the case when the pdu type isreport,MsgDatais eitherokor{error, ReqId, Reason}. So check that before you assume anything π
and that's the whole page, no cap π this lil star was brought to you by Ericsson AB, living in the snmp 5.20.5 era, and it answers to the name snmpm_mpd(3). slay, stay safe, and always pass your return values to the manager server β¨ππ¦
π¦ 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