]>
Commit | Line | Data |
---|---|---|
6829308d JB |
1 | #include <errno.h> |
2 | ||
3 | #include <netlink/genl/genl.h> | |
4 | #include <netlink/genl/family.h> | |
5 | #include <netlink/genl/ctrl.h> | |
6 | #include <netlink/msg.h> | |
7 | #include <netlink/attr.h> | |
8 | ||
9 | #include "nl80211.h" | |
10 | #include "iw.h" | |
11 | ||
12 | static int offchannel(struct nl80211_state *state, struct nl_cb *cb, | |
13 | struct nl_msg *msg, int argc, char **argv) | |
14 | { | |
15 | char *end; | |
16 | ||
17 | /* freq */ | |
18 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, | |
19 | strtoul(argv[0], &end, 10)); | |
20 | if (*end != '\0') | |
21 | return 1; | |
22 | argv++; | |
23 | argc--; | |
24 | ||
25 | /* duration */ | |
26 | NLA_PUT_U32(msg, NL80211_ATTR_DURATION, | |
27 | strtoul(argv[0], &end, 10)); | |
28 | if (*end != '\0') | |
29 | return 1; | |
30 | argv++; | |
31 | argc--; | |
32 | ||
33 | if (argc) | |
34 | return 1; | |
35 | ||
36 | return 0; | |
37 | nla_put_failure: | |
38 | return -ENOSPC; | |
39 | } | |
40 | ||
41 | TOPLEVEL(offchannel, "<freq> <duration>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, | |
42 | CIB_NETDEV, offchannel, | |
43 | "Leave operating channel and go to the given channel for a while."); |