[−][src]Struct rsasl::SASL
Main rsasl struct
This struct wraps a gsasl context ensuring gsasl_init
and gsasl_done
are called. It
implements Deref
and DerefMut
to the — unmanaged — SaslCtx that
wraps the unsafe FFI methods from GSASL with safe(r) Rust functions.
The reason for this split lays in callbacks - they are given pointers to the (C struct) context
and session they were called from which we wrap so the safe(r) Rust methods can be used
instead, but we MUST NOT call done
on the context or the session afterwards.
The two type parameters restrict the types you can store / retrieve in callbacks; gsasl allows to store two objects in the context and session so that the callback function can access them despite being called with no reference to Rust's execution environment otherwise. They are exposed in rsasl as store and retrieve
Implementations
impl<D, E> SASL<D, E>
[src]
Methods from Deref<Target = SaslCtx<D, E>>
pub fn client_mech_list(&self) -> Result<Mechanisms>
[src]
return the list of supported mechanism on the client side as a space-separated string
pub fn server_mech_list(&self) -> Result<Mechanisms>
[src]
return the list of supported mechanism on the server side as a space-separated string
pub fn client_supports(&self, mech: &str) -> bool
[src]
Return wheter there is client-side support for the specified mechanism
pub fn server_supports(&self, mech: &str) -> bool
[src]
Return wheter there is server-side support for the specified mechanism
pub fn install_callback<C: Callback<D, E>>(&mut self)
[src]
The callback is used by mechanisms to retrieve information, such as username and password, from the application. In a server, the callback is used to decide whether a user is permitted to log in or not. With this function you install the callback for the given context.
See the trait documentation for details on how to use this function
pub fn client_start(&mut self, mech: &str) -> Result<SessionHandle<E>>
[src]
Start the client side of an authentication exchange
Depending on the mechanism you have chosen this may need additional data from you (such as
an authcid, and/or authzid and password for PLAIN). To provide that data either call
set_property
on the returned session or install a Callback.
See the gsasl documentation for how gsasl uses properties and callbacks.
pub fn server_start(&mut self, mech: &str) -> Result<SessionHandle<E>>
[src]
Start the server side of an authentication exchange
Depending on the mechanism you have chosen this may need additional data from you (such as
the ability to check authcid/authzid/password combinations for PLAIN). Either provide that
data using calls to set_property
on the returned session or install a Callback.
See the gsasl documentation for how gsasl uses properties and callbacks.
pub fn store(&mut self, data: Box<D>)
[src]
Store some data in the SASL 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. Mainly useful for callbacks
The function tries to return None
if no data was stored.
pub fn callback(&mut self, session: &mut Session<E>, prop: Property) -> c_int
[src]
Run the configured callback
Trait Implementations
impl<D: Debug, E: Debug> Debug for SASL<D, E>
[src]
impl<D, E> Deref for SASL<D, E>
[src]
type Target = SaslCtx<D, E>
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl<D, E> DerefMut for SASL<D, E>
[src]
impl<D, E> Drop for SASL<D, E>
[src]
Auto Trait Implementations
impl<D, E> RefUnwindSafe for SASL<D, E> where
D: RefUnwindSafe,
E: RefUnwindSafe,
[src]
D: RefUnwindSafe,
E: RefUnwindSafe,
impl<D, E> !Send for SASL<D, E>
[src]
impl<D, E> !Sync for SASL<D, E>
[src]
impl<D, E> Unpin for SASL<D, E> where
D: Unpin,
E: Unpin,
[src]
D: Unpin,
E: Unpin,
impl<D, E> UnwindSafe for SASL<D, E> where
D: UnwindSafe,
E: UnwindSafe,
[src]
D: UnwindSafe,
E: 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>,