GenericNetlinkFamily

Trait GenericNetlinkFamily 

Source
pub trait GenericNetlinkFamily<S>: Send + Sync {
    // Required methods
    fn name(&self) -> String;
    fn stream_multicast_messages<'life0, 'async_trait>(
        &'life0 self,
        group: String,
        assigned_family_id: u16,
        message_sink: UnboundedSender<NetlinkMessage<GenericMessage>>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        netlink_header: NetlinkHeader,
        payload: Vec<u8>,
        sender: &'life1 mut S,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn multicast_groups(&self) -> Vec<String> { ... }
}

Required Methods§

Source

fn name(&self) -> String

Return the unique name for this generic netlink protocol.

This name is used by the ctrl server to identify this server for clients.

Source

fn stream_multicast_messages<'life0, 'async_trait>( &'life0 self, group: String, assigned_family_id: u16, message_sink: UnboundedSender<NetlinkMessage<GenericMessage>>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a future that pipes messages for the given multicast group into the given sink. The parent of this server is responsible for managing multicast group memberships and routing these messages appropriately. The assigned family id of this multicast group is passed in to be used appropriately when constructing messages.

Source

fn handle_message<'life0, 'life1, 'async_trait>( &'life0 self, netlink_header: NetlinkHeader, payload: Vec<u8>, sender: &'life1 mut S, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a netlink message targeted to this server.

The given payload contains the generic netlink header and all subsequent data. Protocol servers should implement their own generic netlink families and deserialize messages using GenlMessage::<_>::deserialize.

Provided Methods§

Source

fn multicast_groups(&self) -> Vec<String>

Return the multicast groups that are supported by this protocol family.

Each multicast group is assigned a unique ID by the ctrl server.

Implementors§