Struct neli::socket::NlSocketHandle

source ·
pub struct NlSocketHandle { /* private fields */ }
Expand description

Higher level handle for socket operations.

Implementations§

Wrapper around socket() syscall filling in the netlink-specific information

Equivalent of socket and bind calls.

Set underlying socket file descriptor to be blocking.

Set underlying socket file descriptor to be non blocking.

Determines if underlying file descriptor is blocking.

Use this function to bind to a netlink ID and subscribe to groups. See netlink(7) man pages for more information on netlink IDs and groups.

Join multicast groups for a socket.

Leave multicast groups for a socket.

List joined groups for a socket.

Get the PID for the current socket.

Convenience function for resolving a str containing the generic netlink family name to a numeric generic netlink ID.

Convenience function for resolving a str containing the multicast group name to a numeric multicast group ID.

Look up netlink family and multicast group name by ID.

Convenience function to send an Nlmsghdr struct

Convenience function to read a stream of Nlmsghdr structs one by one. Use NlSocketHandle::iter instead for easy iteration over returned packets.

Returns None only in non-blocking contexts if no message can be immediately returned or if the socket has been closed.

Parse all Nlmsghdr structs sent in one network packet and return them all in a list.

Failure to parse any packet will cause the entire operation to fail. If an error is detected at the application level, this method will discard any non-error Nlmsghdr structs and only return the error. This method checks for ACKs. For a more granular approach, use either NlSocketHandle::recv or NlSocketHandle::iter.

Return an iterator object

The argument iterate_indefinitely is documented in more detail in NlMessageIter

Trait Implementations§

Extracts the raw file descriptor. Read more
Converts to this type from the input type.
Constructs a new instance of Self from the given raw file descriptor. Read more
Consumes this object, returning the raw underlying file descriptor. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.