Go to the documentation of this file. 1 #ifndef _UAPI__LINUX_NETLINK_H
2 #define _UAPI__LINUX_NETLINK_H
4 #include <linux/socket.h>
5 #include <linux/types.h>
7 #define NETLINK_ROUTE 0
8 #define NETLINK_UNUSED 1
9 #define NETLINK_USERSOCK 2
10 #define NETLINK_FIREWALL 3
11 #define NETLINK_SOCK_DIAG 4
12 #define NETLINK_NFLOG 5
13 #define NETLINK_XFRM 6
14 #define NETLINK_SELINUX 7
15 #define NETLINK_ISCSI 8
16 #define NETLINK_AUDIT 9
17 #define NETLINK_FIB_LOOKUP 10
18 #define NETLINK_CONNECTOR 11
19 #define NETLINK_NETFILTER 12
20 #define NETLINK_IP6_FW 13
21 #define NETLINK_DNRTMSG 14
22 #define NETLINK_KOBJECT_UEVENT 15
23 #define NETLINK_GENERIC 16
25 #define NETLINK_SCSITRANSPORT 18
26 #define NETLINK_ECRYPTFS 19
27 #define NETLINK_RDMA 20
28 #define NETLINK_CRYPTO 21
30 #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
51 #define NLM_F_REQUEST 1
55 #define NLM_F_DUMP_INTR 16
58 #define NLM_F_ROOT 0x100
59 #define NLM_F_MATCH 0x200
60 #define NLM_F_ATOMIC 0x400
61 #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
64 #define NLM_F_REPLACE 0x100
65 #define NLM_F_EXCL 0x200
66 #define NLM_F_CREATE 0x400
67 #define NLM_F_APPEND 0x800
78 #define NLMSG_ALIGNTO 4U
79 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
80 #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
81 #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
82 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
83 #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
84 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
85 (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
86 #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
87 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
88 (nlh)->nlmsg_len <= (len))
89 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
91 #define NLMSG_NOOP 0x1
92 #define NLMSG_ERROR 0x2
93 #define NLMSG_DONE 0x3
94 #define NLMSG_OVERRUN 0x4
96 #define NLMSG_MIN_TYPE 0x10
103 #define NETLINK_ADD_MEMBERSHIP 1
104 #define NETLINK_DROP_MEMBERSHIP 2
105 #define NETLINK_PKTINFO 3
106 #define NETLINK_BROADCAST_ERROR 4
107 #define NETLINK_NO_ENOBUFS 5
144 #define NLA_F_NESTED (1 << 15)
145 #define NLA_F_NET_BYTEORDER (1 << 14)
146 #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
148 #define NLA_ALIGNTO 4
149 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
150 #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))