diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-22 19:04:16 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-22 19:04:16 +0000 |
| commit | 880e24a1e4cc78cb23ebdd72f2e5cea861cf8be2 (patch) | |
| tree | fefe79765d2c5932a4083e428843657b9d673edd /lib/command_graph.h | |
| parent | 18be0e599d1ba666e59a3d027e973eb41798f46f (diff) | |
lib: Reorganize some matching stuff
Introduce new node type, END_GN, and remove
is_leaf flags. Reorganize command_match.c & remove
internal functions from command_match.h. Start
rewriting command.h in command_new.h with changes
for new backend.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_graph.h')
| -rw-r--r-- | lib/command_graph.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/command_graph.h b/lib/command_graph.h index 081ecaac4c..ce458d0b29 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -16,7 +16,8 @@ enum graph_node_type NUMBER_GN, SELECTOR_GN, OPTION_GN, - NUL_GN + NUL_GN, + END_GN }; struct graph_node @@ -24,15 +25,15 @@ struct graph_node enum graph_node_type type; vector children; int is_root; // true if first token in command - int is_leaf; // true if last token in command - struct graph_node * end; // pointer to end for selector & option + struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - int (*func)(struct vty *, int, const char *[]); + // cmd_element struct pointer, only valid for END_GN + struct cmd_element *element; /* various data fields for nodes */ - char* text; // for words and variables - int value; // for numbers - int min, max; // for ranges + char* text; // for WORD_GN and VARIABLE_GN + int value; // for NUMBER_GN + int min, max; // for RANGE_GN }; /* @@ -85,8 +86,9 @@ walk_graph(struct graph_node *, int); /** * Returns a string representation of the given node. * @param[in] the node to describe + * @param[out] the buffer to write the description into * @return pointer to description string */ -extern const char * -describe_node(struct graph_node *); +extern char * +describe_node(struct graph_node *, char *, unsigned int); #endif |
