NAME
netlink - Netlink macros SYNOPSIS
#include
#include
int NLMSGALIGN(sizet len); int NLMSGLENGTH(sizet len); int NLMSGSPACE(sizet len); void *NLMSGDATA(struct nlmsghdr *nlh); struct nlmsghdr *NLMSGNEXT(struct nlmsghdr *nlh, int len); int NLMSGOK(struct nlmsghdr *nlh, int len); int NLMSGPAYLOAD(struct nlmsghdr *nlh, int len); DESCRIPTION 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 be accessed using only these macros. NLMSGALIGN() Round the length of a netlink message up to align it properly. NLMSGLENGTH() Given the payload length, len, this macro returns the aligned length to store in the nlmsglen field of the nlmsghdr. NLMSGSPACE() Return the number of bytes that a netlink message with payload of len would occupy. NLMSGDATA() Return a pointer to the payload associated with the passed nlms‐ ghdr. NLMSGNEXT() Get the next nlmsghdr in a multipart message. The caller must check if the current nlmsghdr didn't have the NLMSGDONE set— this function doesn't return NULL on end. The len argument is an lvalue containing the remaining length of the message buffer. This macro decrements it by the length of the message header. NLMSGOK() Return true if the netlink message is not truncated and is in a form suitable for parsing. NLMSGPAYLOAD() Return the length of the payload associated with the nlmsghdr. CONFORMING TO These macros are nonstandard Linux extensions. NOTES It is often better to use netlink via libnetlink than via the low-level kernel interface. SEE ALSO netlink(7)
⟨ftp://ftp.inr.ac.ru/ip-routing/iproute2*⟩ for libnetlink COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2012-08-05 NETLINK(3)