summaryrefslogtreecommitdiff
path: root/lib/command.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command.h')
-rw-r--r--lib/command.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/command.h b/lib/command.h
index 7051e1ca5c..523d1a2e4c 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -82,6 +82,7 @@ enum node_type
RIPNG_NODE, /* RIPng protocol mode node. */
BGP_NODE, /* BGP protocol mode which includes BGP4+ */
BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */
+ BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */
BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */
BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */
BGP_IPV6_NODE, /* BGP IPv6 address family */
@@ -152,10 +153,28 @@ enum cmd_token_type
TOKEN_KEYWORD,
};
+enum cmd_terminal_type
+{
+ _TERMINAL_BUG = 0,
+ TERMINAL_LITERAL,
+ TERMINAL_OPTION,
+ TERMINAL_VARIABLE,
+ TERMINAL_VARARG,
+ TERMINAL_RANGE,
+ TERMINAL_IPV4,
+ TERMINAL_IPV4_PREFIX,
+ TERMINAL_IPV6,
+ TERMINAL_IPV6_PREFIX,
+};
+
+/* argument to be recorded on argv[] if it's not a literal */
+#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION)
+
/* Command description structure. */
struct cmd_token
{
enum cmd_token_type type;
+ enum cmd_terminal_type terminal;
/* Used for type == MULTIPLE */
vector multiple; /* vector of cmd_token, type == FINAL */
@@ -454,16 +473,6 @@ struct cmd_token
#define CMD_CREATE_STR_HELPER(s) #s
#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">"
-#define CMD_OPTION(S) ((S[0]) == '[')
-#define CMD_VARIABLE(S) (((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == '<'))
-#define CMD_VARARG(S) ((S[0]) == '.')
-#define CMD_RANGE(S) ((S[0] == '<'))
-
-#define CMD_IPV4(S) ((strcmp ((S), "A.B.C.D") == 0))
-#define CMD_IPV4_PREFIX(S) ((strcmp ((S), "A.B.C.D/M") == 0))
-#define CMD_IPV6(S) ((strcmp ((S), "X:X::X:X") == 0))
-#define CMD_IPV6_PREFIX(S) ((strcmp ((S), "X:X::X:X/M") == 0))
-
/* Common descriptions. */
#define SHOW_STR "Show running system information\n"
#define IP_STR "IP information\n"
@@ -550,6 +559,7 @@ extern vector cmd_make_strvec (const char *);
extern void cmd_free_strvec (vector);
extern vector cmd_describe_command (vector, struct vty *, int *status);
extern char **cmd_complete_command (vector, struct vty *, int *status);
+extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib);
extern const char *cmd_prompt (enum node_type);
extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node);
extern int config_from_file (struct vty *, FILE *, unsigned int *line_num);