blob: 4eb428a49383e206ea4cb4ae41ef0f8861cd457c [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI__LINUX_NETLINK_H
20#define _UAPI__LINUX_NETLINK_H
21#include <linux/kernel.h>
22#include <linux/socket.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#include <linux/types.h>
24#define NETLINK_ROUTE 0
25#define NETLINK_UNUSED 1
26#define NETLINK_USERSOCK 2
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define NETLINK_FIREWALL 3
28#define NETLINK_SOCK_DIAG 4
29#define NETLINK_NFLOG 5
30#define NETLINK_XFRM 6
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define NETLINK_SELINUX 7
32#define NETLINK_ISCSI 8
33#define NETLINK_AUDIT 9
34#define NETLINK_FIB_LOOKUP 10
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define NETLINK_CONNECTOR 11
36#define NETLINK_NETFILTER 12
37#define NETLINK_IP6_FW 13
38#define NETLINK_DNRTMSG 14
Ben Cheng655a7c02013-10-16 16:09:24 -070039#define NETLINK_KOBJECT_UEVENT 15
40#define NETLINK_GENERIC 16
41#define NETLINK_SCSITRANSPORT 18
42#define NETLINK_ECRYPTFS 19
Ben Cheng655a7c02013-10-16 16:09:24 -070043#define NETLINK_RDMA 20
44#define NETLINK_CRYPTO 21
Christopher Ferris525ce912017-07-26 13:12:53 -070045#define NETLINK_SMC 22
Ben Cheng655a7c02013-10-16 16:09:24 -070046#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
47#define MAX_LINKS 32
Ben Cheng655a7c02013-10-16 16:09:24 -070048struct sockaddr_nl {
Tao Baod7db5942015-01-28 10:07:51 -080049 __kernel_sa_family_t nl_family;
50 unsigned short nl_pad;
51 __u32 nl_pid;
Tao Baod7db5942015-01-28 10:07:51 -080052 __u32 nl_groups;
Ben Cheng655a7c02013-10-16 16:09:24 -070053};
54struct nlmsghdr {
Tao Baod7db5942015-01-28 10:07:51 -080055 __u32 nlmsg_len;
Tao Baod7db5942015-01-28 10:07:51 -080056 __u16 nlmsg_type;
57 __u16 nlmsg_flags;
58 __u32 nlmsg_seq;
59 __u32 nlmsg_pid;
Ben Cheng655a7c02013-10-16 16:09:24 -070060};
Christopher Ferris525ce912017-07-26 13:12:53 -070061#define NLM_F_REQUEST 0x01
62#define NLM_F_MULTI 0x02
63#define NLM_F_ACK 0x04
64#define NLM_F_ECHO 0x08
65#define NLM_F_DUMP_INTR 0x10
66#define NLM_F_DUMP_FILTERED 0x20
Ben Cheng655a7c02013-10-16 16:09:24 -070067#define NLM_F_ROOT 0x100
Christopher Ferris05d08e92016-02-04 13:16:38 -080068#define NLM_F_MATCH 0x200
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define NLM_F_ATOMIC 0x400
Tao Baod7db5942015-01-28 10:07:51 -080070#define NLM_F_DUMP (NLM_F_ROOT | NLM_F_MATCH)
Ben Cheng655a7c02013-10-16 16:09:24 -070071#define NLM_F_REPLACE 0x100
Christopher Ferris05d08e92016-02-04 13:16:38 -080072#define NLM_F_EXCL 0x200
Ben Cheng655a7c02013-10-16 16:09:24 -070073#define NLM_F_CREATE 0x400
74#define NLM_F_APPEND 0x800
Christopher Ferris525ce912017-07-26 13:12:53 -070075#define NLM_F_CAPPED 0x100
76#define NLM_F_ACK_TLVS 0x200
Ben Cheng655a7c02013-10-16 16:09:24 -070077#define NLMSG_ALIGNTO 4U
Christopher Ferris05d08e92016-02-04 13:16:38 -080078#define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
Ben Cheng655a7c02013-10-16 16:09:24 -070079#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
80#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
81#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
Christopher Ferris05d08e92016-02-04 13:16:38 -080082#define NLMSG_DATA(nlh) ((void *) (((char *) nlh) + NLMSG_LENGTH(0)))
Tao Baod7db5942015-01-28 10:07:51 -080083#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr *) (((char *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
84#define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len))
Ben Cheng655a7c02013-10-16 16:09:24 -070085#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
Christopher Ferris05d08e92016-02-04 13:16:38 -080086#define NLMSG_NOOP 0x1
Ben Cheng655a7c02013-10-16 16:09:24 -070087#define NLMSG_ERROR 0x2
88#define NLMSG_DONE 0x3
89#define NLMSG_OVERRUN 0x4
Christopher Ferris05d08e92016-02-04 13:16:38 -080090#define NLMSG_MIN_TYPE 0x10
Ben Cheng655a7c02013-10-16 16:09:24 -070091struct nlmsgerr {
Tao Baod7db5942015-01-28 10:07:51 -080092 int error;
93 struct nlmsghdr msg;
Christopher Ferris05d08e92016-02-04 13:16:38 -080094};
Christopher Ferris525ce912017-07-26 13:12:53 -070095enum nlmsgerr_attrs {
96 NLMSGERR_ATTR_UNUSED,
97 NLMSGERR_ATTR_MSG,
98 NLMSGERR_ATTR_OFFS,
99 NLMSGERR_ATTR_COOKIE,
100 __NLMSGERR_ATTR_MAX,
101 NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
102};
Ben Cheng655a7c02013-10-16 16:09:24 -0700103#define NETLINK_ADD_MEMBERSHIP 1
104#define NETLINK_DROP_MEMBERSHIP 2
105#define NETLINK_PKTINFO 3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106#define NETLINK_BROADCAST_ERROR 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700107#define NETLINK_NO_ENOBUFS 5
108#define NETLINK_RX_RING 6
109#define NETLINK_TX_RING 7
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#define NETLINK_LISTEN_ALL_NSID 8
111#define NETLINK_LIST_MEMBERSHIPS 9
112#define NETLINK_CAP_ACK 10
Christopher Ferris525ce912017-07-26 13:12:53 -0700113#define NETLINK_EXT_ACK 11
Ben Cheng655a7c02013-10-16 16:09:24 -0700114struct nl_pktinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800115 __u32 group;
Ben Cheng655a7c02013-10-16 16:09:24 -0700116};
117struct nl_mmap_req {
Tao Baod7db5942015-01-28 10:07:51 -0800118 unsigned int nm_block_size;
Tao Baod7db5942015-01-28 10:07:51 -0800119 unsigned int nm_block_nr;
120 unsigned int nm_frame_size;
121 unsigned int nm_frame_nr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700122};
Ben Cheng655a7c02013-10-16 16:09:24 -0700123struct nl_mmap_hdr {
Tao Baod7db5942015-01-28 10:07:51 -0800124 unsigned int nm_status;
125 unsigned int nm_len;
126 __u32 nm_group;
Tao Baod7db5942015-01-28 10:07:51 -0800127 __u32 nm_pid;
128 __u32 nm_uid;
129 __u32 nm_gid;
Ben Cheng655a7c02013-10-16 16:09:24 -0700130};
Ben Cheng655a7c02013-10-16 16:09:24 -0700131enum nl_mmap_status {
Tao Baod7db5942015-01-28 10:07:51 -0800132 NL_MMAP_STATUS_UNUSED,
133 NL_MMAP_STATUS_RESERVED,
134 NL_MMAP_STATUS_VALID,
Tao Baod7db5942015-01-28 10:07:51 -0800135 NL_MMAP_STATUS_COPY,
136 NL_MMAP_STATUS_SKIP,
Ben Cheng655a7c02013-10-16 16:09:24 -0700137};
138#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
Ben Cheng655a7c02013-10-16 16:09:24 -0700139#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
140#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
141#define NET_MAJOR 36
142enum {
Tao Baod7db5942015-01-28 10:07:51 -0800143 NETLINK_UNCONNECTED = 0,
144 NETLINK_CONNECTED,
Ben Cheng655a7c02013-10-16 16:09:24 -0700145};
146struct nlattr {
Tao Baod7db5942015-01-28 10:07:51 -0800147 __u16 nla_len;
148 __u16 nla_type;
Ben Cheng655a7c02013-10-16 16:09:24 -0700149};
150#define NLA_F_NESTED (1 << 15)
Ben Cheng655a7c02013-10-16 16:09:24 -0700151#define NLA_F_NET_BYTEORDER (1 << 14)
152#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
153#define NLA_ALIGNTO 4
154#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
Ben Cheng655a7c02013-10-16 16:09:24 -0700155#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
156#endif