Struct openssl::ssl::NonblockingSslStream [] [src]

pub struct NonblockingSslStream<S> {
    // some fields omitted
}

An SSL stream wrapping a nonblocking socket.

Methods

impl NonblockingSslStream<TcpStream>

fn try_clone(&self) -> Result<NonblockingSslStream<TcpStream>>

impl<S> NonblockingSslStream<S>

fn get_ref(&self) -> &S

Returns a reference to the underlying stream.

fn get_mut(&mut self) -> &mut S

Returns a mutable reference to the underlying stream.

Warning

It is inadvisable to read from or write to the underlying stream as it will most likely corrupt the SSL session.

fn ssl(&self) -> &Ssl

Returns a reference to the Ssl.

impl<S: Read + Write + AsRawFd> NonblockingSslStream<S>

fn connect<T: IntoSsl>(ssl: T, stream: S) -> Result<NonblockingSslStream<S>, SslError>

Create a new nonblocking client ssl connection on wrapped stream.

Note that this method will most likely not actually complete the SSL handshake because doing so requires several round trips; the handshake will be completed in subsequent read/write calls managed by your event loop.

fn accept<T: IntoSsl>(ssl: T, stream: S) -> Result<NonblockingSslStream<S>, SslError>

Create a new nonblocking server ssl connection on wrapped stream.

Note that this method will most likely not actually complete the SSL handshake because doing so requires several round trips; the handshake will be completed in subsequent read/write calls managed by your event loop.

impl<S: Read + Write> NonblockingSslStream<S>

fn read(&mut self, buf: &mut [u8]) -> Result<usize, NonblockingSslError>

Read bytes from the SSL stream into buf.

Given the SSL state machine, this method may return either WantWrite or WantRead to indicate that your event loop should respectively wait for write or read readiness on the underlying stream. Upon readiness, repeat your read() call with the same arguments each time until you receive an Ok(count).

An SslError return value, is terminal; do not re-attempt your read.

As expected of a nonblocking API, this method will never block your thread on I/O.

On a return value of Ok(count), count is the number of decrypted plaintext bytes copied into the buf slice.

fn write(&mut self, buf: &[u8]) -> Result<usize, NonblockingSslError>

Write bytes from buf to the SSL stream.

Given the SSL state machine, this method may return either WantWrite or WantRead to indicate that your event loop should respectively wait for write or read readiness on the underlying stream. Upon readiness, repeat your write() call with the same arguments each time until you receive an Ok(count).

An SslError return value, is terminal; do not re-attempt your write.

As expected of a nonblocking API, this method will never block your thread on I/O.

Given a return value of Ok(count), count is the number of plaintext bytes from the buf slice that were encrypted and written onto the stream.

Trait Implementations

impl<S: AsRawFd> AsRawFd for NonblockingSslStream<S>

fn as_raw_fd(&self) -> RawFd

Derived Implementations

impl<S: Clone> Clone for NonblockingSslStream<S>

fn clone(&self) -> NonblockingSslStream<S>

fn clone_from(&mut self, source: &Self)