snmpm_mpd(3)

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

πŸŽ€ 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 πŸ“¦βœ¨

  • NoteStore is the pid() of the note-store process.
  • MsgData is 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 πŸ’…
  • Logger is 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 πŸ‘‘

  • NoteStore is the pid() of the note-store process.
  • Logger is the function used for audit trail logging.
heads up bestie: in the case when the pdu type is report, MsgData is either ok or {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