1snmp_pdus(3) Erlang Module Definition snmp_pdus(3)
2
3
4
6 snmp_pdus - Encode and Decode Functions for SNMP PDUs
7
9 RFC1157, RFC1905 and/or RFC2272 should be studied carefully before
10 using this module, snmp_pdus.
11
12 The module snmp_pdus contains functions for encoding and decoding of
13 SNMP protocol data units (PDUs). In short, this module converts a list
14 of bytes to Erlang record representations and vice versa. The record
15 definitions can be found in the file snmp/include/snmp_types.hrl. If
16 snmpv3 is used, the module that includes snmp_types.hrl must define the
17 constant SNMP_USE_V3 before the header file is included. Example:
18
19 -define(SNMP_USE_V3, true).
20 -include_lib("snmp/include/snmp_types.hrl").
21
22 Encoding and decoding must be done explicitly when writing your own Net
23 if process.
24
26 dec_message([byte()]) -> Message
27
28 Types:
29
30 Message = #message
31
32 Decodes a list of bytes into an SNMP Message. Note, if there is
33 a v3 message, the msgSecurityParameters are not decoded. They
34 must be explicitly decoded by a call to a security model spe‐
35 cific decoding function, e.g. dec_usm_security_parameters/1.
36 Also note, if the scopedPDU is encrypted, the OCTET STRING
37 encoded encryptedPDU will be present in the data field.
38
39 dec_message_only([byte()]) -> Message
40
41 Types:
42
43 Message = #message
44
45 Decodes a list of bytes into an SNMP Message, but does not
46 decode the data part of the Message. That means, data is still a
47 list of bytes, normally an encoded PDU (v1 and V2) or an encoded
48 and possibly encrypted scopedPDU (v3).
49
50 dec_pdu([byte()]) -> Pdu
51
52 Types:
53
54 Pdu = #pdu
55
56 Decodes a list of bytes into an SNMP Pdu.
57
58 dec_scoped_pdu([byte()]) -> ScopedPdu
59
60 Types:
61
62 ScopedPdu = #scoped_pdu
63
64 Decodes a list of bytes into an SNMP ScopedPdu.
65
66 dec_scoped_pdu_data([byte()]) -> ScopedPduData
67
68 Types:
69
70 ScopedPduData = #scoped_pdu | EncryptedPDU
71 EncryptedPDU = [byte()]
72
73 Decodes a list of bytes into either a scoped pdu record, or - if
74 the scoped pdu was encrypted - to a list of bytes.
75
76 dec_usm_security_parameters([byte()]) -> UsmSecParams
77
78 Types:
79
80 UsmSecParams = #usmSecurityParameters
81
82 Decodes a list of bytes into an SNMP UsmSecurityParameters
83
84 enc_encrypted_scoped_pdu(EncryptedScopedPdu) -> [byte()]
85
86 Types:
87
88 EncryptedScopedPdu = [byte()]
89
90 Encodes an encrypted SNMP ScopedPdu into an OCTET STRING that
91 can be used as the data field in a message record, that later
92 can be encoded with a call to enc_message_only/1.
93
94 This function should be used whenever the ScopedPDU is
95 encrypted.
96
97 enc_message(Message) -> [byte()]
98
99 Types:
100
101 Message = #message
102
103 Encodes a message record to a list of bytes.
104
105 enc_message_only(Message) -> [byte()]
106
107 Types:
108
109 Message = #message
110
111 Message is a record where the data field is assumed to be
112 encoded (a list of bytes). If there is a v1 or v2 message, the
113 data field is an encoded PDU, and if there is a v3 message, data
114 is an encoded and possibly encrypted scopedPDU.
115
116 enc_pdu(Pd) -> [byte()]
117
118 Types:
119
120 Pdu = #pdu
121
122 Encodes an SNMP Pdu into a list of bytes.
123
124 enc_scoped_pdu(ScopedPdu) -> [byte()]
125
126 Types:
127
128 ScopedPdu = #scoped_pdu
129
130 Encodes an SNMP ScopedPdu into a list of bytes, which can be
131 encrypted, and after encryption, encoded with a call to
132 enc_encrypted_scoped_pdu/1; or it can be used as the data field
133 in a message record, which then can be encoded with enc_mes‐
134 sage_only/1.
135
136 enc_usm_security_parameters(UsmSecParams) -> [byte()]
137
138 Types:
139
140 UsmSecParams = #usmSecurityParameters
141
142 Encodes SNMP UsmSecurityParameters into a list of bytes.
143
144
145
146Ericsson AB snmp 5.2.11.1 snmp_pdus(3)