• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPI__LINUX_NETLINK_H
8 #define _UAPI__LINUX_NETLINK_H
9 #include <linux/const.h>
10 #include <linux/socket.h>
11 #include <linux/types.h>
12 #define NETLINK_ROUTE 0
13 #define NETLINK_UNUSED 1
14 #define NETLINK_USERSOCK 2
15 #define NETLINK_FIREWALL 3
16 #define NETLINK_SOCK_DIAG 4
17 #define NETLINK_NFLOG 5
18 #define NETLINK_XFRM 6
19 #define NETLINK_SELINUX 7
20 #define NETLINK_ISCSI 8
21 #define NETLINK_AUDIT 9
22 #define NETLINK_FIB_LOOKUP 10
23 #define NETLINK_CONNECTOR 11
24 #define NETLINK_NETFILTER 12
25 #define NETLINK_IP6_FW 13
26 #define NETLINK_DNRTMSG 14
27 #define NETLINK_KOBJECT_UEVENT 15
28 #define NETLINK_GENERIC 16
29 #define NETLINK_SCSITRANSPORT 18
30 #define NETLINK_ECRYPTFS 19
31 #define NETLINK_RDMA 20
32 #define NETLINK_CRYPTO 21
33 #define NETLINK_SMC 22
34 #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
35 #define MAX_LINKS 32
36 struct sockaddr_nl {
37   __kernel_sa_family_t nl_family;
38   unsigned short nl_pad;
39   __u32 nl_pid;
40   __u32 nl_groups;
41 };
42 struct nlmsghdr {
43   __u32 nlmsg_len;
44   __u16 nlmsg_type;
45   __u16 nlmsg_flags;
46   __u32 nlmsg_seq;
47   __u32 nlmsg_pid;
48 };
49 #define NLM_F_REQUEST 0x01
50 #define NLM_F_MULTI 0x02
51 #define NLM_F_ACK 0x04
52 #define NLM_F_ECHO 0x08
53 #define NLM_F_DUMP_INTR 0x10
54 #define NLM_F_DUMP_FILTERED 0x20
55 #define NLM_F_ROOT 0x100
56 #define NLM_F_MATCH 0x200
57 #define NLM_F_ATOMIC 0x400
58 #define NLM_F_DUMP (NLM_F_ROOT | NLM_F_MATCH)
59 #define NLM_F_REPLACE 0x100
60 #define NLM_F_EXCL 0x200
61 #define NLM_F_CREATE 0x400
62 #define NLM_F_APPEND 0x800
63 #define NLM_F_NONREC 0x100
64 #define NLM_F_BULK 0x200
65 #define NLM_F_CAPPED 0x100
66 #define NLM_F_ACK_TLVS 0x200
67 #define NLMSG_ALIGNTO 4U
68 #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
69 #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
70 #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
71 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
72 #define NLMSG_DATA(nlh) ((void *) (((char *) nlh) + NLMSG_HDRLEN))
73 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr *) (((char *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
74 #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len))
75 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
76 #define NLMSG_NOOP 0x1
77 #define NLMSG_ERROR 0x2
78 #define NLMSG_DONE 0x3
79 #define NLMSG_OVERRUN 0x4
80 #define NLMSG_MIN_TYPE 0x10
81 struct nlmsgerr {
82   int error;
83   struct nlmsghdr msg;
84 };
85 enum nlmsgerr_attrs {
86   NLMSGERR_ATTR_UNUSED,
87   NLMSGERR_ATTR_MSG,
88   NLMSGERR_ATTR_OFFS,
89   NLMSGERR_ATTR_COOKIE,
90   NLMSGERR_ATTR_POLICY,
91   NLMSGERR_ATTR_MISS_TYPE,
92   NLMSGERR_ATTR_MISS_NEST,
93   __NLMSGERR_ATTR_MAX,
94   NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
95 };
96 #define NETLINK_ADD_MEMBERSHIP 1
97 #define NETLINK_DROP_MEMBERSHIP 2
98 #define NETLINK_PKTINFO 3
99 #define NETLINK_BROADCAST_ERROR 4
100 #define NETLINK_NO_ENOBUFS 5
101 #define NETLINK_RX_RING 6
102 #define NETLINK_TX_RING 7
103 #define NETLINK_LISTEN_ALL_NSID 8
104 #define NETLINK_LIST_MEMBERSHIPS 9
105 #define NETLINK_CAP_ACK 10
106 #define NETLINK_EXT_ACK 11
107 #define NETLINK_GET_STRICT_CHK 12
108 struct nl_pktinfo {
109   __u32 group;
110 };
111 struct nl_mmap_req {
112   unsigned int nm_block_size;
113   unsigned int nm_block_nr;
114   unsigned int nm_frame_size;
115   unsigned int nm_frame_nr;
116 };
117 struct nl_mmap_hdr {
118   unsigned int nm_status;
119   unsigned int nm_len;
120   __u32 nm_group;
121   __u32 nm_pid;
122   __u32 nm_uid;
123   __u32 nm_gid;
124 };
125 enum nl_mmap_status {
126   NL_MMAP_STATUS_UNUSED,
127   NL_MMAP_STATUS_RESERVED,
128   NL_MMAP_STATUS_VALID,
129   NL_MMAP_STATUS_COPY,
130   NL_MMAP_STATUS_SKIP,
131 };
132 #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
133 #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
134 #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
135 #define NET_MAJOR 36
136 enum {
137   NETLINK_UNCONNECTED = 0,
138   NETLINK_CONNECTED,
139 };
140 struct nlattr {
141   __u16 nla_len;
142   __u16 nla_type;
143 };
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)
147 #define NLA_ALIGNTO 4
148 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
149 #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
150 struct nla_bitfield32 {
151   __u32 value;
152   __u32 selector;
153 };
154 enum netlink_attribute_type {
155   NL_ATTR_TYPE_INVALID,
156   NL_ATTR_TYPE_FLAG,
157   NL_ATTR_TYPE_U8,
158   NL_ATTR_TYPE_U16,
159   NL_ATTR_TYPE_U32,
160   NL_ATTR_TYPE_U64,
161   NL_ATTR_TYPE_S8,
162   NL_ATTR_TYPE_S16,
163   NL_ATTR_TYPE_S32,
164   NL_ATTR_TYPE_S64,
165   NL_ATTR_TYPE_BINARY,
166   NL_ATTR_TYPE_STRING,
167   NL_ATTR_TYPE_NUL_STRING,
168   NL_ATTR_TYPE_NESTED,
169   NL_ATTR_TYPE_NESTED_ARRAY,
170   NL_ATTR_TYPE_BITFIELD32,
171   NL_ATTR_TYPE_SINT,
172   NL_ATTR_TYPE_UINT,
173 };
174 enum netlink_policy_type_attr {
175   NL_POLICY_TYPE_ATTR_UNSPEC,
176   NL_POLICY_TYPE_ATTR_TYPE,
177   NL_POLICY_TYPE_ATTR_MIN_VALUE_S,
178   NL_POLICY_TYPE_ATTR_MAX_VALUE_S,
179   NL_POLICY_TYPE_ATTR_MIN_VALUE_U,
180   NL_POLICY_TYPE_ATTR_MAX_VALUE_U,
181   NL_POLICY_TYPE_ATTR_MIN_LENGTH,
182   NL_POLICY_TYPE_ATTR_MAX_LENGTH,
183   NL_POLICY_TYPE_ATTR_POLICY_IDX,
184   NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE,
185   NL_POLICY_TYPE_ATTR_BITFIELD32_MASK,
186   NL_POLICY_TYPE_ATTR_PAD,
187   NL_POLICY_TYPE_ATTR_MASK,
188   __NL_POLICY_TYPE_ATTR_MAX,
189   NL_POLICY_TYPE_ATTR_MAX = __NL_POLICY_TYPE_ATTR_MAX - 1
190 };
191 #endif
192