Channel protocol parser and commands. More...
#include "parser.h"#include "cfg/cfg_parser.h"#include <io/kfile.h>#include <struct/hashtable.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Functions | |
| static const void * | get_key_from_command (const void *cmd, uint8_t *length) |
| Hashtable hook to extract the key from a command. | |
| DECLARE_HASHTABLE_STATIC (commands, CONFIG_MAX_COMMANDS_NUMBER, get_key_from_command) | |
| Hashtable that handles the commands that can be executed. | |
| bool | get_word (const char **begin, const char **end) |
| Tokenize one word at a time from a text. | |
| static bool | parseArgs (const char *fmt, const char *input, parms argv[]) |
| Command arguments parser. | |
| const char * | parser_rl_match (UNUSED_ARG(void *, dummy), const char *word, int word_len) |
| Hook provided by the parser for matching of command names (TAB completion) for readline. | |
| struct CmdTemplate * | parser_get_cmd_template (const char *input) |
| Find the template for the command contained in the text line. | |
| bool | parser_get_cmd_arguments (const char *input, const struct CmdTemplate *cmdp, parms args[CONFIG_PARSER_MAX_ARGS]) |
| Extract the arguments for the command contained in the text line. | |
| bool | parser_process_line (const char *input) |
| Command input handler. | |
| bool | parser_register_cmd (const struct CmdTemplate *cmd) |
| Register a new command into the parser. | |
| void | parser_init (void) |
| Initialize the parser module. | |
Detailed Description
Channel protocol parser and commands.
This file contains the channel protocol parser and the definition of the protocol commands. Commands are defined in a "CmdTemplate" type array, containing:
- the name of the command,
- the arguments it expects to receive,
- the output values,
- the name of the function implementing the command.
The arguments and results are passed to command function using an union: the element of the union to use for each argument is determined by format strings present in the CmdTemplate table.
Definition in file parser.c.
Function Documentation
| static bool parseArgs | ( | const char * | fmt, |
| const char * | input, | ||
| parms | argv[] | ||
| ) | [static] |
Command arguments parser.
Using the format pointed by the argument fmt parses the input string filling the array argv with input parameters of the correct type.
- Parameters:
-
fmt Parameters format string. input Input string. argv Array filled with parameters.
- Returns:
- False in case of errors, otherwise true.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)