Home | History | Annotate | Download | only in linux
      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>
     23 #include <linux/types.h>
     24 #define NETLINK_ROUTE 0
     25 #define NETLINK_UNUSED 1
     26 #define NETLINK_USERSOCK 2
     27 #define NETLINK_FIREWALL 3
     28 #define NETLINK_SOCK_DIAG 4
     29 #define NETLINK_NFLOG 5
     30 #define NETLINK_XFRM 6
     31 #define NETLINK_SELINUX 7
     32 #define NETLINK_ISCSI 8
     33 #define NETLINK_AUDIT 9
     34 #define NETLINK_FIB_LOOKUP 10
     35 #define NETLINK_CONNECTOR 11
     36 #define NETLINK_NETFILTER 12
     37 #define NETLINK_IP6_FW 13
     38 #define NETLINK_DNRTMSG 14
     39 #define NETLINK_KOBJECT_UEVENT 15
     40 #define NETLINK_GENERIC 16
     41 #define NETLINK_SCSITRANSPORT 18
     42 #define NETLINK_ECRYPTFS 19
     43 #define NETLINK_RDMA 20
     44 #define NETLINK_CRYPTO 21
     45 #define NETLINK_SMC 22
     46 #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
     47 #define MAX_LINKS 32
     48 struct sockaddr_nl {
     49   __kernel_sa_family_t nl_family;
     50   unsigned short nl_pad;
     51   __u32 nl_pid;
     52   __u32 nl_groups;
     53 };
     54 struct nlmsghdr {
     55   __u32 nlmsg_len;
     56   __u16 nlmsg_type;
     57   __u16 nlmsg_flags;
     58   __u32 nlmsg_seq;
     59   __u32 nlmsg_pid;
     60 };
     61 #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
     67 #define NLM_F_ROOT 0x100
     68 #define NLM_F_MATCH 0x200
     69 #define NLM_F_ATOMIC 0x400
     70 #define NLM_F_DUMP (NLM_F_ROOT | NLM_F_MATCH)
     71 #define NLM_F_REPLACE 0x100
     72 #define NLM_F_EXCL 0x200
     73 #define NLM_F_CREATE 0x400
     74 #define NLM_F_APPEND 0x800
     75 #define NLM_F_NONREC 0x100
     76 #define NLM_F_CAPPED 0x100
     77 #define NLM_F_ACK_TLVS 0x200
     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_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), (struct nlmsghdr *) (((char *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
     85 #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len))
     86 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
     87 #define NLMSG_NOOP 0x1
     88 #define NLMSG_ERROR 0x2
     89 #define NLMSG_DONE 0x3
     90 #define NLMSG_OVERRUN 0x4
     91 #define NLMSG_MIN_TYPE 0x10
     92 struct nlmsgerr {
     93   int error;
     94   struct nlmsghdr msg;
     95 };
     96 enum nlmsgerr_attrs {
     97   NLMSGERR_ATTR_UNUSED,
     98   NLMSGERR_ATTR_MSG,
     99   NLMSGERR_ATTR_OFFS,
    100   NLMSGERR_ATTR_COOKIE,
    101   __NLMSGERR_ATTR_MAX,
    102   NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
    103 };
    104 #define NETLINK_ADD_MEMBERSHIP 1
    105 #define NETLINK_DROP_MEMBERSHIP 2
    106 #define NETLINK_PKTINFO 3
    107 #define NETLINK_BROADCAST_ERROR 4
    108 #define NETLINK_NO_ENOBUFS 5
    109 #define NETLINK_RX_RING 6
    110 #define NETLINK_TX_RING 7
    111 #define NETLINK_LISTEN_ALL_NSID 8
    112 #define NETLINK_LIST_MEMBERSHIPS 9
    113 #define NETLINK_CAP_ACK 10
    114 #define NETLINK_EXT_ACK 11
    115 #define NETLINK_GET_STRICT_CHK 12
    116 struct nl_pktinfo {
    117   __u32 group;
    118 };
    119 struct nl_mmap_req {
    120   unsigned int nm_block_size;
    121   unsigned int nm_block_nr;
    122   unsigned int nm_frame_size;
    123   unsigned int nm_frame_nr;
    124 };
    125 struct nl_mmap_hdr {
    126   unsigned int nm_status;
    127   unsigned int nm_len;
    128   __u32 nm_group;
    129   __u32 nm_pid;
    130   __u32 nm_uid;
    131   __u32 nm_gid;
    132 };
    133 enum nl_mmap_status {
    134   NL_MMAP_STATUS_UNUSED,
    135   NL_MMAP_STATUS_RESERVED,
    136   NL_MMAP_STATUS_VALID,
    137   NL_MMAP_STATUS_COPY,
    138   NL_MMAP_STATUS_SKIP,
    139 };
    140 #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
    141 #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
    142 #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
    143 #define NET_MAJOR 36
    144 enum {
    145   NETLINK_UNCONNECTED = 0,
    146   NETLINK_CONNECTED,
    147 };
    148 struct nlattr {
    149   __u16 nla_len;
    150   __u16 nla_type;
    151 };
    152 #define NLA_F_NESTED (1 << 15)
    153 #define NLA_F_NET_BYTEORDER (1 << 14)
    154 #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
    155 #define NLA_ALIGNTO 4
    156 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
    157 #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
    158 struct nla_bitfield32 {
    159   __u32 value;
    160   __u32 selector;
    161 };
    162 #endif
    163