man-pages/man3/netlink.3

86 lines
2.4 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" This manpage copyright 1998 by Andi Kleen. Subject to the GPL.
.\" Based on the original comments from Alexey Kuznetsov
.\" $Id: netlink.3,v 1.1 1999/05/14 17:17:24 freitag Exp $
2007-05-18 09:55:10 +00:00
.TH NETLINK 3 1999-05-14 "GNU" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
netlink \- Netlink macros
.SH SYNOPSIS
.nf
2007-06-13 21:48:16 +00:00
.\" FIXME . what will glibc 2.1 use here?
2007-06-21 22:55:04 +00:00
.\" May 2007: glibc 2.5, things look to be unchanged -- the header file
2007-05-21 10:01:48 +00:00
.\" is still linux/netlink.h -- mtk
2004-11-03 13:51:07 +00:00
.B #include <asm/types.h>
.br
.B #include <linux/netlink.h>
2004-11-03 13:51:07 +00:00
.br
.BI "int NLMSG_ALIGN(size_t " len );
.br
2004-11-03 13:51:07 +00:00
.BI "int NLMSG_LENGTH(size_t " len );
.br
.BI "int NLMSG_SPACE(size_t " len );
.br
.BI "void *NLMSG_DATA(struct nlmsghdr *" nlh );
.br
.BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " len );
.br
.BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " len );
.br
.BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " len );
.fi
.SH DESCRIPTION
2005-11-03 12:47:27 +00:00
.I <linux/netlink.h>
2004-11-03 13:51:07 +00:00
defines several standard macros to access or create a netlink datagram.
They are similar in spirit to the macros defined in
2004-11-03 13:51:07 +00:00
.BR cmsg (3)
for auxiliary data.
The buffer passed to and from a netlink socket should
only be accessed using these macros.
2004-11-03 13:51:07 +00:00
.TP
NLMSG_ALIGN
Round the length of a netlink message up to align it properly.
.TP
NLMSG_LENGTH
Given the payload length,
2007-06-21 22:55:04 +00:00
.IR len ,
this macro returns the aligned length to store in the
2007-06-23 07:56:56 +00:00
.I nlmsg_len
field of the
2004-11-03 13:51:07 +00:00
.IR nlmsghdr .
.TP
NLMSG_SPACE
Return the number of bytes that a netlink message with payload of
.I len
2004-11-03 13:51:07 +00:00
would occupy.
.TP
NLMSG_DATA
Return a pointer to the payload associated with the passed
2004-11-03 13:51:07 +00:00
.IR nlmsghdr .
.TP
2007-06-13 21:48:16 +00:00
.\" this is bizarre, maybe the interface should be fixed.
2004-11-03 13:51:07 +00:00
NLMSG_NEXT
Get the next
2004-11-03 13:51:07 +00:00
.I nlmsghdr
in a multipart message.
The caller must check if the current nlmsghdr didn't have the NLMSG_DONE
set \(em this function doesn't return NULL on end.
The length parameter is an lvalue containing the remaining length
of the message buffer.
2005-07-18 12:43:00 +00:00
This macro decrements it by the length of the message header.
2004-11-03 13:51:07 +00:00
.TP
NLMSG_OK
Return true if the netlink message is not truncated and ok to parse.
2004-11-03 13:51:07 +00:00
.TP
NLMSG_PAYLOAD
Return the length of the payload associated with the
2004-11-03 13:51:07 +00:00
.IR nlmsghdr .
2007-07-18 20:25:14 +00:00
.SH CONFORMING TO
These macros are non-standard Linux extensions.
2004-11-03 13:51:07 +00:00
.SH NOTES
It is often better to use netlink via
2007-06-23 07:56:56 +00:00
.I libnetlink
2007-06-23 08:22:53 +00:00
than via the low-level kernel interface.
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR netlink (7)
.PP
and ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink