Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 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 Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | #include <linux/types.h> |
| 24 | #define NETLINK_ROUTE 0 |
| 25 | #define NETLINK_UNUSED 1 |
| 26 | #define NETLINK_USERSOCK 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | #define NETLINK_FIREWALL 3 |
| 28 | #define NETLINK_SOCK_DIAG 4 |
| 29 | #define NETLINK_NFLOG 5 |
| 30 | #define NETLINK_XFRM 6 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 31 | #define NETLINK_SELINUX 7 |
| 32 | #define NETLINK_ISCSI 8 |
| 33 | #define NETLINK_AUDIT 9 |
| 34 | #define NETLINK_FIB_LOOKUP 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 35 | #define NETLINK_CONNECTOR 11 |
| 36 | #define NETLINK_NETFILTER 12 |
| 37 | #define NETLINK_IP6_FW 13 |
| 38 | #define NETLINK_DNRTMSG 14 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | #define NETLINK_KOBJECT_UEVENT 15 |
| 40 | #define NETLINK_GENERIC 16 |
| 41 | #define NETLINK_SCSITRANSPORT 18 |
| 42 | #define NETLINK_ECRYPTFS 19 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 43 | #define NETLINK_RDMA 20 |
| 44 | #define NETLINK_CRYPTO 21 |
| 45 | #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG |
| 46 | #define MAX_LINKS 32 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 47 | struct sockaddr_nl { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 48 | __kernel_sa_family_t nl_family; |
| 49 | unsigned short nl_pad; |
| 50 | __u32 nl_pid; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 | __u32 nl_groups; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 52 | }; |
| 53 | struct nlmsghdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 54 | __u32 nlmsg_len; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | __u16 nlmsg_type; |
| 56 | __u16 nlmsg_flags; |
| 57 | __u32 nlmsg_seq; |
| 58 | __u32 nlmsg_pid; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 59 | }; |
| 60 | #define NLM_F_REQUEST 1 |
| 61 | #define NLM_F_MULTI 2 |
| 62 | #define NLM_F_ACK 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 63 | #define NLM_F_ECHO 8 |
| 64 | #define NLM_F_DUMP_INTR 16 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 65 | #define NLM_F_DUMP_FILTERED 32 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 66 | #define NLM_F_ROOT 0x100 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 67 | #define NLM_F_MATCH 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 68 | #define NLM_F_ATOMIC 0x400 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 69 | #define NLM_F_DUMP (NLM_F_ROOT | NLM_F_MATCH) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 70 | #define NLM_F_REPLACE 0x100 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 71 | #define NLM_F_EXCL 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 72 | #define NLM_F_CREATE 0x400 |
| 73 | #define NLM_F_APPEND 0x800 |
| 74 | #define NLMSG_ALIGNTO 4U |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 75 | #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 76 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
| 77 | #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) |
| 78 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 79 | #define NLMSG_DATA(nlh) ((void *) (((char *) nlh) + NLMSG_LENGTH(0))) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 80 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr *) (((char *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) |
| 81 | #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 82 | #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 83 | #define NLMSG_NOOP 0x1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 84 | #define NLMSG_ERROR 0x2 |
| 85 | #define NLMSG_DONE 0x3 |
| 86 | #define NLMSG_OVERRUN 0x4 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 87 | #define NLMSG_MIN_TYPE 0x10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 88 | struct nlmsgerr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 89 | int error; |
| 90 | struct nlmsghdr msg; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 91 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 92 | #define NETLINK_ADD_MEMBERSHIP 1 |
| 93 | #define NETLINK_DROP_MEMBERSHIP 2 |
| 94 | #define NETLINK_PKTINFO 3 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 95 | #define NETLINK_BROADCAST_ERROR 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 96 | #define NETLINK_NO_ENOBUFS 5 |
| 97 | #define NETLINK_RX_RING 6 |
| 98 | #define NETLINK_TX_RING 7 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 99 | #define NETLINK_LISTEN_ALL_NSID 8 |
| 100 | #define NETLINK_LIST_MEMBERSHIPS 9 |
| 101 | #define NETLINK_CAP_ACK 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 102 | struct nl_pktinfo { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 103 | __u32 group; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 104 | }; |
| 105 | struct nl_mmap_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 106 | unsigned int nm_block_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 107 | unsigned int nm_block_nr; |
| 108 | unsigned int nm_frame_size; |
| 109 | unsigned int nm_frame_nr; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 110 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 111 | struct nl_mmap_hdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 112 | unsigned int nm_status; |
| 113 | unsigned int nm_len; |
| 114 | __u32 nm_group; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 115 | __u32 nm_pid; |
| 116 | __u32 nm_uid; |
| 117 | __u32 nm_gid; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 118 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 119 | enum nl_mmap_status { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 120 | NL_MMAP_STATUS_UNUSED, |
| 121 | NL_MMAP_STATUS_RESERVED, |
| 122 | NL_MMAP_STATUS_VALID, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 123 | NL_MMAP_STATUS_COPY, |
| 124 | NL_MMAP_STATUS_SKIP, |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 125 | }; |
| 126 | #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 127 | #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) |
| 128 | #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) |
| 129 | #define NET_MAJOR 36 |
| 130 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 131 | NETLINK_UNCONNECTED = 0, |
| 132 | NETLINK_CONNECTED, |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 133 | }; |
| 134 | struct nlattr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 135 | __u16 nla_len; |
| 136 | __u16 nla_type; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 137 | }; |
| 138 | #define NLA_F_NESTED (1 << 15) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 139 | #define NLA_F_NET_BYTEORDER (1 << 14) |
| 140 | #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) |
| 141 | #define NLA_ALIGNTO 4 |
| 142 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 143 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) |
| 144 | #endif |