Restructured error,debug anf log API
Renamed functions clicon->clixon, replaced global variables w access functions Unified clicon_netconf_error with clixon_err()
This commit is contained in:
parent
261469be16
commit
24a4991ec8
199 changed files with 4668 additions and 4158 deletions
|
|
@ -60,7 +60,7 @@
|
|||
/* cligen */
|
||||
#include <cligen/cligen.h>
|
||||
|
||||
/* clicon */
|
||||
/* clixon */
|
||||
#include <clixon/clixon.h>
|
||||
|
||||
#include "clixon_cli_api.h"
|
||||
|
|
@ -69,15 +69,15 @@
|
|||
|
||||
#define CLICON_MAGIC 0x99aafabe
|
||||
|
||||
#define handle(h) (assert(clicon_handle_check(h)==0),(struct cli_handle *)(h))
|
||||
#define handle(h) (assert(clixon_handle_check(h)==0),(struct cli_handle *)(h))
|
||||
#define cligen(h) (handle(h)->cl_cligen)
|
||||
|
||||
/*! CLI specific handle added to header Clixon handle
|
||||
*
|
||||
* This file should only contain access functions for the _specific_
|
||||
* entries in the struct below.
|
||||
* @note The top part must be equivalent to struct clicon_handle in clixon_handle.c
|
||||
* @see struct clicon_handle, struct backend_handle
|
||||
* @note The top part must be equivalent to struct clixon_handle in clixon_handle.c
|
||||
* @see struct clixon_handle, struct backend_handle
|
||||
*/
|
||||
struct cli_handle {
|
||||
int cl_magic; /* magic (HDR)*/
|
||||
|
|
@ -92,25 +92,25 @@ struct cli_handle {
|
|||
|
||||
/*! Return a clicon handle for other CLICON API calls
|
||||
*/
|
||||
clicon_handle
|
||||
clixon_handle
|
||||
cli_handle_init(void)
|
||||
{
|
||||
struct cli_handle *cl;
|
||||
cligen_handle clih = NULL;
|
||||
clicon_handle h = NULL;
|
||||
clixon_handle h = NULL;
|
||||
|
||||
if ((cl = (struct cli_handle *)clicon_handle_init0(sizeof(struct cli_handle))) == NULL)
|
||||
if ((cl = (struct cli_handle *)clixon_handle_init0(sizeof(struct cli_handle))) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((clih = cligen_init()) == NULL){
|
||||
clicon_handle_exit((clicon_handle)cl);
|
||||
clixon_handle_exit((clixon_handle)cl);
|
||||
goto done;
|
||||
}
|
||||
cligen_userhandle_set(clih, cl);
|
||||
cligen_eval_wrap_fn_set(clih, plugin_context_check, cl);
|
||||
cl->cl_cligen = clih;
|
||||
|
||||
h = (clicon_handle)cl;
|
||||
h = (clixon_handle)cl;
|
||||
done:
|
||||
return h;
|
||||
}
|
||||
|
|
@ -120,11 +120,11 @@ cli_handle_init(void)
|
|||
* @param[in] h Clixon handle
|
||||
*/
|
||||
int
|
||||
cli_handle_exit(clicon_handle h)
|
||||
cli_handle_exit(clixon_handle h)
|
||||
{
|
||||
cligen_handle ch = cligen(h);
|
||||
|
||||
clicon_handle_exit(h); /* frees h and options */
|
||||
clixon_handle_exit(h); /* frees h and options */
|
||||
cligen_exit(ch);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -138,13 +138,13 @@ cli_handle_exit(clicon_handle h)
|
|||
* @param[in] h Clixon handle
|
||||
*/
|
||||
cligen_handle
|
||||
cli_cligen(clicon_handle h)
|
||||
cli_cligen(clixon_handle h)
|
||||
{
|
||||
return cligen(h);
|
||||
}
|
||||
|
||||
int
|
||||
cli_parse_file(clicon_handle h,
|
||||
cli_parse_file(clixon_handle h,
|
||||
FILE *f,
|
||||
char *name, /* just for errs */
|
||||
parse_tree *pt,
|
||||
|
|
@ -156,7 +156,7 @@ cli_parse_file(clicon_handle h,
|
|||
}
|
||||
|
||||
int
|
||||
cli_susp_hook(clicon_handle h,
|
||||
cli_susp_hook(clixon_handle h,
|
||||
cligen_susp_cb_t *fn)
|
||||
{
|
||||
cligen_handle ch = cligen(h);
|
||||
|
|
@ -166,7 +166,7 @@ cli_susp_hook(clicon_handle h,
|
|||
}
|
||||
|
||||
int
|
||||
cli_interrupt_hook(clicon_handle h,
|
||||
cli_interrupt_hook(clixon_handle h,
|
||||
cligen_interrupt_cb_t *fn)
|
||||
{
|
||||
cligen_handle ch = cligen(h);
|
||||
|
|
@ -176,7 +176,7 @@ cli_interrupt_hook(clicon_handle h,
|
|||
}
|
||||
|
||||
int
|
||||
cli_prompt_set(clicon_handle h,
|
||||
cli_prompt_set(clixon_handle h,
|
||||
char *prompt)
|
||||
{
|
||||
cligen_handle ch = cligen(h);
|
||||
|
|
@ -184,7 +184,7 @@ cli_prompt_set(clicon_handle h,
|
|||
}
|
||||
|
||||
int
|
||||
cli_logsyntax_set(clicon_handle h,
|
||||
cli_logsyntax_set(clixon_handle h,
|
||||
int status)
|
||||
{
|
||||
cligen_handle ch = cligen(h);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue