]> git.proxmox.com Git - mirror_frr.git/blame - lib/command.h
Revert "vtysh: Make vtysh run as quagga user"
[mirror_frr.git] / lib / command.h
CommitLineData
718e3744 1/*
2 * Zebra configuration command interface routine
3 * Copyright (C) 1997, 98 Kunihiro Ishiguro
4 *
5 * This file is part of GNU Zebra.
6 *
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23#ifndef _ZEBRA_COMMAND_H
24#define _ZEBRA_COMMAND_H
25
26#include "vector.h"
27#include "vty.h"
9c42a6eb 28#include "lib/route_types.h"
4a1ab8e4 29#include "memory.h"
274f29b2 30#include "hash.h"
4a1ab8e4
DL
31
32DECLARE_MTYPE(HOST)
33
34/* for test-commands.c */
35DECLARE_MTYPE(STRVEC)
718e3744 36
37/* Host configuration variable */
38struct host
39{
40 /* Host name of this router. */
41 char *name;
42
43 /* Password for vty interface. */
44 char *password;
45 char *password_encrypt;
46
47 /* Enable password */
48 char *enable;
49 char *enable_encrypt;
50
51 /* System wide terminal lines. */
52 int lines;
53
54 /* Log filename. */
55 char *logfile;
56
718e3744 57 /* config file name of this host */
58 char *config;
59
60 /* Flags for services */
61 int advanced;
62 int encrypt;
63
64 /* Banner configuration. */
8c328f11 65 const char *motd;
3b0c5d9a 66 char *motdfile;
718e3744 67};
68
69/* There are some command levels which called from command node. */
70enum node_type
71{
72 AUTH_NODE, /* Authentication mode of vty interface. */
73 VIEW_NODE, /* View node. Default mode of vty interface. */
74 AUTH_ENABLE_NODE, /* Authentication mode for change enable. */
75 ENABLE_NODE, /* Enable node. */
76 CONFIG_NODE, /* Config node. Default mode of config file. */
e7168df4 77 SERVICE_NODE, /* Service node. */
718e3744 78 DEBUG_NODE, /* Debug node. */
19dc275e 79 VRF_DEBUG_NODE, /* Vrf Debug node. */
65efcfce 80 DEBUG_VNC_NODE, /* Debug VNC node. */
718e3744 81 AAA_NODE, /* AAA node. */
82 KEYCHAIN_NODE, /* Key-chain node. */
83 KEYCHAIN_KEY_NODE, /* Key-chain key node. */
13460c44 84 NS_NODE, /* Logical-Router node. */
f93e3f69 85 VRF_NODE, /* VRF mode node. */
dfa857a5 86 INTERFACE_NODE, /* Interface mode node. */
718e3744 87 ZEBRA_NODE, /* zebra connection node. */
88 TABLE_NODE, /* rtm_table selection node. */
89 RIP_NODE, /* RIP protocol mode node. */
90 RIPNG_NODE, /* RIPng protocol mode node. */
91 BGP_NODE, /* BGP protocol mode which includes BGP4+ */
92 BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */
8ecd3266 93 BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */
718e3744 94 BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */
95 BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */
96 BGP_IPV6_NODE, /* BGP IPv6 address family */
1e836590 97 BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */
8b1fb8be
LB
98 BGP_ENCAP_NODE, /* BGP ENCAP SAFI */
99 BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */
65efcfce
LB
100 BGP_VNC_DEFAULTS_NODE, /* BGP VNC nve defaults */
101 BGP_VNC_NVE_GROUP_NODE, /* BGP VNC nve group */
102 BGP_VNC_L2_GROUP_NODE, /* BGP VNC L2 group */
103 RFP_DEFAULTS_NODE, /* RFP defaults node */
718e3744 104 OSPF_NODE, /* OSPF protocol mode */
105 OSPF6_NODE, /* OSPF protocol for IPv6 mode */
eac6e3f0
RW
106 LDP_NODE, /* LDP protocol mode */
107 LDP_IPV4_NODE, /* LDP IPv4 address family */
108 LDP_IPV6_NODE, /* LDP IPv6 address family */
109 LDP_IPV4_IFACE_NODE, /* LDP IPv4 Interface */
110 LDP_IPV6_IFACE_NODE, /* LDP IPv6 Interface */
111 LDP_L2VPN_NODE, /* LDP L2VPN node */
112 LDP_PSEUDOWIRE_NODE, /* LDP Pseudowire node */
9e867fe6 113 ISIS_NODE, /* ISIS protocol mode */
12e41d03 114 PIM_NODE, /* PIM protocol mode */
718e3744 115 MASC_NODE, /* MASC for multicast. */
116 IRDP_NODE, /* ICMP Router Discovery Protocol mode. */
117 IP_NODE, /* Static ip route node. */
118 ACCESS_NODE, /* Access list node. */
119 PREFIX_NODE, /* Prefix list node. */
120 ACCESS_IPV6_NODE, /* Access list node. */
121 PREFIX_IPV6_NODE, /* Prefix list node. */
122 AS_LIST_NODE, /* AS list node. */
123 COMMUNITY_LIST_NODE, /* Community list node. */
124 RMAP_NODE, /* Route map node. */
125 SMUX_NODE, /* SNMP configuration node. */
126 DUMP_NODE, /* Packet dump node. */
127 FORWARDING_NODE, /* IP forwarding node. */
7514fb77 128 PROTOCOL_NODE, /* protocol filtering node */
7758e3f3 129 MPLS_NODE, /* MPLS config node */
62687ff1 130 VTY_NODE, /* Vty node. */
16f1b9ee 131 LINK_PARAMS_NODE, /* Link-parameters node */
718e3744 132};
133
134/* Node which has some commands and prompt string and configuration
135 function pointer . */
136struct cmd_node
137{
138 /* Node index. */
139 enum node_type node;
140
141 /* Prompt character at vty interface. */
8c328f11 142 const char *prompt;
718e3744 143
144 /* Is this node's configuration goes to vtysh ? */
145 int vtysh;
146
147 /* Node's configuration write function */
148 int (*func) (struct vty *);
149
150 /* Vector of this node's command list. */
274f29b2
PJ
151 vector cmd_vector;
152
153 /* Hashed index of command node list, for de-dupping primarily */
154 struct hash *cmd_hash;
718e3744 155};
156
406d6716 157enum
158{
9c5d8562 159 CMD_ATTR_DEPRECATED = 1,
406d6716 160 CMD_ATTR_HIDDEN,
161};
162
718e3744 163/* Structure of command element. */
164struct cmd_element
165{
8c328f11 166 const char *string; /* Command specification by string. */
9035efaa 167 int (*func) (struct cmd_element *, struct vty *, int, const char *[]);
8c328f11 168 const char *doc; /* Documentation of this command. */
718e3744 169 int daemon; /* Daemon to which this command belong. */
cd40b329 170 vector tokens; /* Vector of cmd_tokens */
406d6716 171 u_char attr; /* Command attributes */
718e3744 172};
173
cd40b329
CF
174
175enum cmd_token_type
176{
177 TOKEN_TERMINAL = 0,
178 TOKEN_MULTIPLE,
179 TOKEN_KEYWORD,
180};
181
c117e027
DL
182enum cmd_terminal_type
183{
184 _TERMINAL_BUG = 0,
185 TERMINAL_LITERAL,
186 TERMINAL_OPTION,
187 TERMINAL_VARIABLE,
188 TERMINAL_VARARG,
189 TERMINAL_RANGE,
190 TERMINAL_IPV4,
191 TERMINAL_IPV4_PREFIX,
192 TERMINAL_IPV6,
193 TERMINAL_IPV6_PREFIX,
194};
195
27e7f290
DL
196/* argument to be recorded on argv[] if it's not a literal */
197#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION)
198
718e3744 199/* Command description structure. */
cd40b329 200struct cmd_token
718e3744 201{
cd40b329 202 enum cmd_token_type type;
c117e027 203 enum cmd_terminal_type terminal;
cd40b329
CF
204
205 /* Used for type == MULTIPLE */
206 vector multiple; /* vector of cmd_token, type == FINAL */
207
208 /* Used for type == KEYWORD */
209 vector keyword; /* vector of vector of cmd_tokens */
210
211 /* Used for type == TERMINAL */
228da428 212 char *cmd; /* Command string. */
cd40b329 213 char *desc; /* Command's description. */
718e3744 214};
215
216/* Return value of the commands. */
217#define CMD_SUCCESS 0
218#define CMD_WARNING 1
219#define CMD_ERR_NO_MATCH 2
220#define CMD_ERR_AMBIGUOUS 3
221#define CMD_ERR_INCOMPLETE 4
222#define CMD_ERR_EXEED_ARGC_MAX 5
223#define CMD_ERR_NOTHING_TODO 6
224#define CMD_COMPLETE_FULL_MATCH 7
225#define CMD_COMPLETE_MATCH 8
226#define CMD_COMPLETE_LIST_MATCH 9
227#define CMD_SUCCESS_DAEMON 10
1db63918 228#define CMD_ERR_NO_FILE 11
95c4aff2 229#define CMD_SUSPEND 12
718e3744 230
231/* Argc max counts. */
232#define CMD_ARGC_MAX 25
233
234/* Turn off these macros when uisng cpp with extract.pl */
235#ifndef VTYSH_EXTRACT_PL
236
406d6716 237/* helper defines for end-user DEFUN* macros */
238#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \
718e3744 239 struct cmd_element cmdname = \
240 { \
9035efaa 241 .string = cmdstr, \
242 .func = funcname, \
406d6716 243 .doc = helpstr, \
244 .attr = attrs, \
245 .daemon = dnum, \
246 };
247
248#define DEFUN_CMD_FUNC_DECL(funcname) \
34204aac 249 static int funcname (struct cmd_element *, struct vty *, int, const char *[]);
406d6716 250
251#define DEFUN_CMD_FUNC_TEXT(funcname) \
274a4a44 252 static int funcname \
6cf0cf0c
PJ
253 (struct cmd_element *self __attribute__ ((unused)), \
254 struct vty *vty __attribute__ ((unused)), \
255 int argc __attribute__ ((unused)), \
256 const char *argv[] __attribute__ ((unused)) )
406d6716 257
cd40b329
CF
258/* DEFUN for vty command interafce. Little bit hacky ;-).
259 *
260 * DEFUN(funcname, cmdname, cmdstr, helpstr)
261 *
262 * funcname
263 * ========
264 *
265 * Name of the function that will be defined.
266 *
267 * cmdname
268 * =======
269 *
270 * Name of the struct that will be defined for the command.
271 *
272 * cmdstr
273 * ======
274 *
275 * The cmdstr defines the command syntax. It is used by the vty subsystem
276 * and vtysh to perform matching and completion in the cli. So you have to take
277 * care to construct it adhering to the following grammar. The names used
278 * for the production rules losely represent the names used in lib/command.c
279 *
280 * cmdstr = cmd_token , { " " , cmd_token } ;
281 *
282 * cmd_token = cmd_terminal
283 * | cmd_multiple
284 * | cmd_keyword ;
285 *
286 * cmd_terminal_fixed = fixed_string
287 * | variable
288 * | range
289 * | ipv4
290 * | ipv4_prefix
291 * | ipv6
292 * | ipv6_prefix ;
293 *
294 * cmd_terminal = cmd_terminal_fixed
295 * | option
296 * | vararg ;
297 *
298 * multiple_part = cmd_terminal_fixed ;
299 * cmd_multiple = "(" , multiple_part , ( "|" | { "|" , multiple_part } ) , ")" ;
300 *
301 * keyword_part = fixed_string , { " " , ( cmd_terminal_fixed | cmd_multiple ) } ;
302 * cmd_keyword = "{" , keyword_part , { "|" , keyword_part } , "}" ;
303 *
304 * lowercase = "a" | ... | "z" ;
305 * uppercase = "A" | ... | "Z" ;
306 * digit = "0" | ... | "9" ;
307 * number = digit , { digit } ;
308 *
309 * fixed_string = (lowercase | digit) , { lowercase | digit | uppercase | "-" | "_" } ;
310 * variable = uppercase , { uppercase | "_" } ;
311 * range = "<" , number , "-" , number , ">" ;
312 * ipv4 = "A.B.C.D" ;
313 * ipv4_prefix = "A.B.C.D/M" ;
314 * ipv6 = "X:X::X:X" ;
315 * ipv6_prefix = "X:X::X:X/M" ;
316 * option = "[" , variable , "]" ;
317 * vararg = "." , variable ;
318 *
319 * To put that all in a textual description: A cmdstr is a sequence of tokens,
320 * separated by spaces.
321 *
322 * Terminal Tokens:
323 *
324 * A very simple cmdstring would be something like: "show ip bgp". It consists
325 * of three Terminal Tokens, each containing a fixed string. When this command
326 * is called, no arguments will be passed down to the function implementing it,
327 * as it only consists of fixed strings.
328 *
329 * Apart from fixed strings, Terminal Tokens can also contain variables:
330 * An example would be "show ip bgp A.B.C.D". This command expects an IPv4
331 * as argument. As this is a variable, the IP address entered by the user will
332 * be passed down as an argument. Apart from two exceptions, the other options
333 * for Terminal Tokens behave exactly as we just discussed and only make a
334 * difference for the CLI. The two exceptions will be discussed in the next
335 * paragraphs.
336 *
337 * A Terminal Token can contain a so called option match. This is a simple
338 * string variable that the user may omit. An example would be:
339 * "show interface [IFNAME]". If the user calls this without an interface as
340 * argument, no arguments will be passed down to the function implementing
341 * this command. Otherwise, the interface name will be provided to the function
342 * as a regular argument.
343
344 * Also, a Terminal Token can contain a so called vararg. This is used e.g. in
345 * "show ip bgp regexp .LINE". The last token is a vararg match and will
346 * consume all the arguments the user inputs on the command line and append
347 * those to the list of arguments passed down to the function implementing this
348 * command. (Therefore, it doesn't make much sense to have any tokens after a
349 * vararg because the vararg will already consume all the words the user entered
350 * in the CLI)
351 *
352 * Multiple Tokens:
353 *
354 * The Multiple Token type can be used if there are multiple possibilities what
355 * arguments may be used for a command, but it should map to the same function
356 * nonetheless. An example would be "ip route A.B.C.D/M (reject|blackhole)"
357 * In that case both "reject" and "blackhole" would be acceptable as last
358 * arguments. The words matched by Multiple Tokens are always added to the
359 * argument list, even if they are matched by fixed strings. Such a Multiple
360 * Token can contain almost any type of token that would also be acceptable
361 * for a Terminal Token, the exception are optional variables and varag.
362 *
363 * There is one special case that is used in some places of Quagga that should be
364 * pointed out here shortly. An example would be "password (8|) WORD". This
365 * construct is used to have fixed strings communicated as arguments. (The "8"
366 * will be passed down as an argument in this case) It does not mean that
367 * the "8" is optional. Another historic and possibly surprising property of
368 * this construct is that it consumes two parts of helpstr. (Help
369 * strings will be explained later)
370 *
371 * Keyword Tokens:
372 *
373 * There are commands that take a lot of different and possibly optional arguments.
374 * An example from ospf would be the "default-information originate" command. This
375 * command takes a lot of optional arguments that may be provided in any order.
376 * To accomodate such commands, the Keyword Token has been implemented.
377 * Using the keyword token, the "default-information originate" command and all
378 * its possible options can be represented using this single cmdstr:
379 * "default-information originate \
380 * {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}"
381 *
382 * Keywords always start with a fixed string and may be followed by arguments.
383 * Except optional variables and vararg, everything is permitted here.
384 *
385 * For the special case of a keyword without arguments, either NULL or the
386 * keyword itself will be pushed as an argument, depending on whether the
387 * keyword is present.
388 * For the other keywords, arguments will be only pushed for
389 * variables/Multiple Tokens. If the keyword is not present, the arguments that
390 * would have been pushed will be substituted by NULL.
391 *
392 * A few examples:
393 * "default information originate metric-type 1 metric 1000"
394 * would yield the following arguments:
395 * { NULL, "1000", "1", NULL }
396 *
397 * "default information originate always route-map RMAP-DEFAULT"
398 * would yield the following arguments:
399 * { "always", NULL, NULL, "RMAP-DEFAULT" }
400 *
401 * helpstr
402 * =======
403 *
404 * The helpstr is used to show a short explantion for the commands that
405 * are available when the user presses '?' on the CLI. It is the concatenation
406 * of the helpstrings for all the tokens that make up the command.
407 *
408 * There should be one helpstring for each token in the cmdstr except those
409 * containing other tokens, like Multiple or Keyword Tokens. For those, there
410 * will only be the helpstrings of the contained tokens.
411 *
412 * The individual helpstrings are expected to be in the same order as their
413 * respective Tokens appear in the cmdstr. They should each be terminated with
414 * a linefeed. The last helpstring should be terminated with a linefeed as well.
415 *
416 * Care should also be taken to avoid having similar tokens with different
417 * helpstrings. Imagine e.g. the commands "show ip ospf" and "show ip bgp".
418 * they both contain a helpstring for "show", but only one will be displayed
419 * when the user enters "sh?". If those two helpstrings differ, it is not
420 * defined which one will be shown and the behavior is therefore unpredictable.
421 */
406d6716 422#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
423 DEFUN_CMD_FUNC_DECL(funcname) \
424 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
425 DEFUN_CMD_FUNC_TEXT(funcname)
426
427#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
428 DEFUN_CMD_FUNC_DECL(funcname) \
429 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \
430 DEFUN_CMD_FUNC_TEXT(funcname)
431
432#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
433 DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
434
435#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \
2557aed1 436 DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) \
718e3744 437
438/* DEFUN_NOSH for commands that vtysh should ignore */
439#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \
440 DEFUN(funcname, cmdname, cmdstr, helpstr)
441
442/* DEFSH for vtysh. */
443#define DEFSH(daemon, cmdname, cmdstr, helpstr) \
406d6716 444 DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) \
718e3744 445
abaaab4e
DW
446#define DEFSH_HIDDEN(daemon, cmdname, cmdstr, helpstr) \
447 DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) \
448
718e3744 449/* DEFUN + DEFSH */
450#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \
406d6716 451 DEFUN_CMD_FUNC_DECL(funcname) \
452 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \
453 DEFUN_CMD_FUNC_TEXT(funcname)
718e3744 454
274a4a44 455/* DEFUN + DEFSH with attributes */
456#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \
457 DEFUN_CMD_FUNC_DECL(funcname) \
458 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \
459 DEFUN_CMD_FUNC_TEXT(funcname)
460
461#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \
462 DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
463
464#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
465 DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED)
466
718e3744 467/* ALIAS macro which define existing command's alias. */
468#define ALIAS(funcname, cmdname, cmdstr, helpstr) \
406d6716 469 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)
470
471#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
274a4a44 472 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0)
406d6716 473
474#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
475 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0)
476
477#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \
478 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0)
718e3744 479
274a4a44 480#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \
481 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon)
482
483#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \
484 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon)
485
486#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
487 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon)
488
718e3744 489#endif /* VTYSH_EXTRACT_PL */
490
491/* Some macroes */
ba6d273b
DS
492
493/*
494 * Sometimes #defines create maximum values that
495 * need to have strings created from them that
496 * allow the parser to match against them.
497 * These macros allow that.
498 */
499#define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s)
500#define CMD_CREATE_STR_HELPER(s) #s
501#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">"
502
718e3744 503/* Common descriptions. */
504#define SHOW_STR "Show running system information\n"
505#define IP_STR "IP information\n"
506#define IPV6_STR "IPv6 information\n"
507#define NO_STR "Negate a command or set its defaults\n"
9c42a6eb 508#define REDIST_STR "Redistribute information from another routing protocol\n"
718e3744 509#define CLEAR_STR "Reset functions\n"
510#define RIP_STR "RIP information\n"
511#define BGP_STR "BGP information\n"
e0bce756
DS
512#define BGP_SOFT_STR "Soft reconfig inbound and outbound updates\n"
513#define BGP_SOFT_IN_STR "Send route-refresh unless using 'soft-reconfiguration inbound'\n"
514#define BGP_SOFT_OUT_STR "Resend all outbound updates\n"
515#define BGP_SOFT_RSCLIENT_RIB_STR "Soft reconfig for rsclient RIB\n"
718e3744 516#define OSPF_STR "OSPF information\n"
517#define NEIGHBOR_STR "Specify neighbor router\n"
518#define DEBUG_STR "Debugging functions (see also 'undebug')\n"
519#define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n"
520#define ROUTER_STR "Enable a routing process\n"
521#define AS_STR "AS number\n"
522#define MBGP_STR "MBGP information\n"
523#define MATCH_STR "Match values from routing table\n"
524#define SET_STR "Set values in destination routing protocol\n"
525#define OUT_STR "Filter outgoing routing updates\n"
526#define IN_STR "Filter incoming routing updates\n"
527#define V4NOTATION_STR "specify by IPv4 address notation(e.g. 0.0.0.0)\n"
528#define OSPF6_NUMBER_STR "Specify by number\n"
529#define INTERFACE_STR "Interface infomation\n"
530#define IFNAME_STR "Interface name(e.g. ep0)\n"
531#define IP6_STR "IPv6 Information\n"
532#define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n"
533#define OSPF6_ROUTER_STR "Enable a routing process\n"
534#define OSPF6_INSTANCE_STR "<1-65535> Instance ID\n"
535#define SECONDS_STR "<1-65535> Seconds\n"
536#define ROUTE_STR "Routing Table\n"
537#define PREFIX_LIST_STR "Build a prefix list\n"
538#define OSPF6_DUMP_TYPE_LIST \
539"(neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr)"
9e867fe6 540#define ISIS_STR "IS-IS information\n"
541#define AREA_TAG_STR "[area tag]\n"
859d388e
DW
542#define COMMUNITY_AANN_STR "Community number where AA and NN are <0-65535>\n"
543#define COMMUNITY_VAL_STR "Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive\n"
16f1b9ee
OD
544#define MPLS_TE_STR "MPLS-TE specific commands\n"
545#define LINK_PARAMS_STR "Configure interface link parameters\n"
546#define OSPF_RI_STR "OSPF Router Information specific commands\n"
547#define PCE_STR "PCE Router Information specific commands\n"
7758e3f3 548#define MPLS_STR "MPLS information\n"
718e3744 549
550#define CONF_BACKUP_EXT ".sav"
551
552/* IPv4 only machine should not accept IPv6 address for peer's IP
553 address. So we replace VTY command string like below. */
554#ifdef HAVE_IPV6
555#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) "
556#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) "
557#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n"
558#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) "
559#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) "
a80beece
DS
560#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n"
561#define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n"
718e3744 562#else
563#define NEIGHBOR_CMD "neighbor A.B.C.D "
564#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D "
565#define NEIGHBOR_ADDR_STR "Neighbor address\n"
566#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) "
567#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) "
568#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n"
569#endif /* HAVE_IPV6 */
570
f14e6fdb
DS
571/* Dynamic neighbor (listen range) configuration */
572#ifdef HAVE_IPV6
573#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) "
574#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n"
575#else
576#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M "
577#define LISTEN_RANGE_ADDR_STR "Neighbor address\n"
578#endif /* HAVE_IPV6 */
579
718e3744 580/* Prototypes. */
8cc4198f 581extern void install_node (struct cmd_node *, int (*) (struct vty *));
582extern void install_default (enum node_type);
583extern void install_element (enum node_type, struct cmd_element *);
718e3744 584
f6834d4c 585/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
586 string with a space between each element (allocated using
587 XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */
8cc4198f 588extern char *argv_concat (const char **argv, int argc, int shift);
589
590extern vector cmd_make_strvec (const char *);
591extern void cmd_free_strvec (vector);
592extern vector cmd_describe_command (vector, struct vty *, int *status);
593extern char **cmd_complete_command (vector, struct vty *, int *status);
cde9f101 594extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib);
8cc4198f 595extern const char *cmd_prompt (enum node_type);
bed578b8 596extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node);
13fbc82d 597extern int config_from_file (struct vty *, FILE *, unsigned int *line_num);
8cc4198f 598extern enum node_type node_parent (enum node_type);
599extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int);
600extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **);
8cc4198f 601extern void cmd_init (int);
228da428 602extern void cmd_terminate (void);
718e3744 603
604/* Export typical functions. */
605extern struct cmd_element config_end_cmd;
606extern struct cmd_element config_exit_cmd;
607extern struct cmd_element config_quit_cmd;
608extern struct cmd_element config_help_cmd;
609extern struct cmd_element config_list_cmd;
57387fb2 610extern const char *host_config_get (void);
c0e8c16f 611extern void host_config_set (const char *);
6590f2c3 612
8cc4198f 613extern void print_version (const char *);
86228fde 614
7cfc61d3
DS
615extern int cmd_banner_motd_file (const char *);
616
86228fde
PJ
617/* struct host global, ick */
618extern struct host host;
228da428
CC
619
620/* "<cr>" global */
621extern char *command_cr;
718e3744 622#endif /* _ZEBRA_COMMAND_H */