1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pub mod ethernet;

use crate::flow::Flow;
use crate::flow::errors::Error;

pub trait FlowExtraction {
    fn extract_flow(&self) -> Result<Flow, Error>;
}

pub mod errors {
    use crate::flow::layer2::ethernet;
    use failure::Fail;

    #[derive(Debug, Fail)]
    pub enum Error {
        #[fail(display = "Ethernet Error")]
        Ethernet(#[fail(cause)] ethernet::errors::Error),
    }

    impl From<ethernet::errors::Error> for Error {
        fn from(v: ethernet::errors::Error) -> Self {
            Error::Ethernet(v)
        }
    }

    unsafe impl Sync for Error {}
    unsafe impl Send for Error {}
}