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