Trait s2n_quic::provider::address_token::Format

source ·
pub trait Format: 'static + Send {
    const TOKEN_LEN: usize;

    // Required methods
    fn generate_new_token(
        &mut self,
        context: &mut Context<'_>,
        source_connection_id: &LocalId,
        output_buffer: &mut [u8]
    ) -> Option<()>;
    fn generate_retry_token(
        &mut self,
        context: &mut Context<'_>,
        original_destination_connection_id: &InitialId,
        output_buffer: &mut [u8]
    ) -> Option<()>;
    fn validate_token(
        &mut self,
        context: &mut Context<'_>,
        token: &[u8]
    ) -> Option<InitialId>;
}

Required Associated Constants§

Required Methods§

source

fn generate_new_token( &mut self, context: &mut Context<'_>, source_connection_id: &LocalId, output_buffer: &mut [u8] ) -> Option<()>

Generate a signed token to be delivered in a NEW_TOKEN frame. This function will only be called if the provider support NEW_TOKEN frames.

source

fn generate_retry_token( &mut self, context: &mut Context<'_>, original_destination_connection_id: &InitialId, output_buffer: &mut [u8] ) -> Option<()>

Generate a signed token to be delivered in a Retry Packet

source

fn validate_token( &mut self, context: &mut Context<'_>, token: &[u8] ) -> Option<InitialId>

Return the original destination connection id of a valid token. If the token is invalid, return None. Callers should detect duplicate tokens and treat them as invalid.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Format for Format

source§

const TOKEN_LEN: usize = 86usize