[−][src]Struct snmp_mp::ScopedPdu
Scoped PDU contained in an SNMP message.
Builder methods are provided to update the scoped PDU.
Examples
use snmp_mp::{PduType, ScopedPdu}; let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu .set_pdu_type(PduType::GetNextRequest) .set_engine_id(b"engine_id");
Implementations
impl ScopedPdu
[src]
pub const REQUEST_ID_MIN: i32
[src]
The smallest value that can be used as a request ID.
Examples
assert_eq!(ScopedPdu::REQUEST_ID_MIN, -214_783_648);
pub const REQUEST_ID_MAX: i32
[src]
The largest value that can be used as a request ID.
Examples
assert_eq!(ScopedPdu::REQUEST_ID_MAX, 214_783_647);
pub fn new(request_id: i32) -> Self
[src]
pub fn engine_id(&self) -> &[u8]
[src]
pub fn set_engine_id(&mut self, engine_id: &[u8]) -> &mut Self
[src]
Sets the context engine ID.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_engine_id(b"engine_id"); assert_eq!(scoped_pdu.engine_id(), b"engine_id");
pub fn context_name(&self) -> &[u8]
[src]
Returns the context name.
The context name field in conjunction with the context engine ID field, identifies the particular context associated with the management information contained in the PDU portion of the message. The contextName is unique within the SNMP entity specified by the context engine ID, which may realize the managed objects referenced within the PDU.
Examples
let context_name = scoped_pdu.context_name();
pub fn set_context_name(&mut self, context_name: &[u8]) -> &mut Self
[src]
Sets the context name.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_context_name(b"context_name"); assert_eq!(scoped_pdu.context_name(), b"context_name");
pub fn pdu_type(&self) -> PduType
[src]
pub fn set_pdu_type(&mut self, pdu_type: PduType) -> &mut Self
[src]
Sets the PDU type.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_pdu_type(PduType::GetNextRequest); assert_eq!(scoped_pdu.pdu_type(), PduType::GetNextRequest);
pub fn request_id(&self) -> i32
[src]
pub fn set_request_id(&mut self, request_id: i32) -> &mut Self
[src]
Sets the request ID.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_request_id(1234); assert_eq!(scoped_pdu.request_id(), 1234);
pub fn error_status(&self) -> PduErrorStatus
[src]
pub fn set_error_status(&mut self, error_status: PduErrorStatus) -> &mut Self
[src]
Sets the error status.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_error_status(PduErrorStatus::NoSuchName); assert_eq!(scoped_pdu.error_status(), PduErrorStatus::NoSuchName);
pub fn error_index(&self) -> u32
[src]
pub fn set_error_index(&mut self, error_index: u32) -> &mut Self
[src]
Sets the error index.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_error_index(1); assert_eq!(scoped_pdu.error_index(), 1);
pub fn var_binds(&self) -> &[VarBind]
[src]
pub fn set_var_binds<I>(&mut self, var_binds_iter: I) -> &mut Self where
I: IntoIterator<Item = VarBind>,
[src]
I: IntoIterator<Item = VarBind>,
Sets the variable bindings.
Examples
let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.set_var_binds(var_binds.clone()); assert_eq!(var_binds, scoped_pdu.var_binds());
pub fn push_var_bind(&mut self, var_bind: VarBind) -> &mut Self
[src]
Appends an element to the back of the list of variable bindings.
Examples
let oid = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let var_bind = VarBind::new(oid); let mut scoped_pdu = ScopedPdu::new(1); scoped_pdu.push_var_bind(var_bind.clone()); assert_eq!(vec![var_bind], scoped_pdu.var_binds());
pub fn encode(&self) -> Vec<u8>
[src]
Encodes a scoped PDU.
Examples
let scoped_pdu = ScopedPdu::new(1); let encoded_scoped_pdu = scoped_pdu.encode();
pub fn decode(buf: &[u8]) -> MsgProcessingResult<Self>
[src]
Decodes an encoded scope PDU.
Errors
If the scoped PDU is not properly formed a result with MalformedMsg error is returned.
Examples
let scoped_pdu = ScopedPdu::decode(&encoded_scoped_pdu)?;
Trait Implementations
impl Clone for ScopedPdu
[src]
impl Debug for ScopedPdu
[src]
impl Default for ScopedPdu
[src]
impl Eq for ScopedPdu
[src]
impl Hash for ScopedPdu
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<ScopedPdu> for ScopedPdu
[src]
impl StructuralEq for ScopedPdu
[src]
impl StructuralPartialEq for ScopedPdu
[src]
Auto Trait Implementations
impl RefUnwindSafe for ScopedPdu
impl Send for ScopedPdu
impl Sync for ScopedPdu
impl Unpin for ScopedPdu
impl UnwindSafe for ScopedPdu
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,