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
//! # Primitives to send and receive SNMP messages.
//!
//! Supported PDU types:
//!
//! * GetRequest
//! * GetNextRequest
//! * GetBulkRequest
//! * Response
//! * SetRequest
//! * SNMPv2-Trap
//! * InformRequest
//!
//! ## Examples
//!
//! ```
//! use snmp_mp::{ObjectIdent, SnmpMsg, VarBind};
//!
//! let mut msg = SnmpMsg::new(1);
//! msg.set_reportable_flag();
//!
//! if let Some(scoped_pdu) = msg.scoped_pdu_data.plaintext_mut() {
//! let sys_desc = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]);
//! let var_bind = VarBind::new(sys_desc);
//!
//! scoped_pdu
//! .set_request_id(1)
//! .set_engine_id(b"context_engine_id")
//! .push_var_bind(var_bind);
//! }
//!
//! let encoded_msg = msg.encode();
//! // Send the encoded message over the network.
//! ```
//!
//! [encrypt_scoped_pdu](struct.SnmpMsg.html#method.encrypt_scoped_pdu) and
//! [decrypt_scoped_pdu](struct.SnmpMsg.html#method.decrypt_scoped_pdu) are provided to make it
//! easy to use a security model:
//!
//! ```
//! # use snmp_mp::SnmpMsg;
//! # let mut msg = SnmpMsg::new(1);
//! msg.encrypt_scoped_pdu(|encoded_scoped_pdu| {
//! // A security model encrypts and returns the scoped PDU.
//! // let (encrypted_scoped_pdu, priv_params) =
//! // priv_key.encrypt(encoded_scoped_pdu, &security_params, salt);
//! // security_params.set_priv_params(&priv_params);
//!
//! # let encrypted_scoped_pdu = encoded_scoped_pdu;
//! encrypted_scoped_pdu
//! });
//!
//! msg.decrypt_scoped_pdu(|encrypted_scoped_pdu| {
//! // A security model returns the decrypted scoped PDU wrapped in an `Option`.
//! // priv_key
//! // .decrypt(encrypted_scoped_pdu, &security_params)
//! // .ok()
//! # None
//! });
//! ```
extern crate bitflags;
pub use MsgProcessingError;
pub use ObjectIdent;
pub use PduErrorStatus;
pub use PduType;
pub use ScopedPdu;
pub use ScopedPduData;
pub use SnmpMsg;
pub use ;
/// Type alias for the result of a message processing operation.
pub type MsgProcessingResult<T> = ;
const SNMP_V3: u32 = 3;