File: snmp_pdus.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 (296 lines) | stat: -rw-r--r-- 7,518 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>snmp_pdus</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
  <STYLE TYPE="text/css">
<!--
    .REFBODY     { margin-left: 13mm }
    .REFTYPES    { margin-left: 8mm }
-->
  </STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
  <IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>snmp_pdus</H1>
</CENTER>

<H3>MODULE</H3>
<DIV CLASS=REFBODY>
snmp_pdus
</DIV>

<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
Encode and Decode Functions for SNMP PDUs
</DIV>

<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>

<P>RFC1157, RFC1905 and/or RFC2272 should be studied carefully
before using this module, <CODE>snmp_pdus</CODE>.


<P>The module <CODE>snmp_pdus</CODE> contains functions for encoding 
and decoding of
SNMP protocol data units (PDUs). In short, this module converts a
list of bytes to Erlang record representations and vice versa.
The record definitions can be found in the file
<CODE>snmp/include/snmp_types.hrl</CODE>. If snmpv3 is used, the module
that includes <CODE>snmp_types.hrl</CODE> must define the constant
<CODE>SNMP_USE_V3</CODE> before the header file is included. Example:

<PRE>
-define(SNMP_USE_V3, true).
-include_lib(&#34;snmp/include/snmp_types.hrl&#34;).
</PRE>

<P>Encoding and decoding must be done explicitly when writing your
own Net if process.


</DIV>

<H3>EXPORTS</H3>

<P><A NAME="dec_message/1"><STRONG><CODE>dec_message([byte()]) -&#62; Message</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Message = #message</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into an SNMP Message. Note, if there
         is a v3 message, the <CODE>msgSecurityParameters</CODE> are not
        decoded. They must be explicitly decoded by a call to a
        security model specific decoding function,
        e.g. <CODE>dec_usm_security_parameters/1</CODE>. Also note, if
        the <CODE>scopedPDU</CODE> is encrypted, the OCTET STRING encoded
        <CODE>encryptedPDU</CODE> will be present in the <CODE>data</CODE> field.

</DIV>

<P><A NAME="dec_message_only/1"><STRONG><CODE>dec_message_only([byte()]) -&#62; Message</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Message = #message</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into an SNMP Message, but does not
        decode the data part of the Message. That means, data is still
        a list of bytes, normally an encoded <CODE>PDU</CODE> (v1 and V2) or an
        encoded and possibly encrypted <CODE>scopedPDU</CODE> (v3).

</DIV>

<P><A NAME="dec_pdu/1"><STRONG><CODE>dec_pdu([byte()]) -&#62; Pdu</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Pdu = #pdu</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into an SNMP Pdu.

</DIV>

<P><A NAME="dec_scoped_pdu/1"><STRONG><CODE>dec_scoped_pdu([byte()]) -&#62; ScopedPdu</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ScopedPdu = #scoped_pdu</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into an SNMP ScopedPdu.

</DIV>

<P><A NAME="dec_scoped_pdu_data/1"><STRONG><CODE>dec_scoped_pdu_data([byte()]) -&#62; ScopedPduData</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ScopedPduData = #scoped_pdu | EncryptedPDU</CODE></STRONG><BR>
<STRONG><CODE>EncryptedPDU = [byte()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into either a scoped pdu record, or
        - if the scoped pdu was encrypted - to a list of bytes.

</DIV>

<P><A NAME="dec_usm_security_parameters/1"><STRONG><CODE>dec_usm_security_parameters([byte()]) -&#62; UsmSecParams</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UsmSecParams = #usmSecurityParameters</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decodes a list of bytes into an SNMP UsmSecurityParameters

</DIV>

<P><A NAME="enc_encrypted_scoped_pdu/1"><STRONG><CODE>enc_encrypted_scoped_pdu(EncryptedScopedPdu) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>EncryptedScopedPdu = [byte()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes an encrypted SNMP ScopedPdu into an OCTET STRING
        that can de used as the <CODE>data</CODE> field in a
        <CODE>message</CODE> record, that later can be encoded with a call
        to <CODE>enc_message_only/1</CODE>. 

        
<P>This function should be used whenever the <CODE>ScopedPDU</CODE>
        is encrypted.

</DIV>

<P><A NAME="enc_message/1"><STRONG><CODE>enc_message(Message) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Message = #message</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes a message record to a list of bytes.

</DIV>

<P><A NAME="enc_message_only/1"><STRONG><CODE>enc_message_only(Message) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Message = #message</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P><CODE>Message</CODE> is a record where the <CODE>data</CODE> field is
        assumed to be encoded (a list of bytes). If there is a v1 or v2
        message, the <CODE>data</CODE> field is an encoded <CODE>PDU</CODE>, and if
        there is a v3 message, <CODE>data</CODE> is an encoded and possibly
        encrypted <CODE>scopedPDU</CODE>.

</DIV>

<P><A NAME="enc_pdu/1"><STRONG><CODE>enc_pdu(Pd) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Pdu = #pdu</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes an SNMP Pdu into a list of bytes.

</DIV>

<P><A NAME="enc_scoped_pdu/1"><STRONG><CODE>enc_scoped_pdu(ScopedPdu) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ScopedPdu = #scoped_pdu</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes an SNMP ScopedPdu into a list of bytes, which can be
         encrypted, and after encryption, encoded with
        a call to <CODE>enc_encrypted_scoped_pdu/1</CODE>; or it can be
        used as the <CODE>data</CODE> field in a <CODE>message</CODE> record, which
        then can be encoded with <CODE>enc_message_only/1</CODE>.

</DIV>

<P><A NAME="enc_usm_security_parameters/1"><STRONG><CODE>enc_usm_security_parameters(UsmSecParams) -&#62; [byte()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UsmSecParams = #usmSecurityParameters</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes SNMP UsmSecurityParameters into a list of bytes.

</DIV>

<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Martin Bjrklund - support@erlang.ericsson.se<BR>
Klas Eriksson - support@erlang.ericsson.se<BR>

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