pub unsafe trait NlMsg {
// Required method
unsafe fn write(&self, buf: *mut c_void, seq: u32, msg_type: MsgType);
}Expand description
Trait for all types in this crate that can serialize to a Netlink message.
§Safety
This trait is unsafe to implement because it must never serialize to anything larger than the
largest possible netlink message. Internally the nft_nlmsg_maxsize function is used to make
sure the buf pointer passed to write always has room for the largest possible Netlink
message.
Required Methods§
Sourceunsafe fn write(&self, buf: *mut c_void, seq: u32, msg_type: MsgType)
unsafe fn write(&self, buf: *mut c_void, seq: u32, msg_type: MsgType)
Serializes the Netlink message to the buffer at buf. buf must have space for at least
nft_nlmsg_maxsize() bytes. This is not checked by the compiler, which is why this method
is unsafe.
§Safety
The caller must pass a buf with enough space for the largest possible netlink message.
This size can be obtained with nft_nlmsg_maxsize.