Previous: Constants, Up: Common API [Contents]
The (netlink connection)
module defines the following procedures, used
to connect and communicate with another process or the kernel using a netlink
socket.
Return a bytevector that represents a netlink address. family
should be AF_NETLINK
, pid is the PID of the process with which
to communicate or 0 for the kernel. groups is an integer representing
the set of broadcast groups to which the connection subscribes.
Creates a netlink socket for proto and binds it to addr.
proto is the integer representing the protocol. For instance, rtnetlink
can be selected by usin NETLINK_ROUTE
(defined in
(netlink constant)
).
addr is a bytevector, as returned by get-addr
.
0
]This procedure is a wrapper for connect
that creates a socket for the
rtnetlink protocol, binds it to the kernel and returns it. By passing the
optional groups keyword, you can select broadcast groups to subscribe to.
Closes a netlink socket. The socket cannot be used afterwards.
Send msg (it must be of type message, See Netlink Headers) to addr using sock. If not passed, addr is the address of the kernel.
Receives a message from sock from addr. This procedure is blocking.
If not passed, addr defaults to the address of the kernel. This
procedure returns the message as a bytevector, that you can deserialize with
deserialize
(See Data Types)
Receives one or more messages from sock from addr. this procedure is blocking. If not passed, addr defaults to the address of the kernel. This procedure returns a list of messages that were decoded using decoder.
When the answer has the NLM_F_MULTI
flag, this procedure decodes the next
message, until it receives a NLMSG_DONE
message. It returns the list
of every netlink messages it received, including the NLMSG_DONE
.
Previous: Constants, Up: Common API [Contents]