blob: c6eda103c12acbd067da4a26e5c1128d3a88a9e6 [file] [log] [blame]
Johannes Berg11596792011-07-15 23:13:59 +02001#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
13SECTION(roc);
14
Sunil Ravi44e0e582022-03-05 11:09:09 -080015static int handle_roc_start(struct nl80211_state *state,
Johannes Berg05514f92012-07-19 11:50:50 +020016 struct nl_msg *msg, int argc, char **argv,
17 enum id_input id)
Johannes Berg11596792011-07-15 23:13:59 +020018{
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 Fuchs894d57b2012-11-13 12:09:22 +010040COMMAND(roc, start, "<freq> <time in ms>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");