iPXE
ifmgmt_cmd.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 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#ifndef _IFMGMT_CMD_H
25#define _IFMGMT_CMD_H
26
27FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
28FILE_SECBOOT ( PERMITTED );
29
30#include <ipxe/parseopt.h>
31
32struct net_device;
33
34/** An "if<xxx>" command descriptor */
36 /** Command descriptor */
38 /** Payload
39 *
40 * @v netdev Network device
41 * @v opts Command options
42 * @ret rc Return status code
43 */
44 int ( * payload ) ( struct net_device *netdev, void *opts );
45 /** Stop on first success */
47};
48
49/**
50 * Construct "if<xxx>" command descriptor
51 *
52 * @v _struct Options structure type
53 * @v _options Option descriptor array
54 * @v _check_args Remaining argument checker
55 * @v _usage Command usage
56 * @ret _command Command descriptor
57 */
58#define IFCOMMON_COMMAND_DESC( _struct, _options, _min_args, \
59 _max_args, _usage, _payload, \
60 _stop_on_first_success ) \
61 { \
62 .cmd = COMMAND_DESC ( _struct, _options, _min_args, \
63 _max_args, _usage ), \
64 .payload = ( ( int ( * ) ( struct net_device *netdev, \
65 void *opts ) ) \
66 ( ( ( ( int ( * ) ( struct net_device *, \
67 _struct * ) ) NULL ) \
68 == ( typeof ( _payload ) * ) NULL ) \
69 ? _payload : _payload ) ), \
70 .stop_on_first_success = _stop_on_first_success, \
71 }
72
73extern int ifcommon_exec ( int argc, char **argv,
75extern int ifconf_exec ( int argc, char **argv );
76
77#endif /* _IFMGMT_CMD_H */
struct golan_eqe_cmd cmd
Definition CIB_PRM.h:1
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
int ifconf_exec(int argc, char **argv)
The "ifconf" command.
Definition ifmgmt_cmd.c:250
int ifcommon_exec(int argc, char **argv, struct ifcommon_command_descriptor *cmd)
Execute if<xxx> command.
Definition ifmgmt_cmd.c:52
Command line option parsing.
A command descriptor.
Definition parseopt.h:78
An "if<xxx>" command descriptor.
Definition ifmgmt_cmd.h:35
int(* payload)(struct net_device *netdev, void *opts)
Payload.
Definition ifmgmt_cmd.h:44
struct command_descriptor cmd
Command descriptor.
Definition ifmgmt_cmd.h:37
int stop_on_first_success
Stop on first success.
Definition ifmgmt_cmd.h:46
A network device.
Definition netdevice.h:353