]> git.ipfire.org Git - thirdparty/hostap.git/blame - hostapd/priv_netlink.h
Fix couple of forgotten wpa_hw_modes -> hostapd_hw_modes
[thirdparty/hostap.git] / hostapd / priv_netlink.h
CommitLineData
6fc6879b
JM
1#ifndef PRIV_NETLINK_H
2#define PRIV_NETLINK_H
3
4/* Private copy of needed Linux netlink/rtnetlink definitions.
5 *
6 * This should be replaced with user space header once one is available with C
7 * library, etc..
8 */
9
10#ifndef IFLA_IFNAME
11#define IFLA_IFNAME 3
12#endif
13#ifndef IFLA_WIRELESS
14#define IFLA_WIRELESS 11
15#endif
16
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)
22
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)))
27
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)))
36
37
38struct sockaddr_nl
39{
40 sa_family_t nl_family;
41 unsigned short nl_pad;
42 u32 nl_pid;
43 u32 nl_groups;
44};
45
46struct nlmsghdr
47{
48 u32 nlmsg_len;
49 u16 nlmsg_type;
50 u16 nlmsg_flags;
51 u32 nlmsg_seq;
52 u32 nlmsg_pid;
53};
54
55struct ifinfomsg
56{
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;
63};
64
65struct rtattr
66{
67 unsigned short rta_len;
68 unsigned short rta_type;
69};
70
71#endif /* PRIV_NETLINK_H */