Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 1 | #include <errno.h> |
| 2 | #include <string.h> |
| 3 | |
| 4 | #include "nl80211.h" |
| 5 | #include "iw.h" |
| 6 | |
| 7 | SECTION(ocb); |
| 8 | |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 9 | static int join_ocb(struct nl80211_state *state, |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 10 | struct nl_msg *msg, int argc, char **argv, |
| 11 | enum id_input id) |
| 12 | { |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 13 | struct chandef chandef; |
| 14 | int err, parsed; |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 15 | |
| 16 | if (argc < 2) |
| 17 | return 1; |
| 18 | |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 19 | err = parse_freqchan(&chandef, false, argc, argv, &parsed); |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 20 | |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 21 | if (err) |
| 22 | return err; |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 23 | |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 24 | err = put_chandef(msg, &chandef); |
| 25 | if (err) |
| 26 | return err; |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 27 | |
| 28 | return 0; |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 29 | } |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 30 | COMMAND(ocb, join, "<freq in MHz> <5MHz|10MHz>", |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 31 | NL80211_CMD_JOIN_OCB, 0, CIB_NETDEV, join_ocb, |
| 32 | "Join the OCB mode network."); |
| 33 | |
Sunil Ravi | 44e0e58 | 2022-03-05 11:09:09 -0800 | [diff] [blame] | 34 | static int leave_ocb(struct nl80211_state *state, |
Rostislav Lisovy | 3955e52 | 2015-01-12 13:49:57 +0100 | [diff] [blame] | 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."); |