CliXoN
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
clixon_cli_api.h
Go to the documentation of this file.
1 /*
2  *
3  ***** BEGIN LICENSE BLOCK *****
4 
5  Copyright (C) 2009-2017 Olof Hagsand and Benny Holmgren
6 
7  This file is part of CLIXON.
8 
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12 
13  http://www.apache.org/licenses/LICENSE-2.0
14 
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20 
21  Alternatively, the contents of this file may be used under the terms of
22  the GNU General Public License Version 3 or later (the "GPL"),
23  in which case the provisions of the GPL are applicable instead
24  of those above. If you wish to allow use of your version of this file only
25  under the terms of the GPL, and not to allow others to
26  use your version of this file under the terms of Apache License version 2,
27  indicate your decision by deleting the provisions above and replace them with
28  the notice and other provisions required by the GPL. If you do not delete
29  the provisions above, a recipient may use your version of this file under
30  the terms of any one of the Apache License version 2 or the GPL.
31 
32  ***** END LICENSE BLOCK *****
33 
34  * Note, this is a CLICON API file, only exprorted function prototypes should appear here
35  */
36 
37 #ifndef _CLIXON_CLI_API_H_
38 #define _CLIXON_CLI_API_H_
39 
40 /*
41  * Constants
42  */
43 /* Max prompt length */
44 #define CLI_PROMPT_LEN 64
45 #define CLI_DEFAULT_PROMPT ">"
46 
47 /*
48  * Function Declarations
49  */
50 /* cli_plugin.c */
51 int cli_set_syntax_mode(clicon_handle h, const char *mode);
52 char *cli_syntax_mode(clicon_handle h);
53 int cli_syntax_load(clicon_handle h);
54 int cli_handler_err(FILE *fd);
55 int cli_set_prompt(clicon_handle h, const char *mode, const char *prompt);
56 char *cli_prompt(char *fmt);
57 int cli_exec(clicon_handle h, char *cmd, char **mode, int *result);
58 int cli_ptpush(clicon_handle h, char *mode, char *string, char *op);
59 int cli_ptpop(clicon_handle h, char *mode, char *op);
60 
61 /* cli_handle.c */
62 char cli_set_comment(clicon_handle h, char c);
63 char cli_comment(clicon_handle h);
64 int cli_set_exiting(clicon_handle h, int exiting);
65 int cli_exiting(clicon_handle h);
66 clicon_handle cli_handle_init(void);
67 int cli_handle_exit(clicon_handle h);
68 cligen_handle cli_cligen(clicon_handle h);
69 
70 /* cli_common.c */
71 int cli_notification_register(clicon_handle h, char *stream, enum format_enum format,
72  char *filter, int status,
73  int (*fn)(int, void*), void *arg);
74 
75 #define cli_output cligen_output
76 /* cli_common.c: CLIgen new vector callbacks */
77 
78 
79 int cli_set(clicon_handle h, cvec *vars, cvec *argv);
80 int cli_setv(clicon_handle h, cvec *vars, cvec *argv);
81 
82 int cli_merge(clicon_handle h, cvec *vars, cvec *argv);
83 int cli_mergev(clicon_handle h, cvec *vars, cvec *argv);
84 
85 int cli_del(clicon_handle h, cvec *vars, cvec *argv);
86 int cli_delv(clicon_handle h, cvec *vars, cvec *argv);
87 
88 int cli_debug_cli(clicon_handle h, cvec *vars, cvec *argv);
89 int cli_debug_cliv(clicon_handle h, cvec *vars, cvec *argv);
90 
91 int cli_debug_backend(clicon_handle h, cvec *vars, cvec *argv);
92 int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv);
93 
94 int cli_set_mode(clicon_handle h, cvec *vars, cvec *argv);
95 int cli_set_modev(clicon_handle h, cvec *vars, cvec *argv);
96 
97 int cli_start_shell(clicon_handle h, cvec *vars, cvec *argv);
98 int cli_start_shellv(clicon_handle h, cvec *vars, cvec *argv);
99 
100 int cli_quit(clicon_handle h, cvec *vars, cvec *argv);
101 int cli_quitv(clicon_handle h, cvec *vars, cvec *argv);
102 
103 int cli_commit(clicon_handle h, cvec *vars, cvec *argv);
104 int cli_commitv(clicon_handle h, cvec *vars, cvec *argv);
105 
106 int cli_validate(clicon_handle h, cvec *vars, cvec *argv);
107 int cli_validatev(clicon_handle h, cvec *vars, cvec *argv);
108 
109 int compare_dbs(clicon_handle h, cvec *vars, cvec *argv);
110 int compare_dbsv(clicon_handle h, cvec *vars, cvec *argv);
111 
112 int load_config_file(clicon_handle h, cvec *vars, cvec *argv);
113 int load_config_filev(clicon_handle h, cvec *vars, cvec *argv);
114 
115 int save_config_file(clicon_handle h, cvec *vars, cvec *argv);
116 int save_config_filev(clicon_handle h, cvec *vars, cvec *argv);
117 
118 int delete_all(clicon_handle h, cvec *vars, cvec *argv);
119 int delete_allv(clicon_handle h, cvec *vars, cvec *argv);
120 
121 int discard_changes(clicon_handle h, cvec *vars, cvec *argv);
122 int discard_changesv(clicon_handle h, cvec *vars, cvec *argv);
123 
124 int cli_notify(clicon_handle h, cvec *cvv, cvec *argv);
125 int cli_notifyv(clicon_handle h, cvec *cvv, cvec *argv);
126 
127 int db_copy(clicon_handle h, cvec *cvv, cvec *argv);
128 
129 int cli_lock(clicon_handle h, cvec *cvv, cvec *argv);
130 int cli_unlock(clicon_handle h, cvec *cvv, cvec *argv);
131 int cli_copy_config(clicon_handle h, cvec *cvv, cvec *argv);
132 
133 /* In cli_show.c */
134 int expand_dir(char *dir, int *nr, char ***commands, mode_t flags, int detail);
135 int expand_dbvar(void *h, char *name, cvec *cvv, cvec *argv,
136  cvec *commands, cvec *helptexts);
137 int expandv_dbvar(void *h, char *name, cvec *cvv, cvec *argv,
138  cvec *commands, cvec *helptexts);
139 
140 /* cli_show.c: CLIgen new vector arg callbacks */
141 int show_yang(clicon_handle h, cvec *vars, cvec *argv);
142 int show_yangv(clicon_handle h, cvec *vars, cvec *argv);
143 
144 int show_conf_xpath(clicon_handle h, cvec *cvv, cvec *argv);
145 int show_confv_xpath(clicon_handle h, cvec *cvv, cvec *argv);
146 
147 int cli_show_config(clicon_handle h, cvec *cvv, cvec *argv);
148 
149 #endif /* _CLIXON_CLI_API_H_ */
int cli_debug_backend(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:348
int cli_notification_register(clicon_handle h, char *stream, enum format_enum format, char *filter, int status, int(*fn)(int, void *), void *arg)
Definition: cli_common.c:88
int cli_lock(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:977
int cli_exec(clicon_handle h, char *cmd, char **mode, int *result)
Definition: cli_plugin.c:981
int cli_unlock(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:1007
int cli_setv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:266
int cli_set_modev(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:394
int cli_mergev(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:282
int cli_ptpush(clicon_handle h, char *mode, char *string, char *op)
Definition: cli_plugin.c:994
clicon_handle cli_handle_init(void)
Definition: cli_handle.c:95
int cli_set_exiting(clicon_handle h, int exiting)
Definition: cli_handle.c:176
int cli_validate(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:501
int cli_commitv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:493
int cli_ptpop(clicon_handle h, char *mode, char *op)
Definition: cli_plugin.c:1047
int cli_validatev(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:513
int cli_handler_err(FILE *fd)
Definition: cli_plugin.c:627
int db_copy(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:844
int cli_handle_exit(clicon_handle h)
Definition: cli_handle.c:120
int cli_show_config(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_show.c:364
int discard_changesv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:835
int show_confv_xpath(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_show.c:522
char * cli_syntax_mode(clicon_handle h)
Definition: cli_plugin.c:866
int expandv_dbvar(void *h, char *name, cvec *cvv, cvec *argv, cvec *commands, cvec *helptexts)
Definition: cli_show.c:198
int cli_exiting(clicon_handle h)
Definition: cli_handle.c:165
int compare_dbs(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:585
int show_yangv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_show.c:344
int compare_dbsv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:617
int cli_debug_cliv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:335
int cli_debug_backendv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:369
< KEYWORD > status
Definition: clixon_yang_parse.l:170
int cli_set(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:256
int cli_quit(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:463
int cli_notify(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:928
int expand_dbvar(void *h, char *name, cvec *cvv, cvec *argv, cvec *commands, cvec *helptexts)
Definition: cli_show.c:94
int cli_copy_config(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:1050
int save_config_filev(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:788
int discard_changes(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:829
int show_conf_xpath(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_show.c:480
int cli_debug_cli(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:313
int load_config_filev(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:717
int cli_start_shell(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:403
char cli_set_comment(clicon_handle h, char c)
Definition: cli_handle.c:192
char * cli_prompt(char *fmt)
Definition: cli_plugin.c:966
int load_config_file(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:637
int cli_set_syntax_mode(clicon_handle h, const char *mode)
Definition: cli_plugin.c:851
int cli_start_shellv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:455
int show_yang(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_show.c:326
int delete_allv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:821
int delete_all(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:797
char cli_comment(clicon_handle h)
Definition: cli_handle.c:184
int cli_set_mode(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:377
int cli_quitv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:470
int cli_merge(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:272
int cli_commit(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:479
int cli_delv(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:299
int cli_syntax_load(clicon_handle h)
Definition: cli_plugin.c:497
int cli_del(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:289
int expand_dir(char *dir, int *nr, char ***commands, mode_t flags, int detail)
Definition: cli_show.c:210
int cli_set_prompt(clicon_handle h, const char *mode, const char *prompt)
Definition: cli_plugin.c:883
int save_config_file(clicon_handle h, cvec *vars, cvec *argv)
Definition: cli_common.c:738
int cli_notifyv(clicon_handle h, cvec *cvv, cvec *argv)
Definition: cli_common.c:961
cligen_handle cli_cligen(clicon_handle h)
Definition: cli_handle.c:156