1#[derive(Debug, PartialEq)]
4pub enum RecordError {
5 Validity,
7 Alignment,
9 Size,
11 OverflowLength,
13 ClientHello(ClientHelloError),
15 NotAllowed,
17}
18
19#[derive(Debug, PartialEq)]
20pub enum ClientHelloError {
21 OverflowSesId,
23 OverflowCipherSuites,
25 Extensions(ExtensionsError),
27 CipherSuites(CipherSuitesError),
29}
30
31#[derive(Debug, PartialEq)]
32pub enum ExtensionsError {
33 OverflowExtensionLen,
35}
36
37#[derive(Debug, PartialEq)]
38pub enum CipherSuitesError {
39 InvalidLength,
41}
42
43use zerocopy::{error::TryCastError, TryFromBytes};
44
45impl RecordError {
46 pub(crate) fn from_zero_copy<Src, Dst: ?Sized + TryFromBytes>(
47 e: TryCastError<Src, Dst>,
48 ) -> Self {
49 match e {
50 TryCastError::Alignment(..) => Self::Alignment,
51 TryCastError::Validity(..) => Self::Validity,
52 TryCastError::Size(..) => Self::Size,
53 }
54 }
55}
56
57#[derive(Debug, PartialEq)]
58pub enum BuilderError {
59 Overflow,
62 SessionIdOverflow,
64 DisjointMutError,
66}