]>
git.proxmox.com Git - mirror_frr.git/blob - lib/command_match.h
1 #ifndef COMMAND_MATCH_H
2 #define COMMAND_MATCH_H
5 #include "command_graph.h"
9 /** These definitions exist in command.c in
10 * the current engine but will be relocated
11 * here in the new engine*/
18 /* matcher result value. */
27 /* Completion match types. */
35 /* Defines which matcher_rv values constitute
36 * an error. Should be used against matcher_rv
37 * return values to do basic error checking.
39 #define MATCHER_ERROR(matcher_rv) \
40 ( (matcher_rv) == MATCHER_INCOMPLETE \
41 || (matcher_rv) == MATCHER_NO_MATCH \
42 || (matcher_rv) == MATCHER_AMBIGUOUS \
46 * Attempt to find an exact command match for a line of user input.
48 * @param DFA to match against
50 * @param pointer which will be pointed at argv upon match
51 * @param pointer which will be pointed at matching cmd_element upon match
52 * @return result of matcher run
55 match_command (struct graph_node
*, const char *, struct list
**, struct cmd_element
**);
58 * Compiles next-hops for a given line of user input.
60 * Given a string of input and a start node for a matching DFA, runs the input
61 * against the DFA until the input is exhausted or a mismatch is encountered.
63 * This function returns all valid next hops away from the current node.
64 * - If the input is a valid prefix to a longer command(s), the set of next
65 * hops determines what tokens are valid to follow the prefix. In other words,
66 * the returned list is a list of possible completions.
67 * - If the input matched a full command, exactly one of the next hops will be
68 * a node of type END_GN and its function pointer will be set.
69 * - If the input did not match any valid token sequence, the returned list
70 * will be empty (there are no transitions away from a nonexistent state).
72 * @param[in] start the start node of the DFA to match against
73 * @param[in] filter the filtering method
74 * @param[in] input the input string
75 * @return pointer to linked list with all possible next hops from the last
76 * matched token. If this is empty, the input did not match any command.
79 match_command_complete (struct graph_node
*, const char *);