26 #include <sys/types.h> 41 char *password_encrypt;
121 CMD_ATTR_DEPRECATED = 1,
128 int (*func) (
struct cmd_element *,
struct vty *, int,
const char *[]);
145 #define CMD_SUCCESS 0 146 #define CMD_WARNING 1 147 #define CMD_ERR_NO_MATCH 2 148 #define CMD_ERR_AMBIGUOUS 3 149 #define CMD_ERR_INCOMPLETE 4 150 #define CMD_ERR_EXEED_ARGC_MAX 5 151 #define CMD_ERR_NOTHING_TODO 6 152 #define CMD_COMPLETE_FULL_MATCH 7 153 #define CMD_COMPLETE_MATCH 8 154 #define CMD_COMPLETE_LIST_MATCH 9 155 #define CMD_SUCCESS_DAEMON 10 158 #define CMD_ARGC_MAX 256 161 #ifndef VTYSH_EXTRACT_PL 164 #define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ 165 static struct cmd_element cmdname = \ 175 #define gDEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ 176 struct cmd_element cmdname = \ 185 #define DEFUN_CMD_FUNC_DECL(funcname) \ 186 static int funcname (struct cmd_element *, struct vty *, int, const char *[]); \ 188 #define DEFUN_CMD_FUNC_TEXT(funcname) \ 189 static int funcname \ 190 (struct cmd_element *self, struct vty *vty, int argc, const char *argv[]) 198 #define DEFUN(funcname, cmdname, cmdstr, helpstr) \ 199 DEFUN_CMD_FUNC_DECL(funcname) \ 200 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ 201 DEFUN_CMD_FUNC_TEXT(funcname) 209 #define gDEFUN(funcname, cmdname, cmdstr, helpstr) \ 210 DEFUN_CMD_FUNC_DECL(funcname) \ 211 gDEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ 212 DEFUN_CMD_FUNC_TEXT(funcname) 214 #define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ 215 DEFUN_CMD_FUNC_DECL(funcname) \ 216 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \ 217 DEFUN_CMD_FUNC_TEXT(funcname) 219 #define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ 220 DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) 222 #define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ 223 DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) \ 226 #define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ 227 DEFUN(funcname, cmdname, cmdstr, helpstr) 230 #define DEFSH(daemon, cmdname, cmdstr, helpstr) \ 231 DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) \ 234 #define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \ 235 DEFUN_CMD_FUNC_DECL(funcname) \ 236 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \ 237 DEFUN_CMD_FUNC_TEXT(funcname) 240 #define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \ 241 DEFUN_CMD_FUNC_DECL(funcname) \ 242 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \ 243 DEFUN_CMD_FUNC_TEXT(funcname) 245 #define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ 246 DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) 248 #define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ 249 DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) 252 #define ALIAS(funcname, cmdname, cmdstr, helpstr) \ 253 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) 256 #define gALIAS(funcname, cmdname, cmdstr, helpstr) \ 257 gDEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) 259 #define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ 260 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) 262 #define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ 263 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0) 265 #define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ 266 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0) 268 #define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ 269 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) 271 #define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ 272 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) 274 #define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ 275 DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon) 280 #define CMD_OPTION(S) ((S[0]) == '[') 281 #define CMD_VARIABLE(S) (((S[0]) >= 'A' && (S[0]) <= 'Z') || ((S[0]) == '<')) 282 #define CMD_VARARG(S) ((S[0]) == '.') 283 #define CMD_RANGE(S) ((S[0] == '<')) 285 #define CMD_IPV4(S) ((strcmp ((S), "A.B.C.D") == 0)) 286 #define CMD_IPV4_PREFIX(S) ((strcmp ((S), "A.B.C.D/M") == 0)) 287 #define CMD_IPV6(S) ((strcmp ((S), "X:X::X:X") == 0)) 288 #define CMD_IPV6_PREFIX(S) ((strcmp ((S), "X:X::X:X/M") == 0)) 291 #define SHOW_STR "Show running system information\n" 292 #define IP_STR "IP information\n" 293 #define IPV6_STR "IPv6 information\n" 294 #define NO_STR "Negate a command or set its defaults\n" 295 #define CLEAR_STR "Reset functions\n" 296 #define RIP_STR "RIP information\n" 297 #define BGP_STR "BGP information\n" 298 #define OSPF_STR "OSPF information\n" 299 #define NEIGHBOR_STR "Specify neighbor router\n" 300 #define DEBUG_STR "Debugging functions (see also 'undebug')\n" 301 #define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n" 302 #define ROUTER_STR "Enable a routing process\n" 303 #define AS_STR "AS number\n" 304 #define MBGP_STR "MBGP information\n" 305 #define MATCH_STR "Match values from routing table\n" 306 #define SET_STR "Set values in destination routing protocol\n" 307 #define OUT_STR "Filter outgoing routing updates\n" 308 #define IN_STR "Filter incoming routing updates\n" 309 #define V4NOTATION_STR "specify by IPv4 address notation(e.g. 0.0.0.0)\n" 310 #define OSPF6_NUMBER_STR "Specify by number\n" 311 #define INTERFACE_STR "Interface infomation\n" 312 #define IFNAME_STR "Interface name(e.g. ep0)\n" 313 #define IP6_STR "IPv6 Information\n" 314 #define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" 315 #define OSPF6_ROUTER_STR "Enable a routing process\n" 316 #define OSPF6_INSTANCE_STR "<1-65535> Instance ID\n" 317 #define SECONDS_STR "<1-65535> Seconds\n" 318 #define ROUTE_STR "Routing Table\n" 319 #define PREFIX_LIST_STR "Build a prefix list\n" 320 #define OSPF6_DUMP_TYPE_LIST \ 321 "(neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr)" 322 #define ISIS_STR "IS-IS information\n" 323 #define AREA_TAG_STR "[area tag]\n" 325 #define CONF_BACKUP_EXT ".sav" 330 #define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " 331 #define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " 332 #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" 333 #define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " 334 #define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " 335 #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nNeighbor tag\n" 337 #define NEIGHBOR_CMD "neighbor A.B.C.D " 338 #define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " 339 #define NEIGHBOR_ADDR_STR "Neighbor address\n" 340 #define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " 341 #define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " 342 #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" 360 char *argv_concat(
const char **argv,
int argc,
int shift);
364 vector cmd_describe_command();
365 char **cmd_complete_command();
367 int config_from_file(
struct vty *, FILE *);
371 void config_replace_string(
struct cmd_element *,
char *, ...);
379 char *host_config_file();
380 void host_config_set(
const char *);
387 extern void *tall_vty_cmd_ctx;
int advanced
Flags for services.
Definition: command.h:57
const char * prompt
Prompt character at vty interface.
Definition: command.h:108
const char * string
Command specification by string.
Definition: command.h:127
const char * cmd
Command string.
Definition: command.h:140
int(* func)(struct vty *)
Node's configuration write function.
Definition: command.h:114
int daemon
Daemon to which this command belong.
Definition: command.h:130
const char * doc
Documentation of this command.
Definition: command.h:129
vector cmd_make_strvec(const char *)
Definition: command.c:195
NS node in libosmo-gb.
Definition: command.h:84
char * config
Configuration string.
Definition: command.h:133
const struct vty_app_info * app_info
VTY application information.
Definition: command.h:65
char * password
Password for vty interface.
Definition: command.h:40
E1 line in libosmo-abis.
Definition: command.h:82
Configure the logging.
Definition: command.h:77
Reserved for later extensions.
Definition: command.h:92
IPA proxying commands in libosmo-abis.
Definition: command.h:83
Vty node.
Definition: command.h:80
void install_element(int node_type, struct cmd_element *)
Install a command into a node.
Definition: command.c:617
char * config
config file name of this host
Definition: command.h:54
Command description structure.
Definition: command.h:139
const char * cmd_prompt(enum node_type)
Return prompt character of specified node.
Definition: command.c:397
Host configuration variable.
Definition: command.h:35
Configure the statistics.
Definition: command.h:78
Config node. Default mode of config file.
Definition: command.h:74
void sort_node(void)
Sort each node's command element according to command string.
Definition: command.c:163
node_type
There are some command levels which called from command node.
Definition: command.h:69
Node which has some commands and prompt string and configuration function pointer .
Definition: command.h:103
void install_node(struct cmd_node *, int(*)(struct vty *))
Install top node of command vector.
Definition: command.c:126
void cmd_free_strvec(vector)
Free allocated string vector.
Definition: command.c:243
Authentication mode of vty interface.
Definition: command.h:70
View node. Default mode of vty interface.
Definition: command.h:71
vector strvec
Pointing out each description vector.
Definition: command.h:131
int lines
System wide terminal lines.
Definition: command.h:48
char * logfile
Log filename.
Definition: command.h:51
int vtysh
Is this node's configuration goes to vtysh ?
Definition: command.h:111
const char * motd
Banner configuration.
Definition: command.h:61
char * osmo_asciidoc_escape(const char *inp)
escape all special asciidoc symbols
Definition: command.c:410
vector cmd_vector
Vector of this node's command list.
Definition: command.h:117
Service node.
Definition: command.h:75
Reserved for later extensions.
Definition: command.h:94
char * enable
Enable password.
Definition: command.h:44
Structure of a command element.
Definition: command.h:126
unsigned char attr
Command attributes.
Definition: command.h:135
char * name
Host name of this router.
Definition: command.h:37
int node
Node index.
Definition: command.h:105
vector subconfig
Sub configuration string.
Definition: command.h:134
unsigned int cmdsize
Command index count.
Definition: command.h:132
Control interface node.
Definition: command.h:86
void print_version(int print_copyright)
print the version (and optionally copyright) information
Definition: command.c:93
const char * str
Command's description.
Definition: command.h:141
Enable node.
Definition: command.h:73
Authentication mode for change enable.
Definition: command.h:72
Reserved for later extensions.
Definition: command.h:93
BSSGP node in libosmo-gb.
Definition: command.h:85
Debug node.
Definition: command.h:76