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