]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/netlink.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / netlink.3
CommitLineData
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
12netlink \- 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 28defines several standard macros to access or create a netlink datagram.
c13182ef 29They are similar in spirit to the macros defined in
fea681da 30.BR cmsg (3)
c13182ef
MK
31for auxiliary data.
32The buffer passed to and from a netlink socket should
33a0ccb2 33be accessed using only these macros.
fea681da 34.TP
b20979f0 35.BR NLMSG_ALIGN ()
fea681da
MK
36Round the length of a netlink message up to align it properly.
37.TP
b20979f0 38.BR NLMSG_LENGTH ()
50a5a67b 39Given the payload length,
988db661 40.IR len ,
50a5a67b 41this macro returns the aligned length to store in the
f19a0f03 42.I nlmsg_len
c13182ef 43field of the
fea681da 44.IR nlmsghdr .
fea681da 45.TP
b20979f0 46.BR NLMSG_SPACE ()
50a5a67b
MK
47Return the number of bytes that a netlink message with payload of
48.I len
fea681da
MK
49would occupy.
50.TP
b20979f0 51.BR NLMSG_DATA ()
c13182ef 52Return 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 57Get the next
fea681da 58.I nlmsghdr
c13182ef 59in a multipart message.
b20979f0
MK
60The caller must check if the current
61.I nlmsghdr
62didn't have the
63.B NLMSG_DONE
5503c85e 64set\(emthis function doesn't return NULL on end.
c4bb193f
MK
65The
66.I len
67argument is an lvalue containing the remaining length
c13182ef 68of the message buffer.
df8a3cac 69This macro decrements it by the length of the message header.
fea681da 70.TP
b20979f0 71.BR NLMSG_OK ()
6aee2853
MK
72Return true if the netlink message is not truncated and
73is in a form suitable for parsing.
fea681da 74.TP
b20979f0 75.BR NLMSG_PAYLOAD ()
c13182ef 76Return the length of the payload associated with the
fea681da 77.IR nlmsghdr .
d0e4f892 78.SH CONFORMING TO
c8f2dd47 79These macros are nonstandard Linux extensions.
fea681da 80.SH NOTES
c13182ef 81It is often better to use netlink via
f19a0f03 82.I libnetlink
3b13618d 83than via the low-level kernel interface.
47297adb 84.SH SEE ALSO
03e78035 85.BR libnetlink (3),
fea681da 86.BR netlink (7)