.TH snmp_pdus 3erl "snmp 5.13.5" "Ericsson AB" "Erlang Module Definition" .SH NAME 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: .LP .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 .LP Types: .RS 3 Message = #message .br .RE .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 .LP Types: .RS 3 Message = #message .br .RE .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 .LP Types: .RS 3 Pdu = #pdu .br .RE .RE .RS .LP Decodes a list of bytes into an SNMP Pdu\&. .RE .LP .B dec_scoped_pdu([byte()]) -> ScopedPdu .br .RS .LP Types: .RS 3 ScopedPdu = #scoped_pdu .br .RE .RE .RS .LP Decodes a list of bytes into an SNMP ScopedPdu\&. .RE .LP .B dec_scoped_pdu_data([byte()]) -> ScopedPduData .br .RS .LP Types: .RS 3 ScopedPduData = #scoped_pdu | EncryptedPDU .br EncryptedPDU = [byte()] .br .RE .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 .LP Types: .RS 3 UsmSecParams = #usmSecurityParameters .br .RE .RE .RS .LP Decodes a list of bytes into an SNMP UsmSecurityParameters .RE .LP .B enc_message(Message) -> [byte()] .br .RS .LP Types: .RS 3 Message = #message .br .RE .RE .RS .LP Encodes a message record to a list of bytes\&. .RE .LP .B enc_message_only(Message) -> [byte()] .br .RS .LP Types: .RS 3 Message = #message .br .RE .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 .LP Types: .RS 3 Pdu = #pdu .br .RE .RE .RS .LP Encodes an SNMP Pdu into a list of bytes\&. .RE .LP .B enc_scoped_pdu(ScopedPdu) -> [byte()] .br .RS .LP Types: .RS 3 ScopedPdu = #scoped_pdu .br .RE .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 .LP Types: .RS 3 UsmSecParams = #usmSecurityParameters .br .RE .RE .RS .LP Encodes SNMP UsmSecurityParameters into a list of bytes\&. .RE