diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-06 17:16:55 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-07-12 15:05:05 +0000 |
| commit | 92055a924a9fe1f8ae730580904487598ae25da9 (patch) | |
| tree | 0a51d78d16605ef6b075cf5271cea166cfe68ad3 /lib/cmdtree.c | |
| parent | 04e64062184c93c35bf004b07004ed4676675679 (diff) | |
lib: Add parser, lexer, and command tree skeleton
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/cmdtree.c')
| -rw-r--r-- | lib/cmdtree.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/cmdtree.c b/lib/cmdtree.c new file mode 100644 index 0000000000..921c6d9cc6 --- /dev/null +++ b/lib/cmdtree.c @@ -0,0 +1,41 @@ +#include <command.h> +#include <vector.h> + +enum tree_node_type +{ + WORD_TN, + IPV4_TN, + IPV4_PREFIX_TN, + IPV6_TN, + IPV6_PREFIX_TN, + VARIABLE_TN, + RANGE_TN, + NUMBER_TN, + SELECTOR_TN, + OPTION_TN +} + +struct tree_node +{ + enum tree_node_type type; + vector children; + int leaf; + (int) (*func(struct cmd_info *, struct vty *, int, const char *[])); +} + +void add_node(struct tree_node *parent, struct tree_node *child) +{ + +} + +// checks nodes for equivalence; definition of equivalence depends +// on node type (WORD_TN strcmps words, etc) +int cmp_node(struct tree_node *first, struct tree_node *second) +{ + +} + +int merge_tree(struct tree_node *first, struct tree_node *second) +{ + +} |
