]> git.proxmox.com Git - mirror_frr.git/blame_incremental - vtysh/vtysh.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / vtysh / vtysh.h
... / ...
CommitLineData
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"
10DECLARE_MGROUP(MVTYSH);
11
12struct event_loop;
13
14extern struct event_loop *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#define VTYSH_MGMTD 0x200000
38
39#define VTYSH_WAS_ACTIVE (-2)
40
41/* commands in REALLYALL are crucial to correct vtysh operation */
42#define VTYSH_REALLYALL ~0U
43/* watchfrr is not in ALL since library CLI functions should not be
44 * run on it (logging & co. should stay in a fixed/frozen config, and
45 * things like prefix lists are not even initialised) */
46#define VTYSH_ALL \
47 VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
48 VTYSH_LDPD | VTYSH_BGPD | VTYSH_ISISD | VTYSH_PIMD | \
49 VTYSH_PIM6D | VTYSH_NHRPD | VTYSH_EIGRPD | VTYSH_BABELD | \
50 VTYSH_SHARPD | VTYSH_PBRD | VTYSH_STATICD | VTYSH_BFDD | \
51 VTYSH_FABRICD | VTYSH_VRRPD | VTYSH_PATHD | VTYSH_MGMTD
52#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
53#define VTYSH_AFFMAP VTYSH_ZEBRA | VTYSH_ISISD
54#define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_FABRICD
55#define VTYSH_INTERFACE_SUBSET \
56 VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D | \
57 VTYSH_ISISD | VTYSH_PIMD | VTYSH_PIM6D | VTYSH_NHRPD | \
58 VTYSH_EIGRPD | VTYSH_BABELD | VTYSH_PBRD | VTYSH_FABRICD | \
59 VTYSH_VRRPD
60#define VTYSH_INTERFACE VTYSH_INTERFACE_SUBSET | VTYSH_BGPD
61#define VTYSH_VRF VTYSH_INTERFACE_SUBSET | VTYSH_STATICD | VTYSH_MGMTD
62#define VTYSH_KEYS VTYSH_RIPD | VTYSH_EIGRPD | VTYSH_OSPF6D
63/* Daemons who can process nexthop-group configs */
64#define VTYSH_NH_GROUP VTYSH_PBRD|VTYSH_SHARPD
65#define VTYSH_SR VTYSH_ZEBRA|VTYSH_PATHD
66#define VTYSH_DPDK VTYSH_ZEBRA
67
68enum vtysh_write_integrated {
69 WRITE_INTEGRATED_UNSPECIFIED,
70 WRITE_INTEGRATED_NO,
71 WRITE_INTEGRATED_YES
72};
73
74extern enum vtysh_write_integrated vtysh_write_integrated;
75
76extern char frr_config[];
77extern char vtydir[];
78extern bool vtysh_loop_exited;
79
80void vtysh_init_vty(void);
81void vtysh_uninit(void);
82void vtysh_init_cmd(void);
83extern int vtysh_connect_all(const char *optional_daemon_name);
84void vtysh_readline_init(void);
85void vtysh_user_init(void);
86
87int vtysh_execute(const char *);
88int vtysh_execute_no_pager(const char *);
89int vtysh_execute_command_questionmark(char *input);
90
91char *vtysh_prompt(void);
92
93void vtysh_config_write(void);
94
95int vtysh_config_from_file(struct vty *, FILE *);
96
97void config_add_line(struct list *, const char *);
98
99int vtysh_mark_file(const char *filename);
100
101int vtysh_apply_config(const char *config_file_path, bool dry_run, bool fork);
102int vtysh_write_config_integrated(void);
103
104void vtysh_config_parse_line(void *, const char *);
105
106void vtysh_config_dump(void);
107
108void vtysh_config_init(void);
109
110void suid_on(void);
111void suid_off(void);
112
113/* Child process execution flag. */
114extern int execute_flag;
115
116extern struct vty *vty;
117
118extern int user_mode;
119
120extern bool vtysh_add_timestamp;
121
122struct vtysh_client {
123 int fd;
124 const char *name;
125 int flag;
126 char path[MAXPATHLEN];
127 struct vtysh_client *next;
128
129 struct event *log_reader;
130 int log_fd;
131 uint32_t lost_msgs;
132};
133
134extern struct vtysh_client vtysh_client[22];
135
136#endif /* VTYSH_H */