iPXE
pxe_cmd.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
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 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24#include <ipxe/netdevice.h>
25#include <ipxe/command.h>
26#include <ipxe/parseopt.h>
27#include <hci/ifmgmt_cmd.h>
28#include <pxe_call.h>
29
30FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
31
32/** @file
33 *
34 * PXE commands
35 *
36 */
37
38/** "startpxe" options */
40
41/** "startpxe" option list */
42static struct option_descriptor startpxe_opts[] = {};
43
44/**
45 * "startpxe" payload
46 *
47 * @v netdev Network device
48 * @v opts Command options
49 * @ret rc Return status code
50 */
51static int startpxe_payload ( struct net_device *netdev,
53
54 if ( netdev_is_open ( netdev ) )
56
57 return 0;
58}
59
60/** "startpxe" command descriptor */
63 0, MAX_ARGUMENTS, "[<interface>]",
65
66/**
67 * The "startpxe" command
68 *
69 * @v argc Argument count
70 * @v argv Argument list
71 * @ret rc Return status code
72 */
73static int startpxe_exec ( int argc, char **argv ) {
74 return ifcommon_exec ( argc, argv, &startpxe_cmd );
75}
76
77/** "stoppxe" options */
79
80/** "stoppxe" option list */
81static struct option_descriptor stoppxe_opts[] = {};
82
83/** "stoppxe" command descriptor */
86
87/**
88 * The "stoppxe" command
89 *
90 * @v argc Argument count
91 * @v argv Argument list
92 * @ret rc Return status code
93 */
94static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
95 struct stoppxe_options opts;
96 int rc;
97
98 /* Parse options */
99 if ( ( rc = parse_options ( argc, argv, &stoppxe_cmd, &opts ) ) != 0 )
100 return rc;
101
103
104 return 0;
105}
106
107/** PXE commands */
108COMMAND ( startpxe, startpxe_exec );
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
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
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
Network device management.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
Definition netdevice.h:662
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
Command line option parsing.
#define MAX_ARGUMENTS
No maximum number of arguments.
Definition parseopt.h:98
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109
void pxe_activate(struct net_device *netdev)
Activate PXE stack.
Definition pxe_call.c:269
int pxe_deactivate(void)
Deactivate PXE stack.
Definition pxe_call.c:300
PXE API entry point.
static struct ifcommon_command_descriptor startpxe_cmd
"startpxe" command descriptor
Definition pxe_cmd.c:61
static int startpxe_payload(struct net_device *netdev, struct startpxe_options *opts __unused)
"startpxe" payload
Definition pxe_cmd.c:51
static struct command_descriptor stoppxe_cmd
"stoppxe" command descriptor
Definition pxe_cmd.c:84
static int stoppxe_exec(int argc __unused, char **argv __unused)
The "stoppxe" command.
Definition pxe_cmd.c:94
static struct option_descriptor stoppxe_opts[]
"stoppxe" option list
Definition pxe_cmd.c:81
static int startpxe_exec(int argc, char **argv)
The "startpxe" command.
Definition pxe_cmd.c:73
static struct option_descriptor startpxe_opts[]
"startpxe" option list
Definition pxe_cmd.c:42
A command descriptor.
Definition parseopt.h:78
An "if<xxx>" command descriptor.
Definition ifmgmt_cmd.h:35
A network device.
Definition netdevice.h:353
A command-line option descriptor.
Definition parseopt.h:24
"startpxe" options
Definition pxe_cmd.c:39
"stoppxe" options
Definition pxe_cmd.c:78