use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};
pub const RTM_NEWNSID: u16 = 88;
pub const RTM_DELNSID: u16 = 89;
pub const RTM_GETNSID: u16 = 90;
pub mod netnsa {
pub const UNSPEC: u16 = 0;
pub const NSID: u16 = 1;
pub const PID: u16 = 2;
pub const FD: u16 = 3;
pub const TARGET_NSID: u16 = 4;
pub const CURRENT_NSID: u16 = 5;
}
pub const RTNLGRP_NSID: u32 = 28;
#[repr(C)]
#[derive(Debug, Clone, Copy, Default, FromBytes, IntoBytes, Immutable, KnownLayout)]
pub struct RtGenMsg {
pub rtgen_family: u8,
}
impl RtGenMsg {
pub fn new() -> Self {
Self::default()
}
pub fn with_family(family: u8) -> Self {
Self {
rtgen_family: family,
}
}
pub fn as_bytes(&self) -> &[u8] {
<Self as IntoBytes>::as_bytes(self)
}
pub fn from_bytes(data: &[u8]) -> Option<&Self> {
Self::ref_from_prefix(data).map(|(r, _)| r).ok()
}
pub const fn padded_size() -> usize {
4 }
}