]> git.ipfire.org Git - thirdparty/iw.git/blob - roc.c
update nl80211.h
[thirdparty/iw.git] / roc.c
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
15 static int handle_roc_start(struct nl80211_state *state,
16 struct nl_msg *msg, int argc, char **argv,
17 enum id_input id)
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
40 COMMAND(roc, start, "<freq> <time in ms>", NL80211_CMD_REMAIN_ON_CHANNEL, 0, CIB_NETDEV, handle_roc_start, "");