iPXE
iwmgmt_cmd.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Joshua Oreman <oremanj@rwcr.net>.
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., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 */
19
20FILE_LICENCE ( GPL2_OR_LATER );
21
22#include <ipxe/netdevice.h>
23#include <ipxe/net80211.h>
24#include <ipxe/command.h>
25#include <ipxe/parseopt.h>
26#include <usr/iwmgmt.h>
27#include <hci/ifmgmt_cmd.h>
28
29/** @file
30 *
31 * Wireless interface management commands
32 *
33 */
34
35/** "iwstat" options */
37
38/** "iwstat" option list */
39static struct option_descriptor iwstat_opts[] = {};
40
41/**
42 * "iwstat" payload
43 *
44 * @v netdev Network device
45 * @v opts Command options
46 * @ret rc Return status code
47 */
48static int iwstat_payload ( struct net_device *netdev,
49 struct iwstat_options *opts __unused ) {
50 struct net80211_device *dev = net80211_get ( netdev );
51
52 if ( dev )
53 iwstat ( dev );
54
55 return 0;
56}
57
58/** "iwstat" command descriptor */
61 0, MAX_ARGUMENTS, "[<interface>...]",
62 iwstat_payload, 0 );
63
64/**
65 * The "iwstat" command
66 *
67 * @v argc Argument count
68 * @v argv Argument list
69 * @ret rc Return status code
70 */
71static int iwstat_exec ( int argc, char **argv ) {
72 return ifcommon_exec ( argc, argv, &iwstat_cmd );
73}
74
75/** "iwlist" options */
77
78/** "iwlist" option list */
79static struct option_descriptor iwlist_opts[] = {};
80
81/**
82 * "iwlist" payload
83 *
84 * @v netdev Network device
85 * @v opts Command options
86 * @ret rc Return status code
87 */
88static int iwlist_payload ( struct net_device *netdev,
89 struct iwlist_options *opts __unused ) {
90 struct net80211_device *dev = net80211_get ( netdev );
91
92 if ( dev )
93 return iwlist ( dev );
94
95 return 0;
96}
97
98/** "iwlist" command descriptor */
101 0, MAX_ARGUMENTS, "[<interface>...]",
102 iwlist_payload, 0 );
103
104/**
105 * The "iwlist" command
106 *
107 * @v argc Argument count
108 * @v argv Argument list
109 * @ret rc Return status code
110 */
111static int iwlist_exec ( int argc, char **argv ) {
112 return ifcommon_exec ( argc, argv, &iwlist_cmd );
113}
114
115/** Wireless interface management commands */
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
#define COMMAND(name, exec)
Definition command.h:27
static struct net_device * netdev
Definition gdbudp.c:53
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
struct net80211_device * net80211_get(struct net_device *netdev)
Get 802.11 device from wrapping network device.
Definition net80211.c:625
int ifcommon_exec(int argc, char **argv, struct ifcommon_command_descriptor *ifcmd)
Execute if<xxx> command.
Definition ifmgmt_cmd.c:52
#define IFCOMMON_COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage, _payload, _stop_on_first_success)
Construct "if<xxx>" command descriptor.
Definition ifmgmt_cmd.h:58
int iwlist(struct net80211_device *dev)
Scan for wireless networks using 802.11 device.
Definition iwmgmt.c:120
void iwstat(struct net80211_device *dev)
Print status of 802.11 device.
Definition iwmgmt.c:41
Wireless network interface management.
static int iwstat_payload(struct net_device *netdev, struct iwstat_options *opts __unused)
"iwstat" payload
Definition iwmgmt_cmd.c:48
static struct option_descriptor iwstat_opts[]
"iwstat" option list
Definition iwmgmt_cmd.c:39
static struct ifcommon_command_descriptor iwlist_cmd
"iwlist" command descriptor
Definition iwmgmt_cmd.c:99
static struct ifcommon_command_descriptor iwstat_cmd
"iwstat" command descriptor
Definition iwmgmt_cmd.c:59
static struct option_descriptor iwlist_opts[]
"iwlist" option list
Definition iwmgmt_cmd.c:79
static int iwlist_payload(struct net_device *netdev, struct iwlist_options *opts __unused)
"iwlist" payload
Definition iwmgmt_cmd.c:88
static int iwstat_exec(int argc, char **argv)
The "iwstat" command.
Definition iwmgmt_cmd.c:71
static int iwlist_exec(int argc, char **argv)
The "iwlist" command.
Definition iwmgmt_cmd.c:111
The iPXE 802.11 MAC layer.
Network device management.
Command line option parsing.
#define MAX_ARGUMENTS
No maximum number of arguments.
Definition parseopt.h:98
An "if<xxx>" command descriptor.
Definition ifmgmt_cmd.h:35
"iwlist" options
Definition iwmgmt_cmd.c:76
"iwstat" options
Definition iwmgmt_cmd.c:36
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
A network device.
Definition netdevice.h:353
A command-line option descriptor.
Definition parseopt.h:24