Import hostapd 0.5.8
[dragonfly.git] / contrib / hostapd-0.5.8 / priv_netlink.h
blobd1f6f663ebf7c72c68053ad88440fc4df0b10a65
1 #ifndef PRIV_NETLINK_H
2 #define PRIV_NETLINK_H
4 /* Private copy of needed Linux netlink/rtnetlink definitions.
6 * This should be replaced with user space header once one is available with C
7 * library, etc..
8 */
10 #ifndef IFLA_IFNAME
11 #define IFLA_IFNAME 3
12 #endif
13 #ifndef IFLA_WIRELESS
14 #define IFLA_WIRELESS 11
15 #endif
17 #define NETLINK_ROUTE 0
18 #define RTMGRP_LINK 1
19 #define RTM_BASE 0x10
20 #define RTM_NEWLINK (RTM_BASE + 0)
21 #define RTM_DELLINK (RTM_BASE + 1)
23 #define NLMSG_ALIGNTO 4
24 #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
25 #define NLMSG_LENGTH(len) ((len) + NLMSG_ALIGN(sizeof(struct nlmsghdr)))
26 #define NLMSG_DATA(nlh) ((void*) (((char*) nlh) + NLMSG_LENGTH(0)))
28 #define RTA_ALIGNTO 4
29 #define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO - 1))
30 #define RTA_OK(rta,len) \
31 ((len) > 0 && (rta)->rta_len >= sizeof(struct rtattr) && \
32 (rta)->rta_len <= (len))
33 #define RTA_NEXT(rta,attrlen) \
34 ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
35 (struct rtattr *) (((char *)(rta)) + RTA_ALIGN((rta)->rta_len)))
38 struct sockaddr_nl
40 sa_family_t nl_family;
41 unsigned short nl_pad;
42 u32 nl_pid;
43 u32 nl_groups;
46 struct nlmsghdr
48 u32 nlmsg_len;
49 u16 nlmsg_type;
50 u16 nlmsg_flags;
51 u32 nlmsg_seq;
52 u32 nlmsg_pid;
55 struct ifinfomsg
57 unsigned char ifi_family;
58 unsigned char __ifi_pad;
59 unsigned short ifi_type;
60 int ifi_index;
61 unsigned ifi_flags;
62 unsigned ifi_change;
65 struct rtattr
67 unsigned short rta_len;
68 unsigned short rta_type;
71 #endif /* PRIV_NETLINK_H */