[][src]Struct kuska_handshake::Handshake

pub struct Handshake<S: State> {
    pub base: HandshakeBase,
    pub state: S,
}

The Handshake type maintains the different states that happen in each step of the handshake, allowing it to advance to completion.

The Handshake follows the typestate pattern.

Fields

base: HandshakeBasestate: S

Implementations

impl Handshake<SendClientHello>[src]

pub fn new_client(
    net_id: Key,
    pk: PublicKey,
    sk: SecretKey
) -> Handshake<SendClientHello>
[src]

Create a new handshake client that can send the client hello.

impl Handshake<SendClientHello>[src]

pub fn send_client_hello(
    self,
    send_buf: &mut [u8]
) -> Handshake<RecvServerHello>
[src]

Send a client hello and advance to the next client state.

pub const fn send_bytes(&self) -> usize[src]

Number of bytes that will be written to the send_buf in this state.

impl Handshake<RecvServerHello>[src]

pub fn recv_server_hello(
    self,
    recv_buf: &[u8]
) -> Result<Handshake<SendClientAuth>, Error>
[src]

Receive a server hello and advance to the next client state.

pub const fn recv_bytes(&self) -> usize[src]

Number of bytes that will be read from the recv_buf in this state.

impl Handshake<SendClientAuth>[src]

pub fn send_client_auth(
    self,
    send_buf: &mut [u8],
    server_pk: PublicKey
) -> Result<Handshake<RecvServerAccept>, Error>
[src]

Send a client auth and advance to the next client state.

pub const fn send_bytes(&self) -> usize[src]

Number of bytes that will be written to the send_buf in this state.

impl Handshake<RecvServerAccept>[src]

pub fn recv_server_accept(
    self,
    recv_buf: &mut [u8]
) -> Result<Handshake<Complete>, Error>
[src]

pub const fn recv_bytes(&self) -> usize[src]

Number of bytes that will be read from the recv_buf in this state.

impl Handshake<RecvClientHello>[src]

pub fn new_server(
    net_id: Key,
    pk: PublicKey,
    sk: SecretKey
) -> Handshake<RecvClientHello>
[src]

Create a new handshake server that can receive the client hello.

impl Handshake<RecvClientHello>[src]

pub fn recv_client_hello(
    self,
    recv_buf: &[u8]
) -> Result<Handshake<SendServerHello>, Error>
[src]

Receive a client hello and advance to the next server state.

pub const fn recv_bytes(&self) -> usize[src]

Number of bytes that will be read from the recv_buf in this state.

impl Handshake<SendServerHello>[src]

pub fn send_server_hello(self, send_buf: &mut [u8]) -> Handshake<RecvClientAuth>[src]

Send a server hello and advance to the next server state.

pub const fn send_bytes(&self) -> usize[src]

Number of bytes that will be written to the send_buf in this state.

impl Handshake<RecvClientAuth>[src]

pub fn recv_client_auth(
    self,
    recv_buf: &mut [u8]
) -> Result<Handshake<SendServerAccept>, Error>
[src]

Receive a client auth and advance to the next server state.

pub const fn recv_bytes(&self) -> usize[src]

Number of bytes that will be read from the recv_buf in this state.

impl Handshake<SendServerAccept>[src]

pub fn send_server_accept(self, send_buf: &mut [u8]) -> Handshake<Complete>[src]

Send a server accept and advance to the next server state.

pub const fn send_bytes(&self) -> usize[src]

Number of bytes that will be written to the send_buf in this state.

impl Handshake<Complete>[src]

pub fn complete(&self) -> HandshakeComplete[src]

Create a HandshakeComplete out of a Handshake in the Complete state.

Trait Implementations

impl<S: Debug + State> Debug for Handshake<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for Handshake<S> where
    S: RefUnwindSafe
[src]

impl<S> Send for Handshake<S> where
    S: Send
[src]

impl<S> Sync for Handshake<S> where
    S: Sync
[src]

impl<S> Unpin for Handshake<S> where
    S: Unpin
[src]

impl<S> UnwindSafe for Handshake<S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.