aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/doc/src/snmp_manager_netif.xml
blob: 169e20d10b13fc3231e96db1f81dbb9cdb0f7813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>2004</year><year>2012</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>Definition of Manager Net if</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmp_manager_netif.xml</file>
  </header>
  <p></p>
  <image file="snmp_manager_netif_1.gif">
    <icaption>The Purpose of Manager Net if</icaption>
  </image>

  <p>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. </p>

  <p>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. </p>

  <p>The snmp application provides two different modules, 
  <c>snmpm_net_if</c> (the default) and <c>snmpm_net_if_mt</c>, 
  both uses the UDP as the transport protocol. 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 
  process the message/request and then exits. </p>

  <p>It is also possible to write your own Net if process, 
  this section describes how to write a Net if processdo that.</p>

  <section>
    <marker id="mandatory_functions"></marker>
    <title>Mandatory Functions</title>
    <p>A Net if process must implement the SNMP manager 
    <seealso marker="snmpm_network_interface">network interface behaviour</seealso>. </p>
  </section>

  <section>
    <title>Messages</title>
    <p>The section <em>Messages</em> describes mandatory messages, which
      Net if must send to the manager server process.     
      </p>
    <p>Net if must send the following message when it receives an
      SNMP PDU from the network that is aimed for the MasterAgent:
      </p>
    <pre>
Server ! {snmp_pdu, Pdu, Addr, Port}
    </pre>
    <list type="bulleted">
      <item>
        <p><c>Pdu</c> is an SNMP PDU record, as defined in
          <c>snmp_types.hrl</c>, with the SNMP request.</p>
      </item>
      <item>
        <p><c>Addr</c> is the source address. </p>
      </item>
      <item>
        <p><c>Port</c> is port number of the sender.</p>
      </item>
    </list>
    <pre>
Server ! {snmp_trap, Trap, Addr, Port}
    </pre>
    <list type="bulleted">
      <item>
        <p><c>Trap</c> is either an SNMP pdu record or an trappdu record, 
          as defined in <c>snmp_types.hrl</c>, with the SNMP request.</p>
      </item>
      <item>
        <p><c>Addr</c> is the source address. </p>
      </item>
      <item>
        <p><c>Port</c> is port number of the sender.</p>
      </item>
    </list>
    <pre>
Server ! {snmp_inform, Ref, Pdu, PduMS, Addr, Port}
    </pre>
    <list type="bulleted">
      <item>
        <p><c>Ref</c> is either the atom <c>ignore</c> or something
          that can be used to identify the inform-request (e.g. request-id).
          <c>ignore</c> is used if the response (acknowledgment) to the
          inform-request has already been sent (this means that the server 
          will not make the call to the 
          <seealso marker="snmpm_network_interface#inform_response">inform_response</seealso> 
          function). See the 
          <seealso marker="snmp_app">inform request behaviour</seealso> 
          configuration option for more info.</p>
      </item>
      <item>
        <p><c>Pdu</c> is an SNMP PDU record, as defined in
          <c>snmp_types.hrl</c>, with the SNMP request.</p>
      </item>
      <item>
        <p><c>Addr</c> is the source address. </p>
      </item>
      <item>
        <p><c>Port</c> is port number of the sender.</p>
      </item>
    </list>
    <pre>
Server ! {snmp_report, Data, Addr, Port}
    </pre>
    <list type="bulleted">
      <item>
        <p><c>Data</c> is either <c>{ok, Pdu}</c> or 
          <c>{error, ReqId, ReasonInfo, Pdu}</c>. Which one is used depends 
          on the return value from the MPD 
          <seealso marker="snmpm_mpd#process_msg">process_msg</seealso> function. If the MsgData is <c>ok</c>, 
          the first is used, and if it is <c>{error, ReqId, Reason}</c>
          the latter is used.</p>
      </item>
      <item>
        <p><c>Pdu</c> is an SNMP PDU record, as defined in
          <c>snmp_types.hrl</c>, with the SNMP request.</p>
      </item>
      <item>
        <p><c>ReqId</c> is an integer.</p>
      </item>
      <item>
        <p><c>ReasonInfo</c> is a term().</p>
      </item>
      <item>
        <p><c>Addr</c> is the source address. </p>
      </item>
      <item>
        <p><c>Port</c> is port number of the sender.</p>
      </item>
    </list>

    <section>
      <title>Notes</title>
      <p>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 <c>snmpm_mpd</c> for this purpose (refer to the 
        Reference Manual, section <c>snmp</c>, module <c>snmpm_mpd</c>
        for more details).
        </p>
      <p>There are also some useful functions for encoding and
        decoding of SNMP messages in the module <c>snmp_pdus</c>.
        </p>
    </section>
  </section>
</chapter>