File: snmp_pdus.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (189 lines) | stat: -rw-r--r-- 4,151 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
.TH snmp_pdus 3 "snmp  4.11" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
snmp_pdus \- Encode and Decode Functions for SNMP PDUs
.SH DESCRIPTION
.LP
RFC1157, RFC1905 and/or RFC2272 should be studied carefully before using this module, \fIsnmp_pdus\fR\&. 
.LP
The module \fIsnmp_pdus\fR 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 \fIsnmp/include/snmp_types\&.hrl\fR\&. If snmpv3 is used, the module that includes \fIsnmp_types\&.hrl\fR must define the constant \fISNMP_USE_V3\fR before the header file is included\&. Example:

.nf
-define(SNMP_USE_V3, true)\&.
-include_lib("snmp/include/snmp_types\&.hrl")\&.    
.fi
.LP
Encoding and decoding must be done explicitly when writing your own Net if process\&. 

.SH EXPORTS
.LP
.B
dec_message([byte()]) -> Message
.br
.RS
.TP
Types
Message = #message
.br
.RE
.RS
.LP
Decodes a list of bytes into an SNMP Message\&. Note, if there is a v3 message, the \fImsgSecurityParameters\fR are not decoded\&. They must be explicitly decoded by a call to a security model specific decoding function, e\&.g\&. \fIdec_usm_security_parameters/1\fR\&. Also note, if the \fIscopedPDU\fR is encrypted, the OCTET STRING encoded \fIencryptedPDU\fR will be present in the \fIdata\fR field\&.
.RE
.LP
.B
dec_message_only([byte()]) -> Message
.br
.RS
.TP
Types
Message = #message
.br
.RE
.RS
.LP
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 \fIPDU\fR (v1 and V2) or an encoded and possibly encrypted \fIscopedPDU\fR (v3)\&.
.RE
.LP
.B
dec_pdu([byte()]) -> Pdu
.br
.RS
.TP
Types
Pdu = #pdu
.br
.RE
.RS
.LP
Decodes a list of bytes into an SNMP Pdu\&.
.RE
.LP
.B
dec_scoped_pdu([byte()]) -> ScopedPdu
.br
.RS
.TP
Types
ScopedPdu = #scoped_pdu
.br
.RE
.RS
.LP
Decodes a list of bytes into an SNMP ScopedPdu\&.
.RE
.LP
.B
dec_scoped_pdu_data([byte()]) -> ScopedPduData
.br
.RS
.TP
Types
ScopedPduData = #scoped_pdu | EncryptedPDU
.br
EncryptedPDU = [byte()]
.br
.RE
.RS
.LP
Decodes a list of bytes into either a scoped pdu record, or - if the scoped pdu was encrypted - to a list of bytes\&.
.RE
.LP
.B
dec_usm_security_parameters([byte()]) -> UsmSecParams
.br
.RS
.TP
Types
UsmSecParams = #usmSecurityParameters
.br
.RE
.RS
.LP
Decodes a list of bytes into an SNMP UsmSecurityParameters
.RE
.LP
.B
enc_encrypted_scoped_pdu(EncryptedScopedPdu) -> [byte()]
.br
.RS
.TP
Types
EncryptedScopedPdu = [byte()]
.br
.RE
.RS
.LP
Encodes an encrypted SNMP ScopedPdu into an OCTET STRING that can be used as the \fIdata\fR field in a \fImessage\fR record, that later can be encoded with a call to \fIenc_message_only/1\fR\&. 
.LP
This function should be used whenever the \fIScopedPDU\fR is encrypted\&.
.RE
.LP
.B
enc_message(Message) -> [byte()]
.br
.RS
.TP
Types
Message = #message
.br
.RE
.RS
.LP
Encodes a message record to a list of bytes\&.
.RE
.LP
.B
enc_message_only(Message) -> [byte()]
.br
.RS
.TP
Types
Message = #message
.br
.RE
.RS
.LP
\fIMessage\fR is a record where the \fIdata\fR field is assumed to be encoded (a list of bytes)\&. If there is a v1 or v2 message, the \fIdata\fR field is an encoded \fIPDU\fR, and if there is a v3 message, \fIdata\fR is an encoded and possibly encrypted \fIscopedPDU\fR\&.
.RE
.LP
.B
enc_pdu(Pd) -> [byte()]
.br
.RS
.TP
Types
Pdu = #pdu
.br
.RE
.RS
.LP
Encodes an SNMP Pdu into a list of bytes\&.
.RE
.LP
.B
enc_scoped_pdu(ScopedPdu) -> [byte()]
.br
.RS
.TP
Types
ScopedPdu = #scoped_pdu
.br
.RE
.RS
.LP
Encodes an SNMP ScopedPdu into a list of bytes, which can be encrypted, and after encryption, encoded with a call to \fIenc_encrypted_scoped_pdu/1\fR; or it can be used as the \fIdata\fR field in a \fImessage\fR record, which then can be encoded with \fIenc_message_only/1\fR\&.
.RE
.LP
.B
enc_usm_security_parameters(UsmSecParams) -> [byte()]
.br
.RS
.TP
Types
UsmSecParams = #usmSecurityParameters
.br
.RE
.RS
.LP
Encodes SNMP UsmSecurityParameters into a list of bytes\&.
.RE