Struct ldap_parser::ldap::LdapMessage
source · [−]pub struct LdapMessage<'a> {
pub message_id: MessageID,
pub protocol_op: ProtocolOp<'a>,
pub controls: Option<Vec<Control<'a>>>,
}Expand description
An LDAP Message according to RFC4511
Parse a single LDAP message and return a structure borrowing fields from the input buffer
use ldap_parser::FromBer;
use ldap_parser::ldap::{LdapMessage, MessageID, ProtocolOp, ProtocolOpTag};
static DATA: &[u8] = include_bytes!("../assets/message-search-request-01.bin");
let res = LdapMessage::from_ber(DATA);
match res {
Ok((rem, msg)) => {
assert!(rem.is_empty());
//
assert_eq!(msg.message_id, MessageID(4));
assert_eq!(msg.protocol_op.tag(), ProtocolOpTag::SearchRequest);
match msg.protocol_op {
ProtocolOp::SearchRequest(req) => {
assert_eq!(req.base_object.0, "dc=rccad,dc=net");
},
_ => panic!("Unexpected message type"),
}
},
_ => panic!("LDAP parsing failed: {:?}", res),
}Fields
message_id: MessageIDMessage Identifier (32-bits unsigned integer)
The messageID of a request MUST have a non-zero value different from the messageID of any other request in progress in the same LDAP session. The zero value is reserved for the unsolicited notification message.
protocol_op: ProtocolOp<'a>The LDAP operation from this LDAP message
controls: Option<Vec<Control<'a>>>Message controls (optional)
Controls provide a mechanism whereby the semantics and arguments of existing LDAP operations may be extended. One or more controls may be attached to a single LDAP message. A control only affects the semantics of the message it is attached to.
Implementations
sourceimpl<'a> LdapMessage<'a>
impl<'a> LdapMessage<'a>
Trait Implementations
sourceimpl<'a> Debug for LdapMessage<'a>
impl<'a> Debug for LdapMessage<'a>
sourceimpl<'a> FromBer<'a, LdapError> for LdapMessage<'a>
impl<'a> FromBer<'a, LdapError> for LdapMessage<'a>
Parse a single LDAP message and return a structure borrowing fields from the input buffer
use ldap_parser::FromBer;
use ldap_parser::ldap::{LdapMessage, MessageID, ProtocolOp, ProtocolOpTag};
static DATA: &[u8] = include_bytes!("../assets/message-search-request-01.bin");
let res = LdapMessage::from_ber(DATA);
match res {
Ok((rem, msg)) => {
assert!(rem.is_empty());
//
assert_eq!(msg.message_id, MessageID(4));
assert_eq!(msg.protocol_op.tag(), ProtocolOpTag::SearchRequest);
match msg.protocol_op {
ProtocolOp::SearchRequest(req) => {
assert_eq!(req.base_object.0, "dc=rccad,dc=net");
},
_ => panic!("Unexpected message type"),
}
},
_ => panic!("LDAP parsing failed: {:?}", res),
}sourceimpl<'a> PartialEq<LdapMessage<'a>> for LdapMessage<'a>
impl<'a> PartialEq<LdapMessage<'a>> for LdapMessage<'a>
sourcefn eq(&self, other: &LdapMessage<'a>) -> bool
fn eq(&self, other: &LdapMessage<'a>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &LdapMessage<'a>) -> bool
fn ne(&self, other: &LdapMessage<'a>) -> bool
This method tests for !=.
impl<'a> StructuralPartialEq for LdapMessage<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for LdapMessage<'a>
impl<'a> Send for LdapMessage<'a>
impl<'a> Sync for LdapMessage<'a>
impl<'a> Unpin for LdapMessage<'a>
impl<'a> UnwindSafe for LdapMessage<'a>
Blanket Implementations
sourceimpl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
sourceimpl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more