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