File: snmp_agent_netif.html

package info (click to toggle)
erlang-doc-html 1%3A11.b.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 23,284 kB
  • ctags: 10,724
  • sloc: erlang: 505; ansic: 323; makefile: 62; perl: 61; sh: 45
file content (460 lines) | stat: -rw-r--r-- 10,369 bytes parent folder | download
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>Definition of Agent Net if</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<CENTER>
<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif"></A>
</CENTER>
<A NAME="12"><!-- Empty --></A>
<H2>12 Definition of Agent Net if</H2>

<P> 
<P>
<CENTER>
<IMG ALT="snmp_agent_netif_1" SRC="snmp_agent_netif_1.gif"><BR>
<EM>The Purpose of Agent Net if</EM>

</CENTER>

<P>The Network Interface (Net if) process delivers SNMP PDUs to a
master agent, and receives SNMP PDUs from the master agent. The most
common behaviour of a Net if process is that is receives bytes from
a network, decodes them into an SNMP PDU, which it sends to a master
agent. When the master agent has processed the PDU, it sends a
response PDU to the Net if process, which encodes the PDU into bytes
and transmits the bytes onto the network.


<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 or
act as a proxy filter, which sends some packets to a proxy agent and
some packets to the master agent.


<P>It is also possible to write your own Net if process. The default
Net if process is implemented in the module <CODE>snmpa_net_if</CODE> and
it uses UDP as the transport protocol.


<P>This section describes how to write a Net if process.

<A NAME="mandatory_functions"><!-- Empty --></A><A NAME="12.1"><!-- Empty --></A>
<H3>12.1 Mandatory Functions</H3>

<P>A Net if process must implement the SNMP agent 
<A HREF="snmpa_network_interface.html">network interface behaviour</A>.

<A NAME="12.2"><!-- Empty --></A>
<H3>12.2 Messages</H3>

<P>The section <STRONG>Messages</STRONG> describes mandatory messages, which
Net if must send and be able to receive. 

<A NAME="12.2.1"><!-- Empty --></A>
<H4>12.2.1 Outgoing Messages</H4>

<P>Net if must send the following message when it receives an
        SNMP PDU from the network that is aimed for the MasterAgent:


<PRE>
MasterAgent ! {snmp_pdu, Vsn, Pdu, PduMS, ACMData, From, Extra}
      
</PRE>

<P>
<UL>

<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>,
         <CODE>'version-2'</CODE>, or <CODE>'version-3'</CODE>.
         
        
</LI>


<LI>
<CODE>Pdu</CODE> is an SNMP PDU record, as defined in
         <CODE>snmp_types.hrl</CODE>, with the SNMP request.
         
        
</LI>


<LI>
<CODE>PduMS</CODE> is the Maximum Size of the response Pdu
         allowed. Normally this is returned from
         <CODE>snmpa_mpd:process_packet</CODE> (see Reference Manual).

        
</LI>


<LI>
<CODE>ACMData</CODE> is data used by the Access Control Module
         in use. Normally this is returned from
         <CODE>snmpa_mpd:process_packet</CODE> (see Reference Manual).

        
</LI>


<LI>
<CODE>From</CODE> is the source address. If UDP over IP is
         used, this should be a 2-tuple <CODE>{IP, UDPport}</CODE>, where
         <CODE>IP</CODE> is a 4-tuple with the IP address, and <CODE>UDPport</CODE>
         is an integer.
         
        
</LI>


<LI>
<CODE>Extra</CODE> is any term the Net if process wishes to
         send to the agent. This term can be retrieved by the
         instrumentation functions by calling
         <CODE>snmp:current_net_if_data()</CODE>. This data is also sent back
         to the Net if process when the agent generates a response to
         the request.

</LI>


</UL>

<P>The following message is used to report that a response to a
        request has been received. The only request an agent can send
        is an Inform-Request.


<PRE>
Pid ! {snmp_response_received, Vsn, Pdu, From}
      
</PRE>

<P>
<UL>

<LI>
<CODE>Pid</CODE> is the Process that waits for the response
         for the request. The Pid was specified in the
         <CODE>send_pdu_req</CODE> message <A HREF="#message">(see below)</A>.

        
</LI>


<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>, <CODE>'version-2'</CODE>, or
         <CODE>'version-3'</CODE>.
         
        
</LI>


<LI>
<CODE>Pdu</CODE> is the SNMP Pdu received

        
</LI>


<LI>
<CODE>From</CODE> is the source address. If UDP over IP is
         used, this should be a 2-tuple <CODE>{IP, UDPport}</CODE>, where
         <CODE>IP</CODE> is a 4-tuple with the IP address, and <CODE>UDPport</CODE>
         is an integer.


</LI>


</UL>
<A NAME="12.2.2"><!-- Empty --></A>
<H4>12.2.2 Incoming Messages</H4>

<P>This section describes the incoming messages which a Net if
        process must be able to receive.


<P>
<UL>

<LI>
<CODE>{snmp_response, Vsn, Pdu, Type, ACMData, To, Extra}</CODE>

         This message is sent to the Net if process from a master
         agent as a response to a previously received request.
         
         <BR>

<UL>

<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>,
         <CODE>'version-2'</CODE>, or <CODE>'version-3'</CODE>.

         
</LI>


<LI>
<CODE>Pdu</CODE> is an SNMP PDU record (as defined in
         snmp_types.hrl) with the SNMP response.
         
         
</LI>


<LI>
<CODE>Type</CODE> is the <CODE>#pdu.type</CODE> of the original
         request.
         
         
</LI>


<LI>
<CODE>ACMData</CODE> is data used by the Access Control
         Module in use. Normally this is just sent to
         <CODE>snmpa_mpd:generate_response_message</CODE> (see Reference Manual).
         
         
</LI>


<LI>
<CODE>To</CODE> is the destination address. If UDP over IP
         is used, this should be a 2-tuple <CODE>{IP, UDPport}</CODE>,
         where <CODE>IP</CODE> is a 4-tuple with the IP address, and
         <CODE>UDPport</CODE> is an integer.
         
         
</LI>


<LI>
<CODE>Extra</CODE> is the term that the Net if process
         sent to the agent when the request was sent to the agent.

         
</LI>


</UL>

         
        
</LI>


<LI>
<CODE>{discarded_pdu, Vsn, ReqId, ACMData, Variable,
         Extra}</CODE>

         This message is sent from a master agent if it for some
         reason decided to discard the pdu.

         <BR>

<UL>

<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>,
         <CODE>'version-2'</CODE>, or <CODE>'version-3'</CODE>.

         
</LI>


<LI>
<CODE>ReqId</CODE> is the request id of the original
         request.

         
</LI>


<LI>
<CODE>ACMData</CODE> is data used by the Access Control
         Module in use. Normally this is just sent to
         <CODE>snmpa_mpd:generate_response_message</CODE> (see Reference Manual).
         
         
</LI>


<LI>
<CODE>Variable</CODE> is the name of an snmp counter that
         represents the error, e.g. <CODE>snmpInBadCommunityUses</CODE>.

         
</LI>


<LI>
<CODE>Extra</CODE> is the term that the Net if process
         sent to the agent when the request was sent to the agent.

         
</LI>


</UL>


        
</LI>


<LI>
<CODE>{send_pdu, Vsn, Pdu, MsgData, To}</CODE>
         
         This message is sent from a master agent when a trap is
         to be sent.
         
         <BR>

<UL>

<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>,
         <CODE>'version-2'</CODE>, or <CODE>'version-3'</CODE>.

         
</LI>


<LI>
<CODE>Pdu</CODE> is an SNMP PDU record (as defined in
         snmp_types.hrl) with the SNMP response.
         
         
</LI>


<LI>
<CODE>MsgData</CODE> is the message specific data used in
         the SNMP message. This value is normally sent to
         <CODE>snmpa_mpd:generate_message/4</CODE>. In SNMPv1 and
         SNMPv2c, this message data is the community string. In
         SNMPv3, it is the context information.
         
         
</LI>


<LI>
<CODE>To</CODE> is a list of the destination addresses and
         their corresponding security parameters. This value is
         normally sent to <CODE>snmpa_mpd:generate_message/4</CODE>. 

         
</LI>


</UL>

         
        
</LI>


<LI>
<CODE>{send_pdu_req, Vsn, Pdu, MsgData, To, Pid}</CODE>
         
         This<A NAME="message"><!-- Empty --></A> message is sent from a master 
         agent when a request is
         to be sent. The only request an agent can send is
         Inform-Request. The net if process needs to remember the
         request id and the Pid, and when a response is received for
         the request id, send it to Pid, using a
         <CODE>snmp_response_received</CODE> message.
         
         <BR>

<UL>

<LI>
<CODE>Vsn</CODE> is either <CODE>'version-1'</CODE>,
         <CODE>'version-2'</CODE>, or <CODE>'version-3'</CODE>.

         
</LI>


<LI>
<CODE>Pdu</CODE> is an SNMP PDU record (as defined in
         snmp_types.hrl) with the SNMP response.
         
         
</LI>


<LI>
<CODE>MsgData</CODE> is the message specific data used in
         the SNMP message. This value is normally sent to
         <CODE>snmpa_mpd:generate_message/4</CODE>. In SNMPv1 and
         SNMPv2c, this message data is the community string. In
         SNMPv3, it is the context information.
         
         
</LI>


<LI>
<CODE>To</CODE> is a list of the destination addresses and
         their corresponding security parameters. This value is
         normally sent to <CODE>snmpa_mpd:generate_message/4</CODE>. 
         
         
</LI>


<LI>
<CODE>Pid</CODE> is a process identifier.

         
</LI>


</UL>

         

</LI>


</UL>
<A NAME="12.2.3"><!-- Empty --></A>
<H4>12.2.3 Notes</H4>

<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 <CODE>snmpa_mpd</CODE> for this purpose (refer to the 
        Reference Manual, section <CODE>snmp</CODE>, 
        module <A HREF="snmp_pdus.html">snmpa_mpd</A>
        for more details.)
        

<P>There are also some useful functions for encoding and
        decoding of SNMP messages in the module 
        <A HREF="snmp_pdus.html">snmp_pdus</A>.

<CENTER>
<HR>
<SMALL>
Copyright &copy; 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>