Struct genetlink::GenetlinkHandle[][src]

pub struct GenetlinkHandle { /* fields omitted */ }
Expand description

The generic netlink connection handle

The handle is used to send messages to the connection. It also resolves the family id automatically before sending messages.

Family id resolving

There is a resolver with cache inside each connection. When you send generic netlink message, the handle resolves and fills the family id into the message.

Since the resolver is created in new_connection(), the cache state wouldn’t share between different connections.

P.s. The cloned handles use the same connection with the original handle. So, they share the same cache state.

Detailed process of sending generic messages

  1. Check if the message’s family id is resolved. If yes, jump to step 6.
  2. Query the family id using the builtin resolver.
  3. If the id is in the cache, returning the id in the cache and skip step 4.
  4. The resolver sends CTRL_CMD_GETFAMILY request to get the id and records it in the cache.
  5. fill the family id using GenlMessage::set_resolved_family_id().
  6. Serialize the payload to RawGenlMessage.
  7. Send it through the connection.
  8. In the response stream, deserialize the payload back to GenlMessage<F>.

Implementations

Resolve the family id of the given GenlFamily.

Clear the resolver’s fanily id cache

Send the generic netlink message and get the response stream

The function resolves the family id before sending the request. If the resolving process is failed, the function would return an error.

Send the request without resolving family id

This function is identical to request() but it doesn’t resolve the family id for you.

Send the generic netlink message without returning the response stream

Send the notify without resolving family id

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.