OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / 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 "GNU" "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 .\" May 2007: glibc 2.5, things look to be unchanged -- the header file
11 .\" is still linux/netlink.h -- mtk
12 .B #include <asm/types.h>
13 .br
14 .B #include <linux/netlink.h>
15 .sp
16 .BI "int NLMSG_ALIGN(size_t " len );
17 .br
18 .BI "int NLMSG_LENGTH(size_t " len );
19 .br
20 .BI "int NLMSG_SPACE(size_t " len );
21 .br
22 .BI "void *NLMSG_DATA(struct nlmsghdr *" nlh );
23 .br
24 .BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " len );
25 .br
26 .BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " len );
27 .br
28 .BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " len );
29 .fi
30 .SH DESCRIPTION
31 .I <linux/netlink.h>
32 defines several standard macros to access or create a netlink datagram.
33 They are similar in spirit to the macros defined in
34 .BR cmsg (3)
35 for auxiliary data.
36 The buffer passed to and from a netlink socket should
37 only be accessed using these macros.
38 .TP
39 .BR NLMSG_ALIGN ()
40 Round the length of a netlink message up to align it properly.
41 .TP
42 .BR NLMSG_LENGTH ()
43 Given the payload length,
44 .IR len ,
45 this macro returns the aligned length to store in the
46 .I nlmsg_len
47 field of the
48 .IR nlmsghdr .
49 .TP
50 .BR NLMSG_SPACE ()
51 Return the number of bytes that a netlink message with payload of
52 .I len
53 would occupy.
54 .TP
55 .BR NLMSG_DATA ()
56 Return a pointer to the payload associated with the passed
57 .IR nlmsghdr .
58 .TP
59 .\" this is bizarre, maybe the interface should be fixed.
60 .BR NLMSG_NEXT ()
61 Get the next
62 .I nlmsghdr
63 in a multipart message.
64 The caller must check if the current
65 .I nlmsghdr
66 didn't have the
67 .B NLMSG_DONE
68 set \(em this function doesn't return NULL on end.
69 The
70 .I len
71 argument is an lvalue containing the remaining length
72 of the message buffer.
73 This macro decrements it by the length of the message header.
74 .TP
75 .BR NLMSG_OK ()
76 Return true if the netlink message is not truncated and ok to parse.
77 .TP
78 .BR NLMSG_PAYLOAD ()
79 Return the length of the payload associated with the
80 .IR nlmsghdr .
81 .SH CONFORMING TO
82 These macros are nonstandard Linux extensions.
83 .SH NOTES
84 It is often better to use netlink via
85 .I libnetlink
86 than via the low-level kernel interface.
87 .SH "SEE ALSO"
88 .BR netlink (7)
89 .br
90 and ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink