2 * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
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.
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.
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
20 #include <ipxe/netdevice.h>
21 #include <ipxe/command.h>
22 #include <ipxe/parseopt.h>
23 #include <hci/ifmgmt_cmd.h>
26 FILE_LICENCE ( GPL2_OR_LATER );
34 /** "startpxe" options */
35 struct startpxe_options {};
37 /** "startpxe" option list */
38 static struct option_descriptor startpxe_opts[] = {};
43 * @v netdev Network device
44 * @v opts Command options
45 * @ret rc Return status code
47 static int startpxe_payload ( struct net_device *netdev,
48 struct startpxe_options *opts __unused ) {
50 if ( netdev_is_open ( netdev ) )
51 pxe_activate ( netdev );
56 /** "startpxe" command descriptor */
57 static struct ifcommon_command_descriptor startpxe_cmd =
58 IFCOMMON_COMMAND_DESC ( struct startpxe_options, startpxe_opts,
59 0, MAX_ARGUMENTS, "[<interface>]",
60 startpxe_payload, 0 );
63 * The "startpxe" command
65 * @v argc Argument count
66 * @v argv Argument list
67 * @ret rc Return status code
69 static int startpxe_exec ( int argc, char **argv ) {
70 return ifcommon_exec ( argc, argv, &startpxe_cmd );
73 /** "stoppxe" options */
74 struct stoppxe_options {};
76 /** "stoppxe" option list */
77 static struct option_descriptor stoppxe_opts[] = {};
79 /** "stoppxe" command descriptor */
80 static struct command_descriptor stoppxe_cmd =
81 COMMAND_DESC ( struct stoppxe_options, stoppxe_opts, 0, 0, NULL );
84 * The "stoppxe" command
86 * @v argc Argument count
87 * @v argv Argument list
88 * @ret rc Return status code
90 static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
91 struct stoppxe_options opts;
95 if ( ( rc = parse_options ( argc, argv, &stoppxe_cmd, &opts ) ) != 0 )
104 struct command pxe_commands[] __command = {
107 .exec = startpxe_exec,
111 .exec = stoppxe_exec,