]>
Commit | Line | Data |
---|---|---|
8f0aff2a | 1 | .\" This manpage copyright 1998 by Andi Kleen. |
2297bf0e | 2 | .\" |
b55e2bb3 | 3 | .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) |
8f0aff2a | 4 | .\" Subject to the GPL. |
b55e2bb3 | 5 | .\" %%%LICENSE_END |
51f2944d | 6 | .\" |
fea681da MK |
7 | .\" Based on the original comments from Alexey Kuznetsov |
8 | .\" $Id: netlink.3,v 1.1 1999/05/14 17:17:24 freitag Exp $ | |
51f2944d | 9 | .\" |
03e78035 | 10 | .TH NETLINK 3 2014-03-20 "GNU" "Linux Programmer's Manual" |
fea681da MK |
11 | .SH NAME |
12 | netlink \- Netlink macros | |
13 | .SH SYNOPSIS | |
14 | .nf | |
fea681da | 15 | .B #include <asm/types.h> |
c13182ef | 16 | .B #include <linux/netlink.h> |
68e4db0a | 17 | .PP |
fea681da | 18 | .BI "int NLMSG_ALIGN(size_t " len ); |
fea681da | 19 | .BI "int NLMSG_LENGTH(size_t " len ); |
fea681da | 20 | .BI "int NLMSG_SPACE(size_t " len ); |
fea681da | 21 | .BI "void *NLMSG_DATA(struct nlmsghdr *" nlh ); |
fea681da | 22 | .BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " len ); |
fea681da | 23 | .BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " len ); |
fea681da MK |
24 | .BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " len ); |
25 | .fi | |
26 | .SH DESCRIPTION | |
bd12ab88 | 27 | .I <linux/netlink.h> |
fea681da | 28 | defines several standard macros to access or create a netlink datagram. |
c13182ef | 29 | They are similar in spirit to the macros defined in |
fea681da | 30 | .BR cmsg (3) |
c13182ef MK |
31 | for auxiliary data. |
32 | The buffer passed to and from a netlink socket should | |
33a0ccb2 | 33 | be accessed using only these macros. |
fea681da | 34 | .TP |
b20979f0 | 35 | .BR NLMSG_ALIGN () |
fea681da MK |
36 | Round the length of a netlink message up to align it properly. |
37 | .TP | |
b20979f0 | 38 | .BR NLMSG_LENGTH () |
50a5a67b | 39 | Given the payload length, |
988db661 | 40 | .IR len , |
50a5a67b | 41 | this macro returns the aligned length to store in the |
f19a0f03 | 42 | .I nlmsg_len |
c13182ef | 43 | field of the |
fea681da | 44 | .IR nlmsghdr . |
fea681da | 45 | .TP |
b20979f0 | 46 | .BR NLMSG_SPACE () |
50a5a67b MK |
47 | Return the number of bytes that a netlink message with payload of |
48 | .I len | |
fea681da MK |
49 | would occupy. |
50 | .TP | |
b20979f0 | 51 | .BR NLMSG_DATA () |
c13182ef | 52 | Return a pointer to the payload associated with the passed |
fea681da MK |
53 | .IR nlmsghdr . |
54 | .TP | |
0e1ad98c | 55 | .\" this is bizarre, maybe the interface should be fixed. |
b20979f0 | 56 | .BR NLMSG_NEXT () |
c13182ef | 57 | Get the next |
fea681da | 58 | .I nlmsghdr |
c13182ef | 59 | in a multipart message. |
b20979f0 MK |
60 | The caller must check if the current |
61 | .I nlmsghdr | |
62 | didn't have the | |
63 | .B NLMSG_DONE | |
5503c85e | 64 | set\(emthis function doesn't return NULL on end. |
c4bb193f MK |
65 | The |
66 | .I len | |
67 | argument is an lvalue containing the remaining length | |
c13182ef | 68 | of the message buffer. |
df8a3cac | 69 | This macro decrements it by the length of the message header. |
fea681da | 70 | .TP |
b20979f0 | 71 | .BR NLMSG_OK () |
6aee2853 MK |
72 | Return true if the netlink message is not truncated and |
73 | is in a form suitable for parsing. | |
fea681da | 74 | .TP |
b20979f0 | 75 | .BR NLMSG_PAYLOAD () |
c13182ef | 76 | Return the length of the payload associated with the |
fea681da | 77 | .IR nlmsghdr . |
d0e4f892 | 78 | .SH CONFORMING TO |
c8f2dd47 | 79 | These macros are nonstandard Linux extensions. |
fea681da | 80 | .SH NOTES |
c13182ef | 81 | It is often better to use netlink via |
f19a0f03 | 82 | .I libnetlink |
3b13618d | 83 | than via the low-level kernel interface. |
47297adb | 84 | .SH SEE ALSO |
03e78035 | 85 | .BR libnetlink (3), |
fea681da | 86 | .BR netlink (7) |