[−][src]Struct netlink_packet_core::NetlinkMessage
Represent a netlink message.
Fields
header: NetlinkHeader
Message header (this is common to all the netlink protocols)
payload: NetlinkPayload<I>
Inner message, which depends on the netlink protocol being used.
Methods
impl<I> NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
pub fn new(header: NetlinkHeader, payload: NetlinkPayload<I>) -> Self
[src]
Create a new netlink message from the given header and payload
pub fn into_parts(self) -> (NetlinkHeader, NetlinkPayload<I>)
[src]
Consume this message and return its header and payload
impl<I> NetlinkMessage<I> where
I: NetlinkDeserializable<I> + Debug + PartialEq + Eq + Clone,
[src]
I: NetlinkDeserializable<I> + Debug + PartialEq + Eq + Clone,
pub fn deserialize(buffer: &[u8]) -> Result<Self, DecodeError>
[src]
Parse the given buffer as a netlink message
impl<I> NetlinkMessage<I> where
I: NetlinkSerializable<I> + Debug + PartialEq + Eq + Clone,
[src]
I: NetlinkSerializable<I> + Debug + PartialEq + Eq + Clone,
pub fn buffer_len(&self) -> usize
[src]
Return the length of this message in bytes
pub fn serialize(&self, buffer: &mut [u8])
[src]
Serialize this message and write the serialized data into the
given buffer. buffer
must big large enough for the whole
message to fit, otherwise, this method will panic. To know how
big the serialized message is, call buffer_len()
.
Panic
This method panics if the buffer is not big enough.
pub fn finalize(&mut self)
[src]
Ensure the header (NetlinkHeader
) is consistent with the payload (NetlinkPayload
):
- compute the payload length and set the header's length field
- check the payload type and set the header's message type field accordingly
If you are not 100% sure the header is correct, this method should be called before calling
Emitable::emit()
, as it could panic if the header is
inconsistent with the rest of the message.
Trait Implementations
impl<I: Clone> Clone for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
fn clone(&self) -> NetlinkMessage<I>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<I: Debug> Debug for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
impl<I> Emitable for NetlinkMessage<I> where
I: NetlinkSerializable<I> + Debug + PartialEq + Eq + Clone,
[src]
I: NetlinkSerializable<I> + Debug + PartialEq + Eq + Clone,
impl<I: Eq> Eq for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
impl<T> From<T> for NetlinkMessage<T> where
T: Into<NetlinkPayload<T>> + Debug + Clone + Eq + PartialEq,
[src]
T: Into<NetlinkPayload<T>> + Debug + Clone + Eq + PartialEq,
impl<'buffer, B, I> Parseable<NetlinkBuffer<&'buffer B>> for NetlinkMessage<I> where
B: AsRef<[u8]> + 'buffer,
I: Debug + PartialEq + Eq + Clone + NetlinkDeserializable<I>,
[src]
B: AsRef<[u8]> + 'buffer,
I: Debug + PartialEq + Eq + Clone + NetlinkDeserializable<I>,
fn parse(buf: &NetlinkBuffer<&'buffer B>) -> Result<Self, DecodeError>
[src]
impl<I: PartialEq> PartialEq<NetlinkMessage<I>> for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
fn eq(&self, other: &NetlinkMessage<I>) -> bool
[src]
fn ne(&self, other: &NetlinkMessage<I>) -> bool
[src]
impl<I> StructuralEq for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
impl<I> StructuralPartialEq for NetlinkMessage<I> where
I: Debug + PartialEq + Eq + Clone,
[src]
I: Debug + PartialEq + Eq + Clone,
Auto Trait Implementations
impl<I> RefUnwindSafe for NetlinkMessage<I> where
I: RefUnwindSafe,
I: RefUnwindSafe,
impl<I> Send for NetlinkMessage<I> where
I: Send,
I: Send,
impl<I> Sync for NetlinkMessage<I> where
I: Sync,
I: Sync,
impl<I> Unpin for NetlinkMessage<I> where
I: Unpin,
I: Unpin,
impl<I> UnwindSafe for NetlinkMessage<I> where
I: UnwindSafe,
I: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Emitable for T where
T: Nla,
[src]
T: Nla,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,