]>
Commit | Line | Data |
---|---|---|
fea681da MK |
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 | |
a749f870 | 9 | .\" FIXME what will glibc 2.1 use here? |
fea681da MK |
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 | |
bd12ab88 | 29 | .I <linux/netlink.h> |
fea681da MK |
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 | |
fea681da MK |
36 | NLMSG_ALIGN |
37 | Round the length of a netlink message up to align it properly. | |
38 | .TP | |
39 | NLMSG_LENGTH | |
40 | Gets the payload length as argument and returns the aligned length to store | |
41 | in the | |
42 | .B nlmsg_len | |
43 | field of the | |
44 | .IR nlmsghdr . | |
fea681da MK |
45 | .TP |
46 | NLMSG_SPACE | |
47 | Return the number of bytes a netlink message with payload of the passed length | |
48 | would occupy. | |
49 | .TP | |
50 | NLMSG_DATA | |
51 | Return a pointer to the payload associated with the passed | |
52 | .IR nlmsghdr . | |
53 | .TP | |
a749f870 | 54 | .\" FIXME this is bizarre, maybe the interface should be fixed. |
fea681da MK |
55 | NLMSG_NEXT |
56 | Get the next | |
57 | .I nlmsghdr | |
df8a3cac MK |
58 | in a multipart message. |
59 | The caller must check if the current nlmsghdr didn't have the NLMSG_DONE | |
60 | set \(em this function doesn't return NULL on end. | |
61 | The length parameter is an lvalue containing the remaining length | |
62 | of the message buffer. | |
63 | This macro decrements it by the length of the message header. | |
fea681da MK |
64 | .TP |
65 | NLMSG_OK | |
66 | Return true if the netlink message is not truncated and ok to parse. | |
67 | .TP | |
68 | NLMSG_PAYLOAD | |
69 | Return the length of the payload associated with the | |
70 | .IR nlmsghdr . | |
fea681da MK |
71 | .SH NOTES |
72 | It is often better to use netlink via | |
73 | .B libnetlink | |
74 | than via the low level kernel interface. | |
fea681da MK |
75 | .SH "SEE ALSO" |
76 | .BR netlink (7) | |
77 | .PP | |
78 | and ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink |