netlink — Netlink macros
#include <asm/types.h> #include <linux/netlink.h>
int
NLMSG_ALIGN( |
size_t | len); |
int
NLMSG_LENGTH( |
size_t | len); |
int
NLMSG_SPACE( |
size_t | len); |
void
*NLMSG_DATA( |
struct nlmsghdr * | nlh); |
struct nlmsghdr *NLMSG_NEXT( |
struct nlmsghdr * | nlh, |
| int | len); |
int
NLMSG_OK( |
struct nlmsghdr * | nlh, |
| int | len); |
int
NLMSG_PAYLOAD( |
struct nlmsghdr * | nlh, |
| int | len); |
<linux/netlink.h> defines several standard macros to
access or create a netlink datagram. They are similar in
spirit to the macros defined in cmsg(3) for auxiliary data.
The buffer passed to and from a netlink socket should only be
accessed using these macros.
NLMSG_ALIGNRound the length of a netlink message up to align it properly.
NLMSG_LENGTHGiven the payload length, len, this macro returns
the aligned length to store in the nlmsg_len field of the
nlmsghdr.
NLMSG_SPACEReturn the number of bytes that a netlink message
with payload of len would occupy.
NLMSG_DATAReturn a pointer to the payload associated with the
passed nlmsghdr.
NLMSG_NEXTGet the next nlmsghdr in a multipart
message. The caller must check if the current nlmsghdr
didn't have the NLMSG_DONE set — this function
doesn't return NULL on end. The length parameter is an
lvalue containing the remaining length of the message
buffer. This macro decrements it by the length of the
message header.
NLMSG_OKReturn true if the netlink message is not truncated and ok to parse.
NLMSG_PAYLOADReturn the length of the payload associated with the
nlmsghdr.