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 NETLINK_SCSITRANSPORT 18 37 #define NETLINK_ECRYPTFS 19 38 39 #define MAX_LINKS 32 40 41 struct net; 42 43 struct sockaddr_nl 44 { 45 sa_family_t nl_family; 46 unsigned short nl_pad; 47 __u32 nl_pid; 48 __u32 nl_groups; 49 }; 50 51 struct nlmsghdr 52 { 53 __u32 nlmsg_len; 54 __u16 nlmsg_type; 55 __u16 nlmsg_flags; 56 __u32 nlmsg_seq; 57 __u32 nlmsg_pid; 58 }; 59 60 #define NLM_F_REQUEST 1 61 #define NLM_F_MULTI 2 62 #define NLM_F_ACK 4 63 #define NLM_F_ECHO 8 64 65 #define NLM_F_ROOT 0x100 66 #define NLM_F_MATCH 0x200 67 #define NLM_F_ATOMIC 0x400 68 #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) 69 70 #define NLM_F_REPLACE 0x100 71 #define NLM_F_EXCL 0x200 72 #define NLM_F_CREATE 0x400 73 #define NLM_F_APPEND 0x800 74 75 #define NLMSG_ALIGNTO 4 76 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) 77 #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) 78 #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) 79 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) 80 #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) 81 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) 82 #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len)) 83 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) 84 85 #define NLMSG_NOOP 0x1 86 #define NLMSG_ERROR 0x2 87 #define NLMSG_DONE 0x3 88 #define NLMSG_OVERRUN 0x4 89 90 #define NLMSG_MIN_TYPE 0x10 91 92 struct nlmsgerr 93 { 94 int error; 95 struct nlmsghdr msg; 96 }; 97 98 #define NETLINK_ADD_MEMBERSHIP 1 99 #define NETLINK_DROP_MEMBERSHIP 2 100 #define NETLINK_PKTINFO 3 101 #define NETLINK_BROADCAST_ERROR 4 102 #define NETLINK_NO_ENOBUFS 5 103 104 struct nl_pktinfo 105 { 106 __u32 group; 107 }; 108 109 #define NET_MAJOR 36 110 111 enum { 112 NETLINK_UNCONNECTED = 0, 113 NETLINK_CONNECTED, 114 }; 115 116 struct nlattr 117 { 118 __u16 nla_len; 119 __u16 nla_type; 120 }; 121 122 #define NLA_F_NESTED (1 << 15) 123 #define NLA_F_NET_BYTEORDER (1 << 14) 124 #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) 125 126 #define NLA_ALIGNTO 4 127 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) 128 #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) 129 130 #endif 131