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