netlink

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

netlink - netlink マクロ  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <asm/types.h>
#include <linux/netlink.h>

int NLMSG_ALIGN(size_t size);
int NLMSG_LENGTH(size_t size);
int NLMSG_SPACE(size_t size);
void *NLMSG_DATA(struct nlmsghdr *nlh);
struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *nlh, int size);
int NLMSG_OK(struct nlmsghdr *nlh, int size);
int NLMSG_PAYLOAD(struct nlmsghdr *nlh, int size);
 

説明

<linux/netlink.h> では、 netlink データグラムにアクセスしたり、これを作成するための 標準マクロがいくつか定義されている。 これらは cmsg(3) で定義されている補助データ (auxiliary data) 用のマクロと、 その精神において似ているものである。 netlink ソケットに対してやりとりされるバッファーには、 必ずこれらのマクロだけを使ってアクセスすべきである。
NLMSG_ALIGN
netlink メッセージのサイズを丸めて正しく揃える。
NLMSG_LENGTH
格納領域 (payload) のサイズ size を引数にとり、 nlmsghdr の nlmsg_len フィールドに代入できる 揃えられたサイズ (aligned size) を返す。
NLMSG_SPACE
ペイロードのサイズが size の netlink メッセージのバイト数を返す。
NLMSG_DATA
与えた nlmsghdr に関連づけられた格納領域へのポインターを返す。
NLMSG_NEXT
Get the next nlmsghdr in a multipart message. The caller must check if the current nlmsghdr didn't have the NLMSG_DONE set---this function doesn't return NULL on end. The size argument is an lvalue containing the remaining size of the message buffer. This macro decrements it by the size of the message header.
NLMSG_OK
Netlink メッセージが途切れておらず、かつ解釈可能な形の場合であれば真を返す。
NLMSG_PAYLOAD
nlmsghdr に関連づけられた格納領域のサイズを返す。
 

バージョン

通常はカーネルの低レベルインターフェイスよりも、 libnetlink 経由で netlink を用いるほうが良い。  

標準規格

Linux.  

関連項目

libnetlink(3), netlink(7)


 

Index

名前
ライブラリ
書式
説明
バージョン
標準規格
関連項目

This document was created by man2html, using the manual pages.