1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Virtual terminal interface shell.
3 * Copyright (C) 2000 Kunihiro Ishiguro
10 DECLARE_MGROUP(MVTYSH
);
14 extern struct thread_master
*master
;
16 #define VTYSH_ZEBRA 0x00001
17 #define VTYSH_RIPD 0x00002
18 #define VTYSH_RIPNGD 0x00004
19 #define VTYSH_OSPFD 0x00008
20 #define VTYSH_OSPF6D 0x00010
21 #define VTYSH_BGPD 0x00020
22 #define VTYSH_ISISD 0x00040
23 #define VTYSH_PIMD 0x00080
24 #define VTYSH_LDPD 0x00100
25 #define VTYSH_WATCHFRR 0x00200
26 #define VTYSH_NHRPD 0x00400
27 #define VTYSH_EIGRPD 0x00800
28 #define VTYSH_BABELD 0x01000
29 #define VTYSH_SHARPD 0x02000
30 #define VTYSH_PBRD 0x04000
31 #define VTYSH_STATICD 0x08000
32 #define VTYSH_BFDD 0x10000
33 #define VTYSH_FABRICD 0x20000
34 #define VTYSH_VRRPD 0x40000
35 #define VTYSH_PATHD 0x80000
36 #define VTYSH_PIM6D 0x100000
38 #define VTYSH_WAS_ACTIVE (-2)
40 /* commands in REALLYALL are crucial to correct vtysh operation */
41 #define VTYSH_REALLYALL ~0U
42 /* watchfrr is not in ALL since library CLI functions should not be
43 * run on it (logging & co. should stay in a fixed/frozen config, and
44 * things like prefix lists are not even initialised) */
45 #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
46 #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
47 #define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD
48 #define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_FABRICD
49 #define VTYSH_INTERFACE_SUBSET \
50 VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
51 VTYSH_ISISD | VTYSH_PIMD | VTYSH_PIM6D | VTYSH_NHRPD | \
52 VTYSH_EIGRPD | VTYSH_BABELD | VTYSH_PBRD | VTYSH_FABRICD | \
54 #define VTYSH_INTERFACE VTYSH_INTERFACE_SUBSET | VTYSH_BGPD
55 #define VTYSH_VRF VTYSH_INTERFACE_SUBSET | VTYSH_STATICD
56 #define VTYSH_KEYS VTYSH_RIPD | VTYSH_EIGRPD | VTYSH_OSPF6D
57 /* Daemons who can process nexthop-group configs */
58 #define VTYSH_NH_GROUP VTYSH_PBRD|VTYSH_SHARPD
59 #define VTYSH_SR VTYSH_ZEBRA|VTYSH_PATHD
60 #define VTYSH_DPDK VTYSH_ZEBRA
62 enum vtysh_write_integrated
{
63 WRITE_INTEGRATED_UNSPECIFIED
,
68 extern enum vtysh_write_integrated vtysh_write_integrated
;
70 extern char frr_config
[];
72 extern bool vtysh_loop_exited
;
74 void vtysh_init_vty(void);
75 void vtysh_uninit(void);
76 void vtysh_init_cmd(void);
77 extern int vtysh_connect_all(const char *optional_daemon_name
);
78 void vtysh_readline_init(void);
79 void vtysh_user_init(void);
81 int vtysh_execute(const char *);
82 int vtysh_execute_no_pager(const char *);
83 int vtysh_execute_command_questionmark(char *input
);
85 char *vtysh_prompt(void);
87 void vtysh_config_write(void);
89 int vtysh_config_from_file(struct vty
*, FILE *);
91 void config_add_line(struct list
*, const char *);
93 int vtysh_mark_file(const char *filename
);
95 int vtysh_read_config(const char *filename
, bool dry_run
);
96 int vtysh_write_config_integrated(void);
98 void vtysh_config_parse_line(void *, const char *);
100 void vtysh_config_dump(void);
102 void vtysh_config_init(void);
107 /* Child process execution flag. */
108 extern int execute_flag
;
110 extern struct vty
*vty
;
112 extern int user_mode
;
114 extern bool vtysh_add_timestamp
;