| .\" 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 $ |
| .TH NETLINK 3 1999-05-14 "Linux Man Page" "Linux Programmer's Manual" |
| .SH NAME |
| netlink \- Netlink macros |
| .SH SYNOPSIS |
| .nf |
| .\" FIXME what will glibc 2.1 use here? |
| .B #include <asm/types.h> |
| .br |
| .B #include <linux/netlink.h> |
| .br |
| .BI "int NLMSG_ALIGN(size_t " len ); |
| .br |
| .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 |
| .I <linux/netlink.h> |
| defines several standard macros to access or create a netlink datagram. |
| They are similar in spirit to the macros defined in |
| .BR cmsg (3) |
| for auxiliary data. The buffer passed to and from a netlink socket should |
| be only accessed using these macros. |
| .TP |
| .TP |
| NLMSG_ALIGN |
| Round the length of a netlink message up to align it properly. |
| .TP |
| NLMSG_LENGTH |
| Gets the payload length as argument and returns the aligned length to store |
| in the |
| .B nlmsg_len |
| field of the |
| .IR nlmsghdr . |
| |
| .TP |
| NLMSG_SPACE |
| Return the number of bytes a netlink message with payload of the passed length |
| would occupy. |
| .TP |
| NLMSG_DATA |
| Return a pointer to the payload associated with the passed |
| .IR nlmsghdr . |
| .TP |
| .\" FIXME this is bizarre, maybe the interface should be fixed. |
| NLMSG_NEXT |
| Get the next |
| .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. |
| This macro decrements it by the length of the message header. |
| .TP |
| NLMSG_OK |
| Return true if the netlink message is not truncated and ok to parse. |
| .TP |
| NLMSG_PAYLOAD |
| Return the length of the payload associated with the |
| .IR nlmsghdr . |
| |
| .SH NOTES |
| It is often better to use netlink via |
| .B libnetlink |
| than via the low level kernel interface. |
| |
| .SH "SEE ALSO" |
| .BR netlink (7) |
| .PP |
| and ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink |