aboutsummaryrefslogblamecommitdiffstats
path: root/src/wireguard/router/ip.rs
blob: e66144fb37e8028d7c5b36bf8cef63d66da12b4b (plain) (tree)
1
2
3
4
5
6
7

                             
                                   



                              












                                          
                       




                                
use byteorder::BigEndian;
use zerocopy::byteorder::U16;
use zerocopy::{AsBytes, FromBytes};

pub const VERSION_IP4: u8 = 4;
pub const VERSION_IP6: u8 = 6;

#[repr(packed)]
#[derive(Copy, Clone, FromBytes, AsBytes)]
pub struct IPv4Header {
    _f_space1: [u8; 2],
    pub f_total_len: U16<BigEndian>,
    _f_space2: [u8; 8],
    pub f_source: [u8; 4],
    pub f_destination: [u8; 4],
}

#[repr(packed)]
#[derive(Copy, Clone, FromBytes, AsBytes)]
pub struct IPv6Header {
    _f_space1: [u8; 4],
    pub f_len: U16<BigEndian>,
    _f_space2: [u8; 2],
    pub f_source: [u8; 16],
    pub f_destination: [u8; 16],
}