1#[derive(Debug, PartialEq)]
4pub enum RecordError {
5 Validity,
7 Alignment,
9 Size,
11 OverflowLength,
13 ClientHello(ClientHelloError),
15 ServerHello(ServerHelloError),
17 NotAllowed,
19 NotImplemented(&'static str, &'static str),
21}
22
23#[derive(Debug, PartialEq)]
24pub enum ClientHelloError {
25 OverflowSesId,
27 OverflowCipherSuites,
29 Extensions(ExtensionsError),
31 CipherSuites(CipherSuitesError),
33}
34
35#[derive(Debug, PartialEq)]
36pub enum ServerHelloError {
37 OverflowSesId,
39 OverflowCipherSuites,
41 Extensions(ExtensionsError),
43 CipherSuites(CipherSuitesError),
45}
46
47#[derive(Debug, PartialEq)]
48pub enum ExtensionsError {
49 OverflowExtensionLen,
51}
52
53#[derive(Debug, PartialEq)]
54pub enum CipherSuitesError {
55 InvalidLength,
57}
58
59use zerocopy::{error::TryCastError, TryFromBytes};
60
61impl RecordError {
62 pub(crate) fn from_zero_copy<Src, Dst: ?Sized + TryFromBytes>(
63 e: TryCastError<Src, Dst>,
64 ) -> Self {
65 match e {
66 TryCastError::Alignment(..) => Self::Alignment,
67 TryCastError::Validity(..) => Self::Validity,
68 TryCastError::Size(..) => Self::Size,
69 }
70 }
71}
72
73#[derive(Debug, PartialEq)]
74pub enum BuilderError {
75 Overflow,
78 SessionIdOverflow,
80 DisjointMutError,
82}