Struct rsasl::session::Session [−][src]
The context of an authentication exchange
This struct will call the necesarry initializers on construction and finalizers when
discarded
. If manual housekeeping is required the session can be leaked with
DiscardOnDrop::leak
.
Implementations
impl<D> Session<D>
[src]
pub fn step(&mut self, input: &[u8]) -> StepResult<SaslBuffer>
[src]
Perform one step of SASL authentication. This reads data from input
then processes it,
potentially calling a configured callback for required properties or enact decisions, and
finally returns data to be send to the other party.
Note: This function may leak memory on internal failure.
pub fn step64(&mut self, input: &CStr) -> StepResult<SaslString>
[src]
A simple wrapper around the gsasl step function that base64-decodes the input and base64-encodes the output. Mainly useful for text-based protocols.
Note: This function may leak memory on failure since the internal step function does as well.
pub fn set_property(&mut self, prop: Property, data: &[u8])
[src]
Set a property in the session context
A property
in this context is a piece of information used by authentication mechanisms,
for example the Authcid, Authzid and Password for PLAIN.
This is the Rust equivalent to the gsasl_property_set
funciton.
pub fn get_property(&self, prop: Property) -> Option<&CStr>
[src]
Try to read a property from the session context
This maps to gsasl_property_fast
meaning it will not call the callback to retrieve
properties it does not know about.
Returns None
if the property is now known or was not set
pub fn store(&mut self, data: Box<D>)
[src]
Store some data in the Session context
This allows a callback to later access that data using retrieve
or retrieve_mut
pub unsafe fn retrieve(&mut self) -> Option<Box<D>>
[src]
Retrieve the data stored with store
, leaving nothing in its place
This function will return None
if no data was stored. This function is unsafe because we
can not guarantee that there is currently nothing else that has a reference to the data
which will turn into a dangling pointer if the returned Box is dropped
pub fn retrieve_mut(&mut self) -> Option<&mut D>
[src]
Retrieve a mutable reference to the data stored with store
This is an alternative to retrieve_raw
that does not take ownership of the stored data,
thus also not dropping it after it has left the current scope.
The function tries to return None
if no data was stored.
Trait Implementations
Auto Trait Implementations
impl<D> RefUnwindSafe for Session<D> where
D: RefUnwindSafe,
D: RefUnwindSafe,
impl<D> !Send for Session<D>
impl<D> !Sync for Session<D>
impl<D> Unpin for Session<D> where
D: Unpin,
D: Unpin,
impl<D> UnwindSafe for Session<D> where
D: UnwindSafe,
D: UnwindSafe,
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,
pub 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, 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.
pub 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>,