wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
priv_netlink.h
Go to the documentation of this file.
1 
5 #ifndef PRIV_NETLINK_H
6 #define PRIV_NETLINK_H
7 
8 /*
9  * This should be replaced with user space header once one is available with C
10  * library, etc..
11  */
12 
13 #ifndef IFF_LOWER_UP
14 #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
15 #endif
16 #ifndef IFF_DORMANT
17 #define IFF_DORMANT 0x20000 /* driver signals dormant */
18 #endif
19 
20 #ifndef IFLA_IFNAME
21 #define IFLA_IFNAME 3
22 #endif
23 #ifndef IFLA_WIRELESS
24 #define IFLA_WIRELESS 11
25 #endif
26 #ifndef IFLA_OPERSTATE
27 #define IFLA_OPERSTATE 16
28 #endif
29 #ifndef IFLA_LINKMODE
30 #define IFLA_LINKMODE 17
31 #define IF_OPER_DORMANT 5
32 #define IF_OPER_UP 6
33 #endif
34 
35 #define NLM_F_REQUEST 1
36 
37 #define NETLINK_ROUTE 0
38 #define RTMGRP_LINK 1
39 #define RTM_BASE 0x10
40 #define RTM_NEWLINK (RTM_BASE + 0)
41 #define RTM_DELLINK (RTM_BASE + 1)
42 #define RTM_SETLINK (RTM_BASE + 3)
43 
44 #define NLMSG_ALIGNTO 4
45 #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
46 #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
47 #define NLMSG_LENGTH(len) ((len) + NLMSG_ALIGN(sizeof(struct nlmsghdr)))
48 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
49 #define NLMSG_DATA(nlh) ((void*) (((char*) nlh) + NLMSG_LENGTH(0)))
50 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
51  (struct nlmsghdr *) \
52  (((char *)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
53 #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && \
54  (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
55  (int) (nlh)->nlmsg_len <= (len))
56 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
57 
58 #define RTA_ALIGNTO 4
59 #define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO - 1))
60 #define RTA_OK(rta,len) \
61 ((len) > 0 && (rta)->rta_len >= sizeof(struct rtattr) && \
62 (rta)->rta_len <= (len))
63 #define RTA_NEXT(rta,attrlen) \
64 ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
65 (struct rtattr *) (((char *)(rta)) + RTA_ALIGN((rta)->rta_len)))
66 #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
67 #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len))
68 #define RTA_DATA(rta) ((void *) (((char *) (rta)) + RTA_LENGTH(0)))
69 #define RTA_PAYLOAD(rta) ((int) ((rta)->rta_len) - RTA_LENGTH(0))
70 
71 
73 {
74  sa_family_t nl_family;
75  unsigned short nl_pad;
76  u32 nl_pid;
77  u32 nl_groups;
78 };
79 
80 struct nlmsghdr
81 {
82  u32 nlmsg_len;
83  u16 nlmsg_type;
84  u16 nlmsg_flags;
85  u32 nlmsg_seq;
86  u32 nlmsg_pid;
87 };
88 
89 struct ifinfomsg
90 {
91  unsigned char ifi_family;
92  unsigned char __ifi_pad;
93  unsigned short ifi_type;
94  int ifi_index;
95  unsigned ifi_flags;
96  unsigned ifi_change;
97 };
98 
99 struct rtattr
100 {
101  unsigned short rta_len;
102  unsigned short rta_type;
103 };
104 
105 #endif /* PRIV_NETLINK_H */
Definition: priv_netlink.h:80
Definition: priv_netlink.h:99
Definition: priv_netlink.h:72
Definition: priv_netlink.h:89