vaseboot/include/VasEBoot/extcmd.h

87 lines
3.0 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_EXTCMD_HEADER
#define VAS_EBOOT_EXTCMD_HEADER 1
#include <VasEBoot/lib/arg.h>
#include <VasEBoot/command.h>
#include <VasEBoot/script_sh.h>
struct VasEBoot_extcmd;
struct VasEBoot_extcmd_context;
typedef VasEBoot_err_t (*VasEBoot_extcmd_func_t) (struct VasEBoot_extcmd_context *ctxt,
int argc, char **args);
/* The argcmd description. */
struct VasEBoot_extcmd
{
VasEBoot_command_t cmd;
VasEBoot_extcmd_func_t func;
/* The argument parser optionlist. */
const struct VasEBoot_arg_option *options;
void *data;
};
typedef struct VasEBoot_extcmd *VasEBoot_extcmd_t;
/* Command context for each instance of execution. */
struct VasEBoot_extcmd_context
{
struct VasEBoot_extcmd *extcmd;
struct VasEBoot_arg_list *state;
/* Script parameter, if any. */
struct VasEBoot_script *script;
};
typedef struct VasEBoot_extcmd_context *VasEBoot_extcmd_context_t;
VasEBoot_extcmd_t EXPORT_FUNC(VasEBoot_register_extcmd) (const char *name,
VasEBoot_extcmd_func_t func,
VasEBoot_command_flags_t flags,
const char *summary,
const char *description,
const struct VasEBoot_arg_option *parser);
VasEBoot_extcmd_t EXPORT_FUNC(VasEBoot_register_extcmd_lockdown) (const char *name,
VasEBoot_extcmd_func_t func,
VasEBoot_command_flags_t flags,
const char *summary,
const char *description,
const struct VasEBoot_arg_option *parser);
VasEBoot_extcmd_t EXPORT_FUNC(VasEBoot_register_extcmd_prio) (const char *name,
VasEBoot_extcmd_func_t func,
VasEBoot_command_flags_t flags,
const char *summary,
const char *description,
const struct VasEBoot_arg_option *parser,
int prio);
void EXPORT_FUNC(VasEBoot_unregister_extcmd) (VasEBoot_extcmd_t cmd);
VasEBoot_err_t EXPORT_FUNC(VasEBoot_extcmd_dispatcher) (struct VasEBoot_command *cmd,
int argc, char **args,
struct VasEBoot_script *script);
#endif /* ! VAS_EBOOT_EXTCMD_HEADER */