1 /* 2 * Copyright 2008-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 /** @file wifi_shell.h 9 * 10 * @brief WLAN CLI module 11 * 12 * \section cli_usage Usage 13 * The CLI module lets you register commands with the CLI interface. Modules 14 * that wish to register the commands should initialize the struct cli_command 15 * structure and pass this to cli_register_command(). These commands will then 16 * be available on the CLI. 17 * 18 */ 19 20 #ifndef __WIFI_SHELL_H__ 21 #define __WIFI_SHELL_H__ 22 #include <wmtypes.h> 23 24 #define MAX_COMMANDS 200U 25 26 /** Structure for registering CLI commands */ 27 struct cli_command 28 { 29 /** The name of the CLI command */ 30 const char *name; 31 /** The help text associated with the command */ 32 const char *help; 33 /** The function that should be invoked for this command. */ 34 void (*function)(int argc, char **argv); 35 }; 36 37 /** Register a CLI command 38 * 39 * This function registers a command with the command-line interface. 40 * 41 * \param[in] command The structure to register one CLI command 42 * \return 0 on success 43 * \return 1 on failure 44 */ 45 int cli_register_command(const struct cli_command *command); 46 47 /** Unregister a CLI command 48 * 49 * This function unregisters a command from the command-line interface. 50 * 51 * \param[in] command The structure to unregister one CLI command 52 * \return 0 on success 53 * \return 1 on failure 54 */ 55 int cli_unregister_command(const struct cli_command *command); 56 57 /** Register a batch of CLI commands 58 * 59 * Often, a module will want to register several commands. 60 * 61 * \param[in] commands Pointer to an array of commands. 62 * \param[in] num_commands Number of commands in the array. 63 * \return 0 on success 64 * \return 1 on failure 65 */ 66 int cli_register_commands(const struct cli_command *commands, int num_commands); 67 68 /** Unregister a batch of CLI commands 69 * 70 * \param[in] commands Pointer to an array of commands. 71 * \param[in] num_commands Number of commands in the array. 72 * \return 0 on success 73 * \return 1 on failure 74 */ 75 int cli_unregister_commands(const struct cli_command *commands, int num_commands); 76 77 /* 78 * @internal 79 * 80 * CLI help command to print all registered CLIs 81 */ 82 void help_command(int argc, char **argv); 83 84 int nxp_wifi_request(size_t argc, char **argv); 85 86 #endif /* __WIFI_SHELL_H__ */ 87