Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / hci / ifmgmt_cmd.h
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
20 #ifndef _IFMGMT_CMD_H
21 #define _IFMGMT_CMD_H
22
23 FILE_LICENCE ( GPL2_OR_LATER );
24
25 #include <ipxe/parseopt.h>
26
27 struct net_device;
28
29 /** An "if<xxx>" command descriptor */
30 struct ifcommon_command_descriptor {
31         /** Command descriptor */
32         struct command_descriptor cmd;
33         /** Payload
34          *
35          * @v netdev            Network device
36          * @v opts              Command options
37          * @ret rc              Return status code
38          */
39         int ( * payload ) ( struct net_device *netdev, void *opts );
40         /** Stop on first success */
41         int stop_on_first_success;
42 };
43
44 /**
45  * Construct "if<xxx>" command descriptor
46  *
47  * @v _struct           Options structure type
48  * @v _options          Option descriptor array
49  * @v _check_args       Remaining argument checker
50  * @v _usage            Command usage
51  * @ret _command        Command descriptor
52  */
53 #define IFCOMMON_COMMAND_DESC( _struct, _options, _min_args,            \
54                                _max_args, _usage, _payload,             \
55                                _stop_on_first_success )                 \
56         {                                                               \
57                 .cmd = COMMAND_DESC ( _struct, _options, _min_args,     \
58                                       _max_args, _usage ),              \
59                 .payload = ( ( int ( * ) ( struct net_device *netdev,   \
60                                            void *opts ) )               \
61                              ( ( ( ( int ( * ) ( struct net_device *,   \
62                                                  _struct * ) ) NULL )   \
63                                  == ( typeof ( _payload ) * ) NULL )    \
64                                ? _payload : _payload ) ),               \
65                 .stop_on_first_success = _stop_on_first_success,        \
66         }
67
68 extern int ifcommon_exec (  int argc, char **argv,
69                             struct ifcommon_command_descriptor *cmd );
70 extern int ifconf_exec ( int argc, char **argv );
71
72 #endif /* _IFMGMT_CMD_H */