1 /************************************************************************
2 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
3 * Copyright (C) 2001-2003 Optical Access
6 * This file is part of RSTP library.
8 * RSTP library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; version 2.1
12 * RSTP library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15 * General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with RSTP library; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 **********************************************************************/
26 #define MAX_CLI_BUFF 80
28 #define MAXPARAMLEN 40
29 #define MAX_CLI_PROMT 24
30 #define MAX_SELECTOR 12
32 typedef int CLI_CMD_CLBK (int argc
, char** argv
);
41 typedef struct cmd_par_number_limits_s
{
46 typedef struct cmd_par_string_selector_s
{
51 typedef struct cmd_par_dscr_s
{
53 CMD_PARAM_TYPE_T param_type
;
54 CMD_PAR_LIMITS number_limits
;
55 CMD_PAR_SELECTOR string_selector
[MAX_SELECTOR
];
59 typedef struct cmd_dscr_s
{
62 CMD_PAR_DSCR_T param
[MAXPARAMNUM
];
66 #define THE_COMMAND(x, y) {x, y, {
67 #define PARAM_NUMBER(x,zmin,zmax,def) {x,CMD_PAR_NUMBER, {zmin, zmax}, {}, def},
68 #define PARAM_STRING(x, def) {x,CMD_PAR_STRING, {}, {}, def},
69 #define PARAM_ENUM(x) {x,CMD_PAR_ENUM, {}, {
70 #define PARAM_ENUM_SEL(x, y) {x, y},
71 #define PARAM_ENUM_DEFAULT(def) }, def},
72 #define PARAM_BOOL(x,yesd,nod,def) {x, CMD_PAR_ENUM, {}, {{"y",yesd},{"n",nod}},def}
73 #define THE_FUNC(x) }, &x},
74 #define END_OF_LANG {NULL,NULL}
76 char *get_prompt (void); /* this function not from the lib ! */
78 void cli_debug_dump_args (char* title
, int argc
, char** argv
);
80 void cli_register_language (const CMD_DSCR_T
* cmd_list
);
82 int cli_execute_command (const char* line
);
84 void rl_read_cli (void);
86 void rl_read_cli (char *);
89 void rl_shutdown (void);
90 char* UT_sprint_time_stamp (void);
92 #endif /* _CLI_API__ */