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