xref: /aosp_15_r20/external/iw/ocb.c (revision 92022041c981f431db0b590d0c3272306d0ea2a2)
1 #include <errno.h>
2 #include <string.h>
3 
4 #include "nl80211.h"
5 #include "iw.h"
6 
7 SECTION(ocb);
8 
join_ocb(struct nl80211_state * state,struct nl_msg * msg,int argc,char ** argv,enum id_input id)9 static int join_ocb(struct nl80211_state *state,
10 		    struct nl_msg *msg, int argc, char **argv,
11 		    enum id_input id)
12 {
13 	struct chandef chandef;
14 	int err, parsed;
15 
16 	if (argc < 2)
17 		return 1;
18 
19 	err = parse_freqchan(&chandef, false, argc, argv, &parsed);
20 
21 	if (err)
22 		return err;
23 
24 	err = put_chandef(msg, &chandef);
25 	if (err)
26 		return err;
27 
28 	return 0;
29 }
30 COMMAND(ocb, join, "<freq in MHz> <5MHz|10MHz>",
31 	NL80211_CMD_JOIN_OCB, 0, CIB_NETDEV, join_ocb,
32 	"Join the OCB mode network.");
33 
leave_ocb(struct nl80211_state * state,struct nl_msg * msg,int argc,char ** argv,enum id_input id)34 static int leave_ocb(struct nl80211_state *state,
35 		     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 }
43 COMMAND(ocb, leave, NULL, NL80211_CMD_LEAVE_OCB, 0, CIB_NETDEV, leave_ocb,
44 	"Leave the OCB mode network.");
45