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 us‐
10 ing 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 en‐
37 coded 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 de‐
46 code 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_message(Message) -> [byte()]
85
86 Types:
87
88 Message = #message
89
90 Encodes a message record to a list of bytes.
91
92 enc_message_only(Message) -> [byte()]
93
94 Types:
95
96 Message = #message
97
98 Message is a record where the data field is assumed to be en‐
99 coded (a list of bytes). If there is a v1 or v2 message, the
100 data field is an encoded PDU, and if there is a v3 message, data
101 is an encoded and possibly encrypted scopedPDU.
102
103 enc_pdu(Pd) -> [byte()]
104
105 Types:
106
107 Pdu = #pdu
108
109 Encodes an SNMP Pdu into a list of bytes.
110
111 enc_scoped_pdu(ScopedPdu) -> [byte()]
112
113 Types:
114
115 ScopedPdu = #scoped_pdu
116
117 Encodes an SNMP ScopedPdu into a list of bytes, which can be en‐
118 crypted, and after encryption, encoded with a call to enc_en‐
119 crypted_scoped_pdu/1; or it can be used as the data field in a
120 message record, which then can be encoded with enc_mes‐
121 sage_only/1.
122
123 enc_usm_security_parameters(UsmSecParams) -> [byte()]
124
125 Types:
126
127 UsmSecParams = #usmSecurityParameters
128
129 Encodes SNMP UsmSecurityParameters into a list of bytes.
130
131
132
133Ericsson AB snmp 5.10.1 snmp_pdus(3)