The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -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 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef __LINUX_NETLINK_H |
| 13 | #define __LINUX_NETLINK_H |
| 14 | |
| 15 | #include <linux/socket.h> |
| 16 | #include <linux/types.h> |
| 17 | |
| 18 | #define NETLINK_ROUTE 0 |
| 19 | #define NETLINK_UNUSED 1 |
| 20 | #define NETLINK_USERSOCK 2 |
| 21 | #define NETLINK_FIREWALL 3 |
| 22 | #define NETLINK_INET_DIAG 4 |
| 23 | #define NETLINK_NFLOG 5 |
| 24 | #define NETLINK_XFRM 6 |
| 25 | #define NETLINK_SELINUX 7 |
| 26 | #define NETLINK_ISCSI 8 |
| 27 | #define NETLINK_AUDIT 9 |
| 28 | #define NETLINK_FIB_LOOKUP 10 |
| 29 | #define NETLINK_CONNECTOR 11 |
| 30 | #define NETLINK_NETFILTER 12 |
| 31 | #define NETLINK_IP6_FW 13 |
| 32 | #define NETLINK_DNRTMSG 14 |
| 33 | #define NETLINK_KOBJECT_UEVENT 15 |
| 34 | #define NETLINK_GENERIC 16 |
| 35 | |
| 36 | #define MAX_LINKS 32 |
| 37 | |
| 38 | struct sockaddr_nl |
| 39 | { |
| 40 | sa_family_t nl_family; |
| 41 | unsigned short nl_pad; |
| 42 | __u32 nl_pid; |
| 43 | __u32 nl_groups; |
| 44 | }; |
| 45 | |
| 46 | struct nlmsghdr |
| 47 | { |
| 48 | __u32 nlmsg_len; |
| 49 | __u16 nlmsg_type; |
| 50 | __u16 nlmsg_flags; |
| 51 | __u32 nlmsg_seq; |
| 52 | __u32 nlmsg_pid; |
| 53 | }; |
| 54 | |
| 55 | #define NLM_F_REQUEST 1 |
| 56 | #define NLM_F_MULTI 2 |
| 57 | #define NLM_F_ACK 4 |
| 58 | #define NLM_F_ECHO 8 |
| 59 | |
| 60 | #define NLM_F_ROOT 0x100 |
| 61 | #define NLM_F_MATCH 0x200 |
| 62 | #define NLM_F_ATOMIC 0x400 |
| 63 | #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) |
| 64 | |
| 65 | #define NLM_F_REPLACE 0x100 |
| 66 | #define NLM_F_EXCL 0x200 |
| 67 | #define NLM_F_CREATE 0x400 |
| 68 | #define NLM_F_APPEND 0x800 |
| 69 | |
| 70 | #define NLMSG_ALIGNTO 4 |
| 71 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) |
| 72 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
| 73 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) |
| 74 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
| 75 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) |
| 76 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) |
| 77 | #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len)) |
| 78 | #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) |
| 79 | |
| 80 | #define NLMSG_NOOP 0x1 |
| 81 | #define NLMSG_ERROR 0x2 |
| 82 | #define NLMSG_DONE 0x3 |
| 83 | #define NLMSG_OVERRUN 0x4 |
| 84 | |
| 85 | #define NLMSG_MIN_TYPE 0x10 |
| 86 | |
| 87 | struct nlmsgerr |
| 88 | { |
| 89 | int error; |
| 90 | struct nlmsghdr msg; |
| 91 | }; |
| 92 | |
| 93 | #define NETLINK_ADD_MEMBERSHIP 1 |
| 94 | #define NETLINK_DROP_MEMBERSHIP 2 |
| 95 | #define NETLINK_PKTINFO 3 |
| 96 | |
| 97 | struct nl_pktinfo |
| 98 | { |
| 99 | __u32 group; |
| 100 | }; |
| 101 | |
| 102 | #define NET_MAJOR 36 |
| 103 | |
| 104 | enum { |
| 105 | NETLINK_UNCONNECTED = 0, |
| 106 | NETLINK_CONNECTED, |
| 107 | }; |
| 108 | |
| 109 | struct nlattr |
| 110 | { |
| 111 | __u16 nla_len; |
| 112 | __u16 nla_type; |
| 113 | }; |
| 114 | |
| 115 | #define NLA_ALIGNTO 4 |
| 116 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) |
| 117 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) |
| 118 | |
| 119 | #endif |