Struct netlink_packet_generic::message::GenlMessage [−][src]
pub struct GenlMessage<F> {
pub header: GenlHeader,
pub payload: F,
// some fields omitted
}
Expand description
Represent the generic netlink messages
This type can wrap data types F
which represents a generic family payload.
The message can be serialize/deserialize if the type F
implements GenlFamily
,
Emitable
, and ParseableParametrized<[u8], GenlHeader>
.
Fields
header: GenlHeader
payload: F
Implementations
Construct the message
Construct the message by the given header and payload
Consume this message and return its header and payload
Return the previously set resolved family ID in this message.
This value would be used to serialize the message only if
the (GenlFamily::family_id()
) return 0 in the underlying type.
Set the resolved dynamic family ID of the message, if the generic family uses dynamic generated ID by kernel.
This method is a interface to provide other high level library to set the resolved family ID before the message is serialized.
Usage
Normally, you don’t have to call this function directly if you are using library which helps you handle the dynamic family id.
If you are the developer of some high level generic netlink library,
you can call this method to set the family id resolved by your resolver.
Without having to modify the message_type
field of the serialized
netlink packet header before sending it.
Build the message from the payload
This function would automatically fill the header for you. You can directly emit
the message without having to call finalize()
.
Ensure the header (GenlHeader
) is consistent with the payload (F: GenlFamily
):
- Fill the command and version number into the header
If you are not 100% sure the header is correct, this method should be called before calling
Emitable::emit()
, as it could get error result if the header is inconsistent with the message.
Return the resolved family ID which should be filled into the message_type
field in NetlinkHeader
.
The implementation of NetlinkSerializable::message_type()
would use
this function’s result as its the return value. Thus, the family id can
be automatically filled into the message_type
during the call to
NetlinkMessage::finalize()
.
Trait Implementations
Performs the conversion.
impl<F> NetlinkDeserializable for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
impl<F> NetlinkDeserializable for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
type Error = DecodeError
Deserialize the given buffer into Self
.
Return the length of the serialized data. Read more
Serialize this types and write the serialized data into the given buffer.
buffer
’s length is exactly InnerMessage::buffer_len()
.
It means that if InnerMessage::buffer_len()
is buggy and does not return the appropriate length,
bad things can happen: Read more
impl<F> ParseableParametrized<[u8], u16> for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
impl<F> ParseableParametrized<[u8], u16> for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
Deserialize the current type.
impl<'a, F, T> ParseableParametrized<GenlBuffer<&'a T>, u16> for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
T: AsRef<[u8]> + ?Sized,
impl<'a, F, T> ParseableParametrized<GenlBuffer<&'a T>, u16> for GenlMessage<F> where
F: ParseableParametrized<[u8], GenlHeader> + Debug,
T: AsRef<[u8]> + ?Sized,
Deserialize the current type.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<F> RefUnwindSafe for GenlMessage<F> where
F: RefUnwindSafe,
impl<F> Send for GenlMessage<F> where
F: Send,
impl<F> Sync for GenlMessage<F> where
F: Sync,
impl<F> Unpin for GenlMessage<F> where
F: Unpin,
impl<F> UnwindSafe for GenlMessage<F> where
F: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more