pub struct Record<P> {
pub typ: ContentType,
pub version: EncodableVersion,
pub payload: P,
}Expand description
A TLS record with encoded (but not necessarily encrypted) payload.
Fields§
§typ: ContentTypeThe content type of this record.
version: EncodableVersionThe protocol version of this record.
payload: PThe payload of this record.
Implementations§
Source§impl<P> Record<P>
impl<P> Record<P>
Sourcepub fn new(typ: ContentType, version: EncodableVersion, payload: P) -> Self
pub fn new(typ: ContentType, version: EncodableVersion, payload: P) -> Self
Create a new Record with the given fields.
Source§impl<'a> Record<Payload<'a>>
impl<'a> Record<Payload<'a>>
Sourcepub fn borrow_outbound(&'a self) -> Record<OutboundPlain<'a>>
pub fn borrow_outbound(&'a self) -> Record<OutboundPlain<'a>>
Borrow as an Record<OutboundPlain<'a>>.
Sourcepub fn into_owned(self) -> Self
pub fn into_owned(self) -> Self
Convert into an owned Record<Plain<'static>>.
Source§impl<'a> Record<InboundOpaque<'a>>
impl<'a> Record<InboundOpaque<'a>>
Sourcepub fn into_tls13_unpadded_record(self) -> Result<Record<&'a [u8]>, Error>
pub fn into_tls13_unpadded_record(self) -> Result<Record<&'a [u8]>, Error>
For TLS1.3 (only), checks the length record.payload is valid and removes the padding.
Returns an error if the record payload (pre-unpadding) is too long, or the padding is invalid, or the record payload (post-unpadding) is too long.
Sourcepub fn into_plain_record_range(self, range: Range<usize>) -> Record<&'a [u8]>
pub fn into_plain_record_range(self, range: Range<usize>) -> Record<&'a [u8]>
Force conversion into a plaintext record.
range restricts the resulting record: this function panics if it is out of range for
the underlying record payload.
This should only be used for records that are known to be in plaintext. Otherwise, the
Record<InboundOpaque<'_>> should be decrypted into an
Record<&'_ [u8]> using a RecordDecrypter.
Sourcepub fn into_plain_record(self) -> Record<&'a [u8]>
pub fn into_plain_record(self) -> Record<&'a [u8]>
Force conversion into a plaintext record.
This should only be used for records that are known to be in plaintext. Otherwise, the
Record<InboundOpaque<'a>> should be decrypted into a
Record<&'a [u8]> using a RecordDecrypter.