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