]> git.proxmox.com Git - mirror_frr.git/blob - vtysh/vtysh.h
Merge pull request #12816 from gpnaveen/stc_rte_err_msg
[mirror_frr.git] / vtysh / vtysh.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Virtual terminal interface shell.
3 * Copyright (C) 2000 Kunihiro Ishiguro
4 */
5
6 #ifndef VTYSH_H
7 #define VTYSH_H
8
9 #include "memory.h"
10 DECLARE_MGROUP(MVTYSH);
11
12 struct thread_master;
13
14 extern struct thread_master *master;
15
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
37
38 #define VTYSH_WAS_ACTIVE (-2)
39
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 | \
53 VTYSH_VRRPD
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
61
62 enum vtysh_write_integrated {
63 WRITE_INTEGRATED_UNSPECIFIED,
64 WRITE_INTEGRATED_NO,
65 WRITE_INTEGRATED_YES
66 };
67
68 extern enum vtysh_write_integrated vtysh_write_integrated;
69
70 extern char frr_config[];
71 extern char vtydir[];
72 extern bool vtysh_loop_exited;
73
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);
80
81 int vtysh_execute(const char *);
82 int vtysh_execute_no_pager(const char *);
83 int vtysh_execute_command_questionmark(char *input);
84
85 char *vtysh_prompt(void);
86
87 void vtysh_config_write(void);
88
89 int vtysh_config_from_file(struct vty *, FILE *);
90
91 void config_add_line(struct list *, const char *);
92
93 int vtysh_mark_file(const char *filename);
94
95 int vtysh_read_config(const char *filename, bool dry_run);
96 int vtysh_write_config_integrated(void);
97
98 void vtysh_config_parse_line(void *, const char *);
99
100 void vtysh_config_dump(void);
101
102 void vtysh_config_init(void);
103
104 void suid_on(void);
105 void suid_off(void);
106
107 /* Child process execution flag. */
108 extern int execute_flag;
109
110 extern struct vty *vty;
111
112 extern int user_mode;
113
114 extern bool vtysh_add_timestamp;
115
116 #endif /* VTYSH_H */