blob: fc9579b8f3d0603bb0c003ec69395e32360b9089 [file] [log] [blame]
Rostislav Lisovy3955e522015-01-12 13:49:57 +01001#include <errno.h>
2#include <string.h>
3
4#include "nl80211.h"
5#include "iw.h"
6
7SECTION(ocb);
8
Sunil Ravi44e0e582022-03-05 11:09:09 -08009static int join_ocb(struct nl80211_state *state,
Rostislav Lisovy3955e522015-01-12 13:49:57 +010010 struct nl_msg *msg, int argc, char **argv,
11 enum id_input id)
12{
Sunil Ravi44e0e582022-03-05 11:09:09 -080013 struct chandef chandef;
14 int err, parsed;
Rostislav Lisovy3955e522015-01-12 13:49:57 +010015
16 if (argc < 2)
17 return 1;
18
Sunil Ravi44e0e582022-03-05 11:09:09 -080019 err = parse_freqchan(&chandef, false, argc, argv, &parsed);
Rostislav Lisovy3955e522015-01-12 13:49:57 +010020
Sunil Ravi44e0e582022-03-05 11:09:09 -080021 if (err)
22 return err;
Rostislav Lisovy3955e522015-01-12 13:49:57 +010023
Sunil Ravi44e0e582022-03-05 11:09:09 -080024 err = put_chandef(msg, &chandef);
25 if (err)
26 return err;
Rostislav Lisovy3955e522015-01-12 13:49:57 +010027
28 return 0;
Rostislav Lisovy3955e522015-01-12 13:49:57 +010029}
Sunil Ravi44e0e582022-03-05 11:09:09 -080030COMMAND(ocb, join, "<freq in MHz> <5MHz|10MHz>",
Rostislav Lisovy3955e522015-01-12 13:49:57 +010031 NL80211_CMD_JOIN_OCB, 0, CIB_NETDEV, join_ocb,
32 "Join the OCB mode network.");
33
Sunil Ravi44e0e582022-03-05 11:09:09 -080034static int leave_ocb(struct nl80211_state *state,
Rostislav Lisovy3955e522015-01-12 13:49:57 +010035 struct nl_msg *msg, int argc, char **argv,
36 enum id_input id)
37{
38 if (argc)
39 return 1;
40
41 return 0;
42}
43COMMAND(ocb, leave, NULL, NL80211_CMD_LEAVE_OCB, 0, CIB_NETDEV, leave_ocb,
44 "Leave the OCB mode network.");