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