pub struct NetlinkMessage {
pub header: NetlinkHeader,
pub payload: Vec<u8>,
}Expand description
Complete netlink message (header + payload)
Fields§
§header: NetlinkHeaderMessage header
payload: Vec<u8>Variable-length payload
Implementations§
Source§impl NetlinkMessage
impl NetlinkMessage
Sourcepub fn new(msg_type: NetlinkMessageType, flags: u16, seq: u32, pid: u32) -> Self
pub fn new(msg_type: NetlinkMessageType, flags: u16, seq: u32, pid: u32) -> Self
Create a new message with empty payload
Sourcepub fn set_payload(&mut self, data: &[u8]) -> Result<(), KernelError>
pub fn set_payload(&mut self, data: &[u8]) -> Result<(), KernelError>
Set payload from bytes
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Total serialized size
Sourcepub fn serialize(&self) -> Result<Vec<u8>, KernelError>
pub fn serialize(&self) -> Result<Vec<u8>, KernelError>
Serialize the complete message to bytes
Sourcepub fn deserialize(buf: &[u8]) -> Result<Self, KernelError>
pub fn deserialize(buf: &[u8]) -> Result<Self, KernelError>
Deserialize a complete message from bytes
Trait Implementations§
Source§impl Clone for NetlinkMessage
impl Clone for NetlinkMessage
Source§fn clone(&self) -> NetlinkMessage
fn clone(&self) -> NetlinkMessage
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NetlinkMessage
impl RefUnwindSafe for NetlinkMessage
impl Send for NetlinkMessage
impl Sync for NetlinkMessage
impl Unpin for NetlinkMessage
impl UnwindSafe for NetlinkMessage
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)