pub struct Message {
    pub typ: ContentType,
    pub version: ProtocolVersion,
    pub payload: MessagePayload,
}
Expand description

A TLS frame, named TLSPlaintext in the standard. This type owns all memory for its interior parts.

Fields§

§typ: ContentType§version: ProtocolVersion§payload: MessagePayload

Implementations§

source§

impl Message

source

pub const MAX_WIRE_SIZE: usize = 18_437usize

Maximum on-wire message size.

source§

impl Message

source

pub fn read_with_detailed_error( r: &mut Reader<'_> ) -> Result<Message, MessageError>

Like Message::read(), but allows the important distinction between: this message might be valid if we read more data; and this message will never be valid.

source

pub fn is_content_type(&self, typ: ContentType) -> bool

source

pub fn is_handshake_type(&self, hstyp: HandshakeType) -> bool

source

pub fn decode_payload(&mut self) -> bool

source

pub fn take_payload(self) -> Vec<u8>

source

pub fn take_opaque_payload(&mut self) -> Option<Payload>

source

pub fn into_opaque(self) -> Message

source

pub fn build_alert(level: AlertLevel, desc: AlertDescription) -> Message

source

pub fn build_key_update_notify() -> Message

source§

impl<'a> Message

source

pub fn to_borrowed(&'a self) -> BorrowMessage<'a>

Trait Implementations§

source§

impl Codec for Message

source§

fn read(r: &mut Reader<'_>) -> Option<Message>

Decode yourself by fiddling with the Reader. Return Some if it worked, None if not.
source§

fn encode(&self, bytes: &mut Vec<u8>)

Encode yourself by appending onto bytes.
source§

fn get_encoding(&self) -> Vec<u8>

Convenience function to get the results of encode().
source§

fn read_bytes(bytes: &[u8]) -> Option<Self>

Read one of these from the front of bytes and return it.
source§

impl Debug for Message

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.