]>
Commit | Line | Data |
---|---|---|
cad53b3f JB |
1 | #ifndef __IW_H |
2 | #define __IW_H | |
3 | ||
45d543f0 | 4 | #include <netlink/netlink.h> |
cad53b3f JB |
5 | #include <netlink/genl/genl.h> |
6 | #include <netlink/genl/family.h> | |
7 | #include <netlink/genl/ctrl.h> | |
8 | ||
f408e01b JB |
9 | #include "nl80211.h" |
10 | ||
3d1e8704 LCC |
11 | #define ETH_ALEN 6 |
12 | ||
cad53b3f | 13 | struct nl80211_state { |
dfd13ee5 PE |
14 | #ifdef CONFIG_LIBNL20 |
15 | struct nl_sock *nl_handle; | |
16 | #else | |
cad53b3f | 17 | struct nl_handle *nl_handle; |
dfd13ee5 | 18 | #endif |
cad53b3f JB |
19 | struct nl_cache *nl_cache; |
20 | struct genl_family *nl80211; | |
21 | }; | |
22 | ||
bd396f2a JB |
23 | enum command_identify_by { |
24 | CIB_NONE, | |
25 | CIB_PHY, | |
26 | CIB_NETDEV, | |
27 | }; | |
45c7212c | 28 | |
bd396f2a JB |
29 | struct cmd { |
30 | const char *section; | |
31 | const char *name; | |
32 | const char *args; | |
33 | const enum nl80211_commands cmd; | |
34 | int nl_msg_flags; | |
ce5af55c | 35 | int hidden; |
bd396f2a | 36 | const enum command_identify_by idby; |
5e75fd04 JB |
37 | /* |
38 | * The handler should return a negative error code, | |
39 | * zero on success, 1 if the arguments were wrong | |
40 | * and the usage message should and 2 otherwise. | |
41 | */ | |
70391ccf | 42 | int (*handler)(struct nl_cb *cb, |
bd396f2a JB |
43 | struct nl_msg *msg, |
44 | int argc, char **argv); | |
45 | }; | |
3d1e8704 | 46 | |
7d736016 JB |
47 | #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0])) |
48 | ||
ce5af55c JB |
49 | #define __COMMAND(sect, name, args, nlcmd, flags, hidden, idby, handler)\ |
50 | static const struct cmd \ | |
51 | __cmd_ ## handler ## _ ## nlcmd ## _ ## idby ## _ ## hidden \ | |
f5f937fb | 52 | __attribute__((used)) __attribute__((section("__cmd"))) \ |
ce5af55c | 53 | = { sect, name, args, nlcmd, flags, hidden, idby, handler } |
bd396f2a | 54 | #define COMMAND(section, name, args, cmd, flags, idby, handler) \ |
ce5af55c JB |
55 | __COMMAND(#section, #name, args, cmd, flags, 0, idby, handler) |
56 | #define HIDDEN(section, name, args, cmd, flags, idby, handler) \ | |
57 | __COMMAND(#section, #name, args, cmd, flags, 1, idby, handler) | |
bd396f2a | 58 | #define TOPLEVEL(name, args, cmd, flags, idby, handler) \ |
ce5af55c | 59 | __COMMAND(NULL, #name, args, cmd, flags, 0, idby, handler) |
bd396f2a JB |
60 | extern struct cmd __start___cmd; |
61 | extern struct cmd __stop___cmd; | |
14a0380d | 62 | |
3d1e8704 LCC |
63 | int mac_addr_a2n(unsigned char *mac_addr, char *arg); |
64 | int mac_addr_n2a(char *mac_addr, unsigned char *arg); | |
65 | ||
541ef425 | 66 | const char *iftype_name(enum nl80211_iftype iftype); |
379f8397 JB |
67 | int ieee80211_channel_to_frequency(int chan); |
68 | int ieee80211_frequency_to_channel(int freq); | |
541ef425 | 69 | |
2c61ba61 JB |
70 | int nl_get_multicast_id(struct nl_handle *handle, const char *family, const char *group); |
71 | ||
cad53b3f | 72 | #endif /* __IW_H */ |