1NETLINK(3)                 Linux Programmer's Manual                NETLINK(3)
2
3
4

NAME

6       netlink - Netlink macros
7

SYNOPSIS

9       #include <asm/types.h>
10       #include <linux/netlink.h>
11
12       int NLMSG_ALIGN(size_t len);
13       int NLMSG_LENGTH(size_t len);
14       int NLMSG_SPACE(size_t len);
15       void *NLMSG_DATA(struct nlmsghdr *nlh);
16       struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *nlh, int len);
17       int NLMSG_OK(struct nlmsghdr *nlh, int len);
18       int NLMSG_PAYLOAD(struct nlmsghdr *nlh, int len);
19

DESCRIPTION

21       <linux/netlink.h> defines several standard macros to access or create a
22       netlink datagram.  They are similar in spirit to the macros defined  in
23       cmsg(3)  for  auxiliary  data.  The buffer passed to and from a netlink
24       socket should only be accessed using these macros.
25
26       NLMSG_ALIGN()
27              Round the length of a netlink message up to align it properly.
28
29       NLMSG_LENGTH()
30              Given the payload length, len, this macro  returns  the  aligned
31              length to store in the nlmsg_len field of the nlmsghdr.
32
33       NLMSG_SPACE()
34              Return  the  number of bytes that a netlink message with payload
35              of len would occupy.
36
37       NLMSG_DATA()
38              Return a pointer to the payload associated with the passed nlms‐
39              ghdr.
40
41       NLMSG_NEXT()
42              Get  the  next nlmsghdr in a multipart message.  The caller must
43              check if the current nlmsghdr didn't have the NLMSG_DONE  set  —
44              this  function  doesn't return NULL on end.  The len argument is
45              an lvalue containing the remaining length of the message buffer.
46              This macro decrements it by the length of the message header.
47
48       NLMSG_OK()
49              Return  true  if  the netlink message is not truncated and ok to
50              parse.
51
52       NLMSG_PAYLOAD()
53              Return the length of the payload associated with the nlmsghdr.
54

CONFORMING TO

56       These macros are non-standard Linux extensions.
57

NOTES

59       It is often better to use netlink via libnetlink than via the low-level
60       kernel interface.
61

SEE ALSO

63       netlink(7)
64       and ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink
65

COLOPHON

67       This  page  is  part of release 3.22 of the Linux man-pages project.  A
68       description of the project, and information about reporting  bugs,  can
69       be found at http://www.kernel.org/doc/man-pages/.
70
71
72
73GNU                               1999-05-14                        NETLINK(3)
Impressum