1 /* Virtual terminal interface shell.
2 * Copyright (C) 2000 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 DECLARE_MGROUP(MVTYSH
);
29 extern struct thread_master
*master
;
31 #define VTYSH_ZEBRA 0x00001
32 #define VTYSH_RIPD 0x00002
33 #define VTYSH_RIPNGD 0x00004
34 #define VTYSH_OSPFD 0x00008
35 #define VTYSH_OSPF6D 0x00010
36 #define VTYSH_BGPD 0x00020
37 #define VTYSH_ISISD 0x00040
38 #define VTYSH_PIMD 0x00080
39 #define VTYSH_LDPD 0x00100
40 #define VTYSH_WATCHFRR 0x00200
41 #define VTYSH_NHRPD 0x00400
42 #define VTYSH_EIGRPD 0x00800
43 #define VTYSH_BABELD 0x01000
44 #define VTYSH_SHARPD 0x02000
45 #define VTYSH_PBRD 0x04000
46 #define VTYSH_STATICD 0x08000
47 #define VTYSH_BFDD 0x10000
48 #define VTYSH_FABRICD 0x20000
49 #define VTYSH_VRRPD 0x40000
50 #define VTYSH_PATHD 0x80000
51 #define VTYSH_PIM6D 0x100000
53 #define VTYSH_WAS_ACTIVE (-2)
55 /* commands in REALLYALL are crucial to correct vtysh operation */
56 #define VTYSH_REALLYALL ~0U
57 /* watchfrr is not in ALL since library CLI functions should not be
58 * run on it (logging & co. should stay in a fixed/frozen config, and
59 * things like prefix lists are not even initialised) */
60 #define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD|VTYSH_PBRD|VTYSH_STATICD|VTYSH_BFDD|VTYSH_FABRICD|VTYSH_VRRPD|VTYSH_PATHD
61 #define VTYSH_ACL VTYSH_BFDD|VTYSH_BABELD|VTYSH_BGPD|VTYSH_EIGRPD|VTYSH_ISISD|VTYSH_FABRICD|VTYSH_LDPD|VTYSH_NHRPD|VTYSH_OSPF6D|VTYSH_OSPFD|VTYSH_PBRD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_VRRPD|VTYSH_ZEBRA
62 #define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_FABRICD
63 #define VTYSH_INTERFACE_SUBSET \
64 VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
65 VTYSH_ISISD | VTYSH_PIMD | VTYSH_PIM6D | VTYSH_NHRPD | \
66 VTYSH_EIGRPD | VTYSH_BABELD | VTYSH_PBRD | VTYSH_FABRICD | \
68 #define VTYSH_INTERFACE VTYSH_INTERFACE_SUBSET | VTYSH_BGPD
69 #define VTYSH_VRF VTYSH_INTERFACE_SUBSET | VTYSH_STATICD
70 #define VTYSH_KEYS VTYSH_RIPD | VTYSH_EIGRPD | VTYSH_OSPF6D
71 /* Daemons who can process nexthop-group configs */
72 #define VTYSH_NH_GROUP VTYSH_PBRD|VTYSH_SHARPD
73 #define VTYSH_SR VTYSH_ZEBRA|VTYSH_PATHD
74 #define VTYSH_DPDK VTYSH_ZEBRA
76 enum vtysh_write_integrated
{
77 WRITE_INTEGRATED_UNSPECIFIED
,
82 extern enum vtysh_write_integrated vtysh_write_integrated
;
84 extern char frr_config
[];
86 extern bool vtysh_loop_exited
;
88 void vtysh_init_vty(void);
89 void vtysh_uninit(void);
90 void vtysh_init_cmd(void);
91 extern int vtysh_connect_all(const char *optional_daemon_name
);
92 void vtysh_readline_init(void);
93 void vtysh_user_init(void);
95 int vtysh_execute(const char *);
96 int vtysh_execute_no_pager(const char *);
97 int vtysh_execute_command_questionmark(char *input
);
99 char *vtysh_prompt(void);
101 void vtysh_config_write(void);
103 int vtysh_config_from_file(struct vty
*, FILE *);
105 void config_add_line(struct list
*, const char *);
107 int vtysh_mark_file(const char *filename
);
109 int vtysh_read_config(const char *filename
, bool dry_run
);
110 int vtysh_write_config_integrated(void);
112 void vtysh_config_parse_line(void *, const char *);
114 void vtysh_config_dump(void);
116 void vtysh_config_init(void);
121 /* Child process execution flag. */
122 extern int execute_flag
;
124 extern struct vty
*vty
;
126 extern int user_mode
;
128 extern bool vtysh_add_timestamp
;