|
|
1.1 root 1: /*
2: * Copyright (C) 2009 Joshua Oreman <[email protected]>.
3: *
4: * This program is free software; you can redistribute it and/or
5: * modify it under the terms of the GNU General Public License as
6: * published by the Free Software Foundation; either version 2 of the
7: * License, or any later version.
8: *
9: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17: */
18:
19: FILE_LICENCE ( GPL2_OR_LATER );
20:
21: #include <ipxe/netdevice.h>
22: #include <ipxe/net80211.h>
23: #include <ipxe/command.h>
24: #include <ipxe/parseopt.h>
25: #include <usr/iwmgmt.h>
26: #include <hci/ifmgmt_cmd.h>
27:
28: /** @file
29: *
30: * Wireless interface management commands
31: *
32: */
33:
34: /** "iwstat" command descriptor */
35: static struct command_descriptor iwstat_cmd =
36: COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
37: "[<interface>...]" );
38:
39: /**
40: * "iwstat" payload
41: *
42: * @v netdev Network device
43: * @ret rc Return status code
44: */
45: static int iwstat_payload ( struct net_device *netdev ) {
46: struct net80211_device *dev = net80211_get ( netdev );
47:
48: if ( dev )
49: iwstat ( dev );
50:
51: return 0;
52: }
53:
54: /**
55: * The "iwstat" command
56: *
57: * @v argc Argument count
58: * @v argv Argument list
59: * @ret rc Return status code
60: */
61: static int iwstat_exec ( int argc, char **argv ) {
62: return ifcommon_exec ( argc, argv, &iwstat_cmd, iwstat_payload, 0 );
63: }
64:
65: /** "iwlist" command descriptor */
66: static struct command_descriptor iwlist_cmd =
67: COMMAND_DESC ( struct ifcommon_options, ifcommon_opts, 0, MAX_ARGUMENTS,
68: "[<interface>...]" );
69:
70: /**
71: * "iwlist" payload
72: *
73: * @v netdev Network device
74: * @ret rc Return status code
75: */
76: static int iwlist_payload ( struct net_device *netdev ) {
77: struct net80211_device *dev = net80211_get ( netdev );
78:
79: if ( dev )
80: return iwlist ( dev );
81:
82: return 0;
83: }
84:
85: /**
86: * The "iwlist" command
87: *
88: * @v argc Argument count
89: * @v argv Argument list
90: * @ret rc Return status code
91: */
92: static int iwlist_exec ( int argc, char **argv ) {
93: return ifcommon_exec ( argc, argv, &iwlist_cmd, iwlist_payload, 0 );
94: }
95:
96: /** Wireless interface management commands */
97: struct command iwmgmt_commands[] __command = {
98: {
99: .name = "iwstat",
100: .exec = iwstat_exec,
101: },
102: {
103: .name = "iwlist",
104: .exec = iwlist_exec,
105: },
106: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.