]>
Commit | Line | Data |
---|---|---|
cad53b3f JB |
1 | #ifndef __IW_H |
2 | #define __IW_H | |
3 | ||
541ef425 | 4 | #include <linux/nl80211.h> |
cad53b3f JB |
5 | #include <netlink/genl/genl.h> |
6 | #include <netlink/genl/family.h> | |
7 | #include <netlink/genl/ctrl.h> | |
8 | ||
3d1e8704 LCC |
9 | #define ETH_ALEN 6 |
10 | ||
cad53b3f JB |
11 | struct nl80211_state { |
12 | struct nl_handle *nl_handle; | |
13 | struct nl_cache *nl_cache; | |
14 | struct genl_family *nl80211; | |
15 | }; | |
16 | ||
bd396f2a JB |
17 | enum command_identify_by { |
18 | CIB_NONE, | |
19 | CIB_PHY, | |
20 | CIB_NETDEV, | |
21 | }; | |
45c7212c | 22 | |
bd396f2a JB |
23 | struct cmd { |
24 | const char *section; | |
25 | const char *name; | |
26 | const char *args; | |
27 | const enum nl80211_commands cmd; | |
28 | int nl_msg_flags; | |
29 | const enum command_identify_by idby; | |
5e75fd04 JB |
30 | /* |
31 | * The handler should return a negative error code, | |
32 | * zero on success, 1 if the arguments were wrong | |
33 | * and the usage message should and 2 otherwise. | |
34 | */ | |
70391ccf | 35 | int (*handler)(struct nl_cb *cb, |
bd396f2a JB |
36 | struct nl_msg *msg, |
37 | int argc, char **argv); | |
38 | }; | |
3d1e8704 | 39 | |
f5f937fb JB |
40 | #define __COMMAND(sect, name, args, nlcmd, flags, idby, handler) \ |
41 | static const struct cmd __cmd_ ## handler ## nlcmd ## idby \ | |
42 | __attribute__((used)) __attribute__((section("__cmd"))) \ | |
bd396f2a JB |
43 | = { sect, name, args, nlcmd, flags, idby, handler } |
44 | #define COMMAND(section, name, args, cmd, flags, idby, handler) \ | |
45 | __COMMAND(#section, #name, args, cmd, flags, idby, handler) | |
46 | #define TOPLEVEL(name, args, cmd, flags, idby, handler) \ | |
47 | __COMMAND(NULL, #name, args, cmd, flags, idby, handler) | |
48 | extern struct cmd __start___cmd; | |
49 | extern struct cmd __stop___cmd; | |
14a0380d | 50 | |
3d1e8704 LCC |
51 | int mac_addr_a2n(unsigned char *mac_addr, char *arg); |
52 | int mac_addr_n2a(char *mac_addr, unsigned char *arg); | |
53 | ||
541ef425 JB |
54 | const char *iftype_name(enum nl80211_iftype iftype); |
55 | ||
cad53b3f | 56 | #endif /* __IW_H */ |