1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
7
<year>2004</year><year>2009</year>
8
<holder>Ericsson AB. All Rights Reserved.</holder>
11
The contents of this file are subject to the Erlang Public License,
12
Version 1.1, (the "License"); you may not use this file except in
13
compliance with the License. You should have received a copy of the
14
Erlang Public License along with this software. If not, it can be
15
retrieved online at http://www.erlang.org/.
17
Software distributed under the License is distributed on an "AS IS"
18
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
the License for the specific language governing rights and limitations
24
<title>Definition of Manager Net if</title>
26
<responsible></responsible>
32
<file>snmp_manager_netif.xml</file>
35
<image file="snmp_manager_netif_1">
36
<icaption>The Purpose of Manager Net if</icaption>
38
<p>The Network Interface (Net if) process delivers SNMP PDUs to the
39
manager server, and receives SNMP PDUs from the manager server.
40
The most common behaviour of a Net if process is that is receives
41
request PDU from the manager server, encodes the PDU into bytes
42
and transmits the bytes onto the network to an agent. When the
43
reply from the agent is received by the Net if process, which it
44
decodes into an SNMP PDU, which it sends to the manager server.
46
<p>However, that simple behaviour can be modified in numerous
47
ways. For example, the Net if process can apply some kind of
48
encrypting/decrypting scheme on the bytes.
50
<p>It is also possible to write your own Net if process. The default
51
Net if process is implemented in the module <c>snmpm_net_if</c> and
52
it uses UDP as the transport protocol.
54
<p>This section describes how to write a Net if process.
58
<marker id="mandatory_functions"></marker>
59
<title>Mandatory Functions</title>
60
<p>A Net if process must implement the SNMP manager
61
<seealso marker="snmpm_network_interface">network interface behaviour</seealso>.
66
<title>Messages</title>
67
<p>The section <em>Messages</em> describes mandatory messages, which
68
Net if must send to the manager server process.
70
<p>Net if must send the following message when it receives an
71
SNMP PDU from the network that is aimed for the MasterAgent:
74
Server ! {snmp_pdu, Pdu, Addr, Port}
76
<list type="bulleted">
78
<p><c>Pdu</c> is an SNMP PDU record, as defined in
79
<c>snmp_types.hrl</c>, with the SNMP request.</p>
82
<p><c>Addr</c> is the source address. </p>
85
<p><c>Port</c> is port number of the sender.</p>
89
Server ! {snmp_trap, Trap, Addr, Port}
91
<list type="bulleted">
93
<p><c>Trap</c> is either an SNMP pdu record or an trappdu record,
94
as defined in <c>snmp_types.hrl</c>, with the SNMP request.</p>
97
<p><c>Addr</c> is the source address. </p>
100
<p><c>Port</c> is port number of the sender.</p>
104
Server ! {snmp_inform, Ref, Pdu, PduMS, Addr, Port}
106
<list type="bulleted">
108
<p><c>Ref</c> is either the atom <c>ignore</c> or something
109
that can be used to identify the inform-request (e.g. request-id).
110
<c>ignore</c> is used if the response (acknowledgment) to the
111
inform-request has already been sent (this means that the server
112
will not make the call to the
113
<seealso marker="snmpm_network_interface#inform_response">inform_response</seealso>
115
<seealso marker="snmp_app">inform request behaviour</seealso>
116
configuration option for more info.</p>
119
<p><c>Pdu</c> is an SNMP PDU record, as defined in
120
<c>snmp_types.hrl</c>, with the SNMP request.</p>
123
<p><c>Addr</c> is the source address. </p>
126
<p><c>Port</c> is port number of the sender.</p>
130
Server ! {snmp_report, Data, Addr, Port}
132
<list type="bulleted">
134
<p><c>Data</c> is either <c>{ok, Pdu}</c> or
135
<c>{error, ReqId, ReasonInfo, Pdu}</c>. Which one is used depends
136
on the return value from the MPD
137
<seealso marker="snmpm_mpd#process_msg">process_msg</seealso> function. If the MsgData is <c>ok</c>,
138
the first is used, and if it is <c>{error, ReqId, Reason}</c>
139
the latter is used.</p>
142
<p><c>Pdu</c> is an SNMP PDU record, as defined in
143
<c>snmp_types.hrl</c>, with the SNMP request.</p>
146
<p><c>ReqId</c> is an integer.</p>
149
<p><c>ReasonInfo</c> is a term().</p>
152
<p><c>Addr</c> is the source address. </p>
155
<p><c>Port</c> is port number of the sender.</p>
161
<p>Since the Net if process is responsible for encoding and
162
decoding of SNMP messages, it must also update the relevant
163
counters in the SNMP group in MIB-II. It can use the functions
164
in the module <c>snmpm_mpd</c> for this purpose (refer to the
165
Reference Manual, section <c>snmp</c>, module <c>snmpm_mpd</c>
168
<p>There are also some useful functions for encoding and
169
decoding of SNMP messages in the module <c>snmp_pdus</c>.