OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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 .br
17 .B #include <linux/netlink.h>
18 .sp
19 .BI "int NLMSG_ALIGN(size_t " len );
20 .br
21 .BI "int NLMSG_LENGTH(size_t " len );
22 .br
23 .BI "int NLMSG_SPACE(size_t " len );
24 .br
25 .BI "void *NLMSG_DATA(struct nlmsghdr *" nlh );
26 .br
27 .BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " len );
28 .br
29 .BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " len );
30 .br
31 .BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " len );
32 .fi
33 .SH DESCRIPTION
34 .I <linux/netlink.h>
35 defines several standard macros to access or create a netlink datagram.
36 They are similar in spirit to the macros defined in
37 .BR cmsg (3)
38 for auxiliary data.
39 The buffer passed to and from a netlink socket should
40 be accessed using only these macros.
41 .TP
42 .BR NLMSG_ALIGN ()
43 Round the length of a netlink message up to align it properly.
44 .TP
45 .BR NLMSG_LENGTH ()
46 Given the payload length,
47 .IR len ,
48 this macro returns the aligned length to store in the
49 .I nlmsg_len
50 field of the
51 .IR nlmsghdr .
52 .TP
53 .BR NLMSG_SPACE ()
54 Return the number of bytes that a netlink message with payload of
55 .I len
56 would occupy.
57 .TP
58 .BR NLMSG_DATA ()
59 Return a pointer to the payload associated with the passed
60 .IR nlmsghdr .
61 .TP
62 .\" this is bizarre, maybe the interface should be fixed.
63 .BR NLMSG_NEXT ()
64 Get the next
65 .I nlmsghdr
66 in a multipart message.
67 The caller must check if the current
68 .I nlmsghdr
69 didn't have the
70 .B NLMSG_DONE
71 set\(emthis function doesn't return NULL on end.
72 The
73 .I len
74 argument is an lvalue containing the remaining length
75 of the message buffer.
76 This macro decrements it by the length of the message header.
77 .TP
78 .BR NLMSG_OK ()
79 Return true if the netlink message is not truncated and
80 is in a form suitable for parsing.
81 .TP
82 .BR NLMSG_PAYLOAD ()
83 Return the length of the payload associated with the
84 .IR nlmsghdr .
85 .SH CONFORMING TO
86 These macros are nonstandard Linux extensions.
87 .SH NOTES
88 It is often better to use netlink via
89 .I libnetlink
90 than via the low-level kernel interface.
91 .SH SEE ALSO
92 .BR libnetlink (3),
93 .BR netlink (7)
94 .SH COLOPHON
95 This page is part of release 3.79 of the Linux
96 .I man-pages
97 project.
98 A description of the project,
99 information about reporting bugs,
100 and the latest version of this page,
101 can be found at
102 \%http://www.kernel.org/doc/man\-pages/.