Johannes Berg | 1159679 | 2011-07-15 23:13:59 +0200 | [diff] [blame] | 1 | #include <net/if.h> |
| 2 | #include <errno.h> |
| 3 | #include <string.h> |
| 4 | |
| 5 | #include <netlink/genl/genl.h> |
| 6 | #include <netlink/genl/family.h> |
| 7 | #include <netlink/genl/ctrl.h> |
| 8 | #include <netlink/msg.h> |
| 9 | #include <netlink/attr.h> |
| 10 | |
| 11 | #include "nl80211.h" |
| 12 | #include "iw.h" |
| 13 | |
| 14 | SECTION(roc); |
| 15 | |
| 16 | static int handle_roc_start(struct nl80211_state *state, struct nl_cb *cb, |
Johannes Berg | 05514f9 | 2012-07-19 11:50:50 +0200 | [diff] [blame] | 17 | struct nl_msg *msg, int argc, char **argv, |
| 18 | enum id_input id) |
Johannes Berg | 1159679 | 2011-07-15 23:13:59 +0200 | [diff] [blame] | 19 | { |
| 20 | char *end; |
| 21 | int freq, time; |
| 22 | |
| 23 | if (argc != 2) |
| 24 | return 1; |
| 25 | |
| 26 | freq = strtol(argv[0], &end, 0); |
| 27 | if (!end || *end) |
| 28 | return 1; |
| 29 | |
| 30 | time = strtol(argv[1], &end, 0); |
| 31 | if (!end || *end) |
| 32 | return 1; |
| 33 | |
| 34 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); |
| 35 | NLA_PUT_U32(msg, NL80211_ATTR_DURATION, time); |
| 36 | return 0; |
| 37 | nla_put_failure: |
| 38 | return -ENOBUFS; |
| 39 | } |
| 40 | |
Pontus Fuchs | 894d57b | 2012-11-13 12:09:22 +0100 | [diff] [blame] | 41 | COMMAND(roc, start, "<freq> <time in ms>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, ""); |