diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-27 01:35:46 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-27 01:35:46 +0000 |
| commit | eceb106640e0279ed89e476c25f37f3b2da860fc (patch) | |
| tree | b12bbe56de2a2ad613a8880ae1b7d825a7fd992e /lib/command_graph.h | |
| parent | a53fbbf5f0e52793c262f9326340a606cf37500f (diff) | |
lib: Add matching and argv support
Queries may be run against DFA's to find matching
cmd_element, and argument lists may be constructed.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_graph.h')
| -rw-r--r-- | lib/command_graph.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/command_graph.h b/lib/command_graph.h index e57c078688..f0ded21262 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -1,8 +1,7 @@ #ifndef COMMAND_GRAPH_H #define COMMAND_GRAPH_H -#include "vty.h" -#include "vector.h" +#include "command.h" enum graph_node_type { @@ -22,18 +21,19 @@ enum graph_node_type struct graph_node { - enum graph_node_type type; - vector children; - int is_root; // true if first token in command + enum graph_node_type type;// data type this node matches or holds + int is_start; // whether this node is a start node + vector children; // this node's children struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - // cmd_element struct pointer, only valid for END_GN - struct cmd_element *element; - - /* various data fields for nodes */ char* text; // for WORD_GN and VARIABLE_GN - long value; // for NUMBER_GN - long min, max; // for RANGE_GN + long value; // for NUMBER_GN + long min, max; // for RANGE_GN + + /* cmd_element struct pointer, only valid for END_GN */ + struct cmd_element *element; + /* used for passing arguments to command functions */ + char *arg; }; /* @@ -91,4 +91,11 @@ walk_graph(struct graph_node *, int); */ extern char * describe_node(struct graph_node *, char *, unsigned int); + +/** + * Frees the data associated with a graph_node. + * @param[out] pointer to graph_node to free + */ +void +free_node(struct graph_node *); #endif |
