.\" This man page copyright 1998 by Andi Kleen. Subject to the GPL. .\" This manpage copyright 1998 by Andi Kleen. Subject to the GPL. .\" Based on the original comments from Alexey Kuznetsov .\" $Id: netlink.3,v 1.2 2005/02/21 15:12:12 pepin.jimenez Exp $ .\" .\" Translated on Sun Jun 27 1999 by Juan Piernas .\" .TH NETLINK 3 "14 mayo 1999" "Página man de Linux" "Manual del Programador de Linux" .SH NOMBRE netlink \- macros netlink .SH SINOPSIS .nf .\" XXX what will glibc 2.1 use here? .B #include .br .B #include .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 DESCRIPCIÓN .I netlink.h define varias macros estándares para acceder o crear un datagrama netlink. En esencia son similares a las macros definidas en .BR cmsg (3) para los datos auxiliares. Se debería acceder al buffer pasado a y desde un conector netlink usando únicamente estas macros. .TP NLMSG_ALIGN Redondea la longitud de un mensaje netlink hasta alinearlo adecuadamente. .TP NLMSG_LENGTH Toma como argumento la longitud del contenido útil y devuelve la longitud alineada para almacenarlo en el campo .B nlmsg_len de .IR nlmsghdr . .TP NLMSG_SPACE Devuelve el número de bytes que ocuparía un mensaje netlink con un contenido útil de la longitud pasada. .TP NLMSG_DATA Devuelve un puntero al contenido útil asociado con el .I nlmsghdr pasado. .TP .\" XXX this is bizarre, maybe the interface should be fixed. NLMSG_NEXT Obtiene el siguiente .I nlmsghdr en un mensaje multiparte. El invocador debe comprobar si el nlmsghdr actual no tenía activa la opción NLMSG_DONE (esta función no devuelve NULL al final). El parámetro longitud es un valor izquierdo (lvalue) que contiene la longitud restante del buffer del mensaje. Esta macro lo decrementa en la longitud de la cabecera del mensaje. .TP NLMSG_OK Devuelve verdadero si el mensaje netlink no está truncado y es correcto para se analizado. .TP NLMSG_PAYLOAD Devuelve la longitud del contenido útil asociado con .IR nlmsghdr . .SH OBSERVACIONES Normalmente es mejor usar netlink a través de .B libnetlink que mediante la interfaz de bajo nivel del núcleo. .SH VÉASE TAMBIÉN .BR netlink (7) .PP and ftp://ftp.inr.ac.ru/ip-routing/iproute2* para libnetlink