blob: c2beb96e56326a81a52c1cc155ef6b4af513a005 [file] [log] [blame]
Johannes Berg11596792011-07-15 23:13:59 +02001#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
14SECTION(roc);
15
16static int handle_roc_start(struct nl80211_state *state, struct nl_cb *cb,
Johannes Berg05514f92012-07-19 11:50:50 +020017 struct nl_msg *msg, int argc, char **argv,
18 enum id_input id)
Johannes Berg11596792011-07-15 23:13:59 +020019{
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 Fuchs894d57b2012-11-13 12:09:22 +010041COMMAND(roc, start, "<freq> <time in ms>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");