pub fn new_connection<T>(
protocol: isize,
) -> Result<(Connection<T>, ConnectionHandle<T>, UnboundedReceiver<(NetlinkMessage<T>, SocketAddr)>)>Expand description
Create a new Netlink connection for the given Netlink protocol, and returns
a handle to that connection as well as a stream of unsolicited messages
received by that connection (unsolicited here means messages that are not a
response to a request made by the Connection). Connection<T> wraps a
Netlink socket and implements the Netlink protocol.
protocol must be one of the crate::sys::protocols constants.
T is the type of netlink messages used for this protocol. For instance, if
you’re using the NETLINK_AUDIT protocol with the netlink-packet-audit
crate, T will be netlink_packet_audit::AuditMessage. More generally, T
is anything that can be serialized and deserialized into a Netlink message.
See the netlink_packet_core documentation for details about the
NetlinkSerializable and NetlinkDeserializable traits.
Most of the time, users will want to spawn the Connection on an async
runtime, and use the handle to send messages.