154 lines
3.8 KiB
HTML
154 lines
3.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of NETLINK</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>NETLINK</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2014-03-20<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
netlink - Netlink macros
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/asm/types.h">asm/types.h</A>></B>
|
|
<B>#include <<A HREF="file:///usr/include/linux/netlink.h">linux/netlink.h</A>></B>
|
|
|
|
<B>int NLMSG_ALIGN(size_t </B><I>len</I><B>);</B>
|
|
<B>int NLMSG_LENGTH(size_t </B><I>len</I><B>);</B>
|
|
<B>int NLMSG_SPACE(size_t </B><I>len</I><B>);</B>
|
|
<B>void *NLMSG_DATA(struct nlmsghdr *</B><I>nlh</I><B>);</B>
|
|
<B>struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *</B><I>nlh</I><B>, int </B><I>len</I><B>);</B>
|
|
<B>int NLMSG_OK(struct nlmsghdr *</B><I>nlh</I><B>, int </B><I>len</I><B>);</B>
|
|
<B>int NLMSG_PAYLOAD(struct nlmsghdr *</B><I>nlh</I><B>, int </B><I>len</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<I><<A HREF="file:///usr/include/linux/netlink.h">linux/netlink.h</A>></I>
|
|
|
|
defines several standard macros to access or create a netlink datagram.
|
|
They are similar in spirit to the macros defined in
|
|
<B><A HREF="/cgi-bin/man/man2html?3+cmsg">cmsg</A></B>(3)
|
|
|
|
for auxiliary data.
|
|
The buffer passed to and from a netlink socket should
|
|
be accessed using only these macros.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>NLMSG_ALIGN</B>()
|
|
|
|
<DD>
|
|
Round the length of a netlink message up to align it properly.
|
|
<DT id="2"><B>NLMSG_LENGTH</B>()
|
|
|
|
<DD>
|
|
Given the payload length,
|
|
<I>len</I>,
|
|
|
|
this macro returns the aligned length to store in the
|
|
<I>nlmsg_len</I>
|
|
|
|
field of the
|
|
<I>nlmsghdr</I>.
|
|
|
|
<DT id="3"><B>NLMSG_SPACE</B>()
|
|
|
|
<DD>
|
|
Return the number of bytes that a netlink message with payload of
|
|
<I>len</I>
|
|
|
|
would occupy.
|
|
<DT id="4"><B>NLMSG_DATA</B>()
|
|
|
|
<DD>
|
|
Return a pointer to the payload associated with the passed
|
|
<I>nlmsghdr</I>.
|
|
|
|
<DT id="5">
|
|
<DD>
|
|
<B>NLMSG_NEXT</B>()
|
|
|
|
Get the next
|
|
<I>nlmsghdr</I>
|
|
|
|
in a multipart message.
|
|
The caller must check if the current
|
|
<I>nlmsghdr</I>
|
|
|
|
didn't have the
|
|
<B>NLMSG_DONE</B>
|
|
|
|
set---this function doesn't return NULL on end.
|
|
The
|
|
<I>len</I>
|
|
|
|
argument is an lvalue containing the remaining length
|
|
of the message buffer.
|
|
This macro decrements it by the length of the message header.
|
|
<DT id="6"><B>NLMSG_OK</B>()
|
|
|
|
<DD>
|
|
Return true if the netlink message is not truncated and
|
|
is in a form suitable for parsing.
|
|
<DT id="7"><B>NLMSG_PAYLOAD</B>()
|
|
|
|
<DD>
|
|
Return the length of the payload associated with the
|
|
<I>nlmsghdr</I>.
|
|
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
These macros are nonstandard Linux extensions.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
It is often better to use netlink via
|
|
<I>libnetlink</I>
|
|
|
|
than via the low-level kernel interface.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+libnetlink">libnetlink</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+netlink">netlink</A></B>(7)
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="11"><A HREF="#lbAE">CONFORMING TO</A><DD>
|
|
<DT id="12"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DT id="13"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
<DT id="14"><A HREF="#lbAH">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:49 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|