13 Definition of Manager Net if
Figure 13.1: The Purpose of Manager Net if
The Network Interface (Net if) process delivers SNMP PDUs to the manager server, and receives SNMP PDUs from the manager server. The most common behaviour of a Net if process is that is receives request PDU from the manager server, encodes the PDU into bytes and transmits the bytes onto the network to an agent. When the reply from the agent is received by the Net if process, which it decodes into an SNMP PDU, which it sends to the manager server.
However, that simple behaviour can be modified in numerous ways. For example, the Net if process can apply some kind of encrypting/decrypting scheme on the bytes.
The snmp application provides two different modules, snmpm_net_if (the default) and snmpm_net_if_mt, both uses UDP as the transport protocol i.e the transport domains transportDomainUdpIpv4 and/or transportDomainUdpIpv6. The difference between the two modules is that the latter is "multi-threaded", i.e. for each message/request a new process is created that processes the message/request and then exits.
It is also possible to write your own Net if process and this section describes how to do that.
13.1 Mandatory Functions
A Net if process must implement the SNMP manager network interface behaviour.
13.2 Messages
The section Messages describes mandatory messages, which Net if must send to the manager server process.
In this section a Domain field is the transport domain i.e one of transportDomainUdpIpv4 or transportDomainUdpIpv6, and an Addr field is an {IpAddr,IpPort} tuple.
Net if must send the following message when it receives an SNMP PDU from the network that is aimed for the MasterAgent:
Server ! {snmp_pdu, Pdu, Domain, Addr}
-
Pduis an SNMP PDU record, as defined insnmp_types.hrl, with the SNMP request. -
Domainis the source transport domain. -
Addris the source address.
Server ! {snmp_trap, Trap, Domain, Addr}
-
Trapis either an SNMP pdu record or an trappdu record, as defined insnmp_types.hrl, with the SNMP request. -
Domainis the source transport domain. -
Addris the source address.
Server ! {snmp_inform, Ref, Pdu, PduMS, Domain, Addr}
-
Refis either the atomignoreor something that can be used to identify the inform-request (e.g. request-id).ignoreis used if the response (acknowledgment) to the inform-request has already been sent (this means that the server will not make the call to theinform_responsefunction). See theinform request behaviourconfiguration option for more info. -
Pduis an SNMP PDU record, as defined insnmp_types.hrl, with the SNMP request. -
Domainis the source transport domain. -
Addris the source address.
Server ! {snmp_report, Data, Domain, Addr}
-
Datais either{ok, Pdu}or{error, ReqId, ReasonInfo, Pdu}. Which one is used depends on the return value from the MPDprocess_msgfunction. If the MsgData isok, the first is used, and if it is{error, ReqId, Reason}the latter is used. -
Pduis an SNMP PDU record, as defined insnmp_types.hrl, with the SNMP request. -
ReqIdis an integer. -
ReasonInfois a term(). -
Domainis the source transport domain. -
Addris the source address.
Notes
Since the Net if process is responsible for encoding and decoding of SNMP messages, it must also update the relevant counters in the SNMP group in MIB-II. It can use the functions in the module snmpm_mpd for this purpose (refer to the Reference Manual, section snmp, module snmpm_mpd for more details).
There are also some useful functions for encoding and decoding of SNMP messages in the module snmp_pdus.
© 2010–2017 Ericsson AB
Licensed under the Apache License, Version 2.0.