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
|
|
@ -68,11 +68,12 @@ extern "C" {
|
|||
|
||||
#include <clixon/clixon_sig.h>
|
||||
#include <clixon/clixon_uid.h>
|
||||
#include <clixon/clixon_err.h>
|
||||
#include <clixon/clixon_queue.h>
|
||||
#include <clixon/clixon_hash.h>
|
||||
#include <clixon/clixon_handle.h>
|
||||
#include <clixon/clixon_err.h>
|
||||
#include <clixon/clixon_log.h>
|
||||
#include <clixon/clixon_debug.h>
|
||||
#include <clixon/clixon_netns.h>
|
||||
#include <clixon/clixon_yang.h>
|
||||
#include <clixon/clixon_yang_type.h>
|
||||
|
|
|
|||
|
|
@ -63,87 +63,87 @@ typedef struct {
|
|||
* Prototypes
|
||||
*/
|
||||
/* Generic clixon data API the form <name>=<val> where <val> is string */
|
||||
int clicon_data_get(clicon_handle h, const char *name, char **val);
|
||||
int clicon_data_set(clicon_handle h, const char *name, char *val);
|
||||
int clicon_data_del(clicon_handle h, const char *name);
|
||||
int clicon_data_get(clixon_handle h, const char *name, char **val);
|
||||
int clicon_data_set(clixon_handle h, const char *name, char *val);
|
||||
int clicon_data_del(clixon_handle h, const char *name);
|
||||
|
||||
/* Get generic clixon data on the form <name>=<ptr> where <ptr> is void* */
|
||||
int clicon_ptr_get(clicon_handle h, const char *name, void **ptr);
|
||||
int clicon_ptr_set(clicon_handle h, const char *name, void *ptr);
|
||||
int clicon_ptr_del(clicon_handle h, const char *name);
|
||||
int clicon_ptr_get(clixon_handle h, const char *name, void **ptr);
|
||||
int clicon_ptr_set(clixon_handle h, const char *name, void *ptr);
|
||||
int clicon_ptr_del(clixon_handle h, const char *name);
|
||||
|
||||
cvec *clicon_data_cvec_get(clicon_handle h, const char *name);
|
||||
int clicon_data_cvec_set(clicon_handle h, const char *name, cvec *cvv);
|
||||
int clicon_data_cvec_del(clicon_handle h, const char *name);
|
||||
cvec *clicon_data_cvec_get(clixon_handle h, const char *name);
|
||||
int clicon_data_cvec_set(clixon_handle h, const char *name, cvec *cvv);
|
||||
int clicon_data_cvec_del(clixon_handle h, const char *name);
|
||||
|
||||
/* String options, default NULL */
|
||||
int clicon_data_int_get(clicon_handle h, const char *name);
|
||||
int clicon_data_int_set(clicon_handle h, const char *name, int val);
|
||||
int clicon_data_int_del(clicon_handle h, const char *name);
|
||||
int clicon_data_int_get(clixon_handle h, const char *name);
|
||||
int clicon_data_int_set(clixon_handle h, const char *name, int val);
|
||||
int clicon_data_int_del(clixon_handle h, const char *name);
|
||||
|
||||
yang_stmt * clicon_dbspec_yang(clicon_handle h);
|
||||
int clicon_dbspec_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
yang_stmt * clicon_dbspec_yang(clixon_handle h);
|
||||
int clicon_dbspec_yang_set(clixon_handle h, yang_stmt *ys);
|
||||
|
||||
yang_stmt * clicon_config_yang(clicon_handle h);
|
||||
int clicon_config_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
yang_stmt * clicon_config_yang(clixon_handle h);
|
||||
int clicon_config_yang_set(clixon_handle h, yang_stmt *ys);
|
||||
|
||||
yang_stmt * clicon_nacm_ext_yang(clicon_handle h);
|
||||
int clicon_nacm_ext_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
yang_stmt * clicon_nacm_ext_yang(clixon_handle h);
|
||||
int clicon_nacm_ext_yang_set(clixon_handle h, yang_stmt *ys);
|
||||
|
||||
cvec *clicon_nsctx_global_get(clicon_handle h);
|
||||
int clicon_nsctx_global_set(clicon_handle h, cvec *nsctx);
|
||||
cvec *clicon_nsctx_global_get(clixon_handle h);
|
||||
int clicon_nsctx_global_set(clixon_handle h, cvec *nsctx);
|
||||
|
||||
cxobj * clicon_nacm_ext(clicon_handle h);
|
||||
int clicon_nacm_ext_set(clicon_handle h, cxobj *xn);
|
||||
cxobj * clicon_nacm_ext(clixon_handle h);
|
||||
int clicon_nacm_ext_set(clixon_handle h, cxobj *xn);
|
||||
|
||||
cxobj *clicon_nacm_cache(clicon_handle h);
|
||||
int clicon_nacm_cache_set(clicon_handle h, cxobj *xn);
|
||||
cxobj *clicon_nacm_cache(clixon_handle h);
|
||||
int clicon_nacm_cache_set(clixon_handle h, cxobj *xn);
|
||||
|
||||
cxobj *clicon_conf_xml(clicon_handle h);
|
||||
int clicon_conf_xml_set(clicon_handle h, cxobj *x);
|
||||
cxobj *clicon_conf_xml(clixon_handle h);
|
||||
int clicon_conf_xml_set(clixon_handle h, cxobj *x);
|
||||
|
||||
cxobj *clicon_conf_restconf(clicon_handle h);
|
||||
cxobj *clicon_conf_autocli(clicon_handle h);
|
||||
cxobj *clicon_conf_restconf(clixon_handle h);
|
||||
cxobj *clicon_conf_autocli(clixon_handle h);
|
||||
|
||||
db_elmnt *clicon_db_elmnt_get(clicon_handle h, const char *db);
|
||||
int clicon_db_elmnt_set(clicon_handle h, const char *db, db_elmnt *xc);
|
||||
db_elmnt *clicon_db_elmnt_get(clixon_handle h, const char *db);
|
||||
int clicon_db_elmnt_set(clixon_handle h, const char *db, db_elmnt *xc);
|
||||
|
||||
/**/
|
||||
/* Set and get authorized user name */
|
||||
char *clicon_username_get(clicon_handle h);
|
||||
int clicon_username_set(clicon_handle h, void *username);
|
||||
char *clicon_username_get(clixon_handle h);
|
||||
int clicon_username_set(clixon_handle h, void *username);
|
||||
|
||||
/* Set and get startup status */
|
||||
enum startup_status clicon_startup_status_get(clicon_handle h);
|
||||
int clicon_startup_status_set(clicon_handle h, enum startup_status status);
|
||||
enum startup_status clicon_startup_status_get(clixon_handle h);
|
||||
int clicon_startup_status_set(clixon_handle h, enum startup_status status);
|
||||
|
||||
/* Set and get server socket fd (ie backend server socket / restconf fcgi socket */
|
||||
int clicon_socket_get(clicon_handle h);
|
||||
int clicon_socket_set(clicon_handle h, int s);
|
||||
int clicon_socket_get(clixon_handle h);
|
||||
int clicon_socket_set(clixon_handle h, int s);
|
||||
|
||||
/* Set and get client socket fd (ie client cli / netconf / restconf / client-api socket */
|
||||
int clicon_client_socket_get(clicon_handle h);
|
||||
int clicon_client_socket_set(clicon_handle h, int s);
|
||||
int clicon_client_socket_get(clixon_handle h);
|
||||
int clicon_client_socket_set(clixon_handle h, int s);
|
||||
|
||||
/* Set and get module state full and brief cached tree */
|
||||
cxobj *clicon_modst_cache_get(clicon_handle h, int brief);
|
||||
int clicon_modst_cache_set(clicon_handle h, int brief, cxobj *xms);
|
||||
cxobj *clicon_modst_cache_get(clixon_handle h, int brief);
|
||||
int clicon_modst_cache_set(clixon_handle h, int brief, cxobj *xms);
|
||||
|
||||
/* Set and get yang/xml module revision changelog */
|
||||
cxobj *clicon_xml_changelog_get(clicon_handle h);
|
||||
int clicon_xml_changelog_set(clicon_handle h, cxobj *xchlog);
|
||||
cxobj *clicon_xml_changelog_get(clixon_handle h);
|
||||
int clicon_xml_changelog_set(clixon_handle h, cxobj *xchlog);
|
||||
|
||||
/* Set and get user command-line options (after --) */
|
||||
int clicon_argv_get(clicon_handle h, int *argc, char ***argv);
|
||||
int clicon_argv_set(clicon_handle h, char *argv0, int argc, char **argv);
|
||||
int clicon_argv_get(clixon_handle h, int *argc, char ***argv);
|
||||
int clicon_argv_set(clixon_handle h, char *argv0, int argc, char **argv);
|
||||
|
||||
/* Set and get (client/backend) session id */
|
||||
int clicon_session_id_set(clicon_handle h, uint32_t id);
|
||||
int clicon_session_id_get(clicon_handle h, uint32_t *id);
|
||||
int clicon_session_id_del(clicon_handle h);
|
||||
int clicon_session_id_set(clixon_handle h, uint32_t id);
|
||||
int clicon_session_id_get(clixon_handle h, uint32_t *id);
|
||||
int clicon_session_id_del(clixon_handle h);
|
||||
|
||||
/* If set, quit startup directly after upgrade */
|
||||
int clicon_quit_upgrade_get(clicon_handle h);
|
||||
int clicon_quit_upgrade_set(clicon_handle h, int val);
|
||||
int clicon_quit_upgrade_get(clixon_handle h);
|
||||
int clicon_quit_upgrade_set(clixon_handle h, int val);
|
||||
|
||||
#endif /* _CLIXON_DATA_H_ */
|
||||
|
|
|
|||
|
|
@ -43,39 +43,39 @@
|
|||
* API
|
||||
*/
|
||||
/* Internal functions */
|
||||
int xmldb_db2file(clicon_handle h, const char *db, char **filename);
|
||||
int xmldb_db2file(clixon_handle h, const char *db, char **filename);
|
||||
|
||||
/* API */
|
||||
int xmldb_connect(clicon_handle h);
|
||||
int xmldb_disconnect(clicon_handle h);
|
||||
int xmldb_connect(clixon_handle h);
|
||||
int xmldb_disconnect(clixon_handle h);
|
||||
/* in clixon_datastore_read.[ch] */
|
||||
int xmldb_get(clicon_handle h, const char *db, cvec *nsc, char *xpath, cxobj **xtop);
|
||||
int xmldb_get0(clicon_handle h, const char *db, yang_bind yb,
|
||||
int xmldb_get(clixon_handle h, const char *db, cvec *nsc, char *xpath, cxobj **xtop);
|
||||
int xmldb_get0(clixon_handle h, const char *db, yang_bind yb,
|
||||
cvec *nsc, const char *xpath, int copy, withdefaults_type wdef,
|
||||
cxobj **xtop, modstate_diff_t *msd, cxobj **xerr);
|
||||
int xmldb_get0_clear(clicon_handle h, cxobj *x);
|
||||
int xmldb_get0_free(clicon_handle h, cxobj **xp);
|
||||
int xmldb_put(clicon_handle h, const char *db, enum operation_type op, cxobj *xt, char *username, cbuf *cbret); /* in clixon_datastore_write.[ch] */
|
||||
int xmldb_copy(clicon_handle h, const char *from, const char *to);
|
||||
int xmldb_lock(clicon_handle h, const char *db, uint32_t id);
|
||||
int xmldb_unlock(clicon_handle h, const char *db);
|
||||
int xmldb_unlock_all(clicon_handle h, uint32_t id);
|
||||
uint32_t xmldb_islocked(clicon_handle h, const char *db);
|
||||
int xmldb_lock_timestamp(clicon_handle h, const char *db, struct timeval *tv);
|
||||
int xmldb_exists(clicon_handle h, const char *db);
|
||||
int xmldb_clear(clicon_handle h, const char *db);
|
||||
int xmldb_delete(clicon_handle h, const char *db);
|
||||
int xmldb_create(clicon_handle h, const char *db);
|
||||
int xmldb_get0_clear(clixon_handle h, cxobj *x);
|
||||
int xmldb_get0_free(clixon_handle h, cxobj **xp);
|
||||
int xmldb_put(clixon_handle h, const char *db, enum operation_type op, cxobj *xt, char *username, cbuf *cbret); /* in clixon_datastore_write.[ch] */
|
||||
int xmldb_copy(clixon_handle h, const char *from, const char *to);
|
||||
int xmldb_lock(clixon_handle h, const char *db, uint32_t id);
|
||||
int xmldb_unlock(clixon_handle h, const char *db);
|
||||
int xmldb_unlock_all(clixon_handle h, uint32_t id);
|
||||
uint32_t xmldb_islocked(clixon_handle h, const char *db);
|
||||
int xmldb_lock_timestamp(clixon_handle h, const char *db, struct timeval *tv);
|
||||
int xmldb_exists(clixon_handle h, const char *db);
|
||||
int xmldb_clear(clixon_handle h, const char *db);
|
||||
int xmldb_delete(clixon_handle h, const char *db);
|
||||
int xmldb_create(clixon_handle h, const char *db);
|
||||
/* utility functions */
|
||||
int xmldb_db_reset(clicon_handle h, const char *db);
|
||||
int xmldb_db_reset(clixon_handle h, const char *db);
|
||||
|
||||
cxobj *xmldb_cache_get(clicon_handle h, const char *db);
|
||||
cxobj *xmldb_cache_get(clixon_handle h, const char *db);
|
||||
|
||||
int xmldb_modified_get(clicon_handle h, const char *db);
|
||||
int xmldb_modified_set(clicon_handle h, const char *db, int value);
|
||||
int xmldb_empty_get(clicon_handle h, const char *db);
|
||||
int xmldb_dump(clicon_handle h, FILE *f, cxobj *xt);
|
||||
int xmldb_print(clicon_handle h, FILE *f);
|
||||
int xmldb_rename(clicon_handle h, const char *db, const char *newdb, const char *suffix);
|
||||
int xmldb_modified_get(clixon_handle h, const char *db);
|
||||
int xmldb_modified_set(clixon_handle h, const char *db, int value);
|
||||
int xmldb_empty_get(clixon_handle h, const char *db);
|
||||
int xmldb_dump(clixon_handle h, FILE *f, cxobj *xt);
|
||||
int xmldb_print(clixon_handle h, FILE *f);
|
||||
int xmldb_rename(clixon_handle h, const char *db, const char *newdb, const char *suffix);
|
||||
|
||||
#endif /* _CLIXON_DATASTORE_H */
|
||||
|
|
|
|||
60
lib/clixon/clixon_debug.h
Normal file
60
lib/clixon/clixon_debug.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
Copyright (C) 2017-2019 Olof Hagsand
|
||||
Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC (Netgate)
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 3 or later (the "GPL"),
|
||||
in which case the provisions of the GPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of the GPL, and not to allow others to
|
||||
use your version of this file under the terms of Apache License version 2,
|
||||
indicate your decision by deleting the provisions above and replace them with
|
||||
the notice and other provisions required by the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the Apache License version 2 or the GPL.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
|
||||
*
|
||||
* Clixon debugging
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_DEBUG_H_
|
||||
#define _CLIXON_DEBUG_H_
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
||||
/* Debug-level masks */
|
||||
#define CLIXON_DBG_DEFAULT 1 /* Default logs */
|
||||
#define CLIXON_DBG_MSG 2 /* In/out messages and datastore reads */
|
||||
#define CLIXON_DBG_DETAIL 4 /* Details: traces, parse trees, etc */
|
||||
#define CLIXON_DBG_EXTRA 8 /* Extra Detailed logs */
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clixon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int clixon_debug_init(clixon_handle h, int dbglevel);
|
||||
int clixon_debug_get(void);
|
||||
|
||||
#endif /* _CLIXON_DEBUG_H_ */
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
*
|
||||
* Errors may be syslogged using LOG_ERR, and printed to stderr, as controlled by
|
||||
* clicon_log_init
|
||||
* global error variables are set:
|
||||
* clicon_errno, clicon_suberrno, clicon_err_reason.
|
||||
* clixon_log_init
|
||||
* Details about the errors may be retreievd by access functions
|
||||
* clixon_err_reason(), clixon_err_subnr(), etc
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_ERR_H_
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
* Add error category here,
|
||||
* @see EV variable in clixon_err.c but must also add an entry there
|
||||
*/
|
||||
enum clicon_err{
|
||||
enum clixon_err{
|
||||
/* 0 means error not set) */
|
||||
OE_DB = 1, /* database registries */
|
||||
OE_DAEMON, /* daemons: pidfiles, etc */
|
||||
|
|
@ -91,28 +91,35 @@ enum clicon_err{
|
|||
*/
|
||||
typedef int (clixon_cat_log_cb)(void *handle, int suberr, cbuf *cb);
|
||||
|
||||
/*
|
||||
* Variables
|
||||
* XXX: should not be global
|
||||
*/
|
||||
extern int clicon_errno; /* CLICON errors (see clicon_err) */
|
||||
extern int clicon_suberrno; /* Eg orig errno */
|
||||
extern char clicon_err_reason[ERR_STRLEN];
|
||||
|
||||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define clicon_err(e,s,_fmt, args...) clicon_err_fn(__FUNCTION__, __LINE__, (e), (s), _fmt , ##args)
|
||||
#define clixon_err(e,s,_fmt, args...) clixon_err_fn(__FUNCTION__, __LINE__, (e), (s), _fmt , ##args)
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clicon_err_reset(void);
|
||||
int clicon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
char *clicon_strerror(int err);
|
||||
void *clicon_err_save(void);
|
||||
int clicon_err_restore(void *handle);
|
||||
int clixon_err_cat_reg(enum clicon_err category, void *handle, clixon_cat_log_cb logfn);
|
||||
int clixon_err_init(clixon_handle h);
|
||||
int clixon_err_category(void);
|
||||
int clixon_err_subnr(void);
|
||||
char *clixon_err_reason(void);
|
||||
char *clixon_err_str(void);
|
||||
int clixon_err_reset(void);
|
||||
int clixon_err_args(clixon_handle h, const char *fn, const int line, int category, int suberr, char *msg);
|
||||
int clixon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
|
||||
void *clixon_err_save(void);
|
||||
int clixon_err_restore(void *handle);
|
||||
int clixon_err_cat_reg(enum clixon_err category, void *handle, clixon_cat_log_cb logfn);
|
||||
int clixon_err_exit(void);
|
||||
|
||||
#if 1 /* COMPAT_6_5 */
|
||||
#define clicon_err(e,s,_fmt, args...) clixon_err_fn(__FUNCTION__, __LINE__, (e), (s), _fmt , ##args)
|
||||
#define clicon_err_reset() clixon_err_reset()
|
||||
|
||||
#define clicon_errno clixon_err_category()
|
||||
#define clicon_suberrno clixon_err_subnr()
|
||||
#define clicon_err_reason clixon_err_reason()
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_ERR_H_ */
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ int clixon_event_unreg_timeout(int (*fn)(int, void*), void *arg);
|
|||
|
||||
int clixon_event_poll(int fd);
|
||||
|
||||
int clixon_event_loop(clicon_handle h);
|
||||
int clixon_event_loop(clixon_handle h);
|
||||
|
||||
int clixon_event_exit(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
cli/backend/netconf or other plugin. But this is hidden under-the-hood.
|
||||
*/
|
||||
typedef void *clixon_handle;
|
||||
typedef void *clicon_handle;
|
||||
|
||||
/* The dynamicically loadable plugin object handle (should be in clixon_plugin.h) */
|
||||
typedef void *plghndl_t;
|
||||
|
|
@ -67,30 +66,37 @@ typedef int (clicon_output_cb)(
|
|||
* Prototypes
|
||||
*/
|
||||
/* Basic CLICON init functions returning a handle for API access. */
|
||||
clicon_handle clicon_handle_init(void);
|
||||
clixon_handle clixon_handle_init(void);
|
||||
|
||||
/* Internal call to allocate a CLICON handle. */
|
||||
clicon_handle clicon_handle_init0(int size);
|
||||
clixon_handle clixon_handle_init0(int size);
|
||||
|
||||
/* Deallocate handle */
|
||||
int clicon_handle_exit(clicon_handle h);
|
||||
int clixon_handle_exit(clixon_handle h);
|
||||
|
||||
/* Check struct magic number for sanity checks */
|
||||
int clicon_handle_check(clicon_handle h);
|
||||
int clixon_handle_check(clixon_handle h);
|
||||
|
||||
/* Return clicon options (hash-array) given a handle.*/
|
||||
clicon_hash_t *clicon_options(clicon_handle h);
|
||||
clicon_hash_t *clicon_options(clixon_handle h);
|
||||
|
||||
/* Return internal clicon data (hash-array) given a handle.*/
|
||||
clicon_hash_t *clicon_data(clicon_handle h);
|
||||
clicon_hash_t *clicon_data(clixon_handle h);
|
||||
|
||||
/* Return internal clicon db_elmnt (hash-array) given a handle.*/
|
||||
clicon_hash_t *clicon_db_elmnt(clicon_handle h);
|
||||
clicon_hash_t *clicon_db_elmnt(clixon_handle h);
|
||||
|
||||
/* Return internal stream hash-array given a handle.*/
|
||||
struct event_stream *clicon_stream(clicon_handle h);
|
||||
struct event_stream *clicon_stream(clixon_handle h);
|
||||
struct event_stream;
|
||||
int clicon_stream_set(clicon_handle h, struct event_stream *es);
|
||||
int clicon_stream_append(clicon_handle h, struct event_stream *es);
|
||||
int clicon_stream_set(clixon_handle h, struct event_stream *es);
|
||||
int clicon_stream_append(clixon_handle h, struct event_stream *es);
|
||||
|
||||
/* COMPAT_6_5 */
|
||||
#if 1
|
||||
typedef void *clicon_handle;
|
||||
#define clicon_handle_init() clixon_handle_init()
|
||||
#define clicon_handle_exit(h) clixon_handle_exit(h)
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_HANDLE_H_ */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
***** END LICENSE BLOCK *****
|
||||
|
||||
*
|
||||
* Regular logging and debugging. Syslog using levels.
|
||||
* Regular logging, syslog using levels.
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_LOG_H_
|
||||
|
|
@ -44,38 +44,38 @@
|
|||
* Constants
|
||||
*/
|
||||
/* Where to log (masks) */
|
||||
#define CLICON_LOG_SYSLOG 1 /* print logs on syslog */
|
||||
#define CLICON_LOG_STDERR 2 /* print logs on stderr */
|
||||
#define CLICON_LOG_STDOUT 4 /* print logs on stdout */
|
||||
#define CLICON_LOG_FILE 8 /* print logs on clicon_log_filename */
|
||||
|
||||
/* Debug-level masks */
|
||||
#define CLIXON_DBG_DEFAULT 1 /* Default logs */
|
||||
#define CLIXON_DBG_MSG 2 /* In/out messages and datastore reads */
|
||||
#define CLIXON_DBG_DETAIL 4 /* Details: traces, parse trees, etc */
|
||||
#define CLIXON_DBG_EXTRA 8 /* Extra Detailed logs */
|
||||
#define CLIXON_LOG_SYSLOG 1 /* print logs on syslog */
|
||||
#define CLIXON_LOG_STDERR 2 /* print logs on stderr */
|
||||
#define CLIXON_LOG_STDOUT 4 /* print logs on stdout */
|
||||
#define CLIXON_LOG_FILE 8 /* print logs on clicon_log_filename */
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clicon_log_init(char *ident, int upto, int flags);
|
||||
int clicon_log_exit(void);
|
||||
int clicon_log_opt(char c);
|
||||
int clicon_log_file(char *filename);
|
||||
int clicon_log_string_limit_set(size_t sz);
|
||||
size_t clicon_log_string_limit_get(void);
|
||||
int clicon_get_logflags(void);
|
||||
int clicon_log_str(int level, char *msg);
|
||||
int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int clixon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int clixon_debug_init(int dbglevel, FILE *f);
|
||||
int clixon_debug_get(void);
|
||||
char *mon2name(int md);
|
||||
int clixon_log_init(clixon_handle h, char *ident, int upto, int flags);
|
||||
int clixon_log_exit(void);
|
||||
int clixon_log_opt(char c);
|
||||
int clixon_log_file(char *filename);
|
||||
int clixon_log_string_limit_set(size_t sz);
|
||||
size_t clixon_log_string_limit_get(void);
|
||||
int clixon_get_logflags(void);
|
||||
int clixon_log_str(int level, char *msg);
|
||||
int clixon_log(clixon_handle h, int level, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
char *clixon_log_mon2name(int md);
|
||||
|
||||
#if 1 /* COMPAT_6_5 */
|
||||
#define CLICON_LOG_SYSLOG CLIXON_LOG_SYSLOG
|
||||
#define CLICON_LOG_STDERR CLIXON_LOG_STDERR
|
||||
#define CLICON_LOG_STDOUT CLIXON_LOG_STDOUT
|
||||
#define CLICON_LOG_FILE CLIXON_LOG_FILE
|
||||
|
||||
#define clicon_log(l, f, args...) clixon_log(NULL, (l), (f), ##args)
|
||||
#define clicon_log_exit() clixon_log_exit()
|
||||
#define clicon_log_opt(c) clixon_log_opt((c))
|
||||
#define clicon_log_file(f) clixon_log_file((f))
|
||||
|
||||
int clicon_log_init(char *ident, int upto, int flags);
|
||||
|
||||
#endif /* COMPAT_6_5 */
|
||||
|
||||
/* 6.4 backward compatability */
|
||||
#if 1
|
||||
#define clicon_debug clixon_debug
|
||||
#define clicon_debug_init clixon_debug_init
|
||||
#define clicon_debug_get clixon_debug_get
|
||||
#endif
|
||||
#endif /* _CLIXON_LOG_H_ */
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ enum nacm_access{
|
|||
* Prototypes
|
||||
*/
|
||||
int nacm_rpc(char *rpc, char *module, char *username, cxobj *xnacm, cbuf *cbret);
|
||||
int nacm_datanode_read(clicon_handle h, cxobj *xt, cxobj **xvec, size_t xlen, char *username,
|
||||
int nacm_datanode_read(clixon_handle h, cxobj *xt, cxobj **xvec, size_t xlen, char *username,
|
||||
cxobj *nacm_xtree);
|
||||
int nacm_datanode_write(clicon_handle h, cxobj *xr, cxobj *xt,
|
||||
int nacm_datanode_write(clixon_handle h, cxobj *xr, cxobj *xt,
|
||||
enum nacm_access access,
|
||||
char *username, cxobj *xnacm, cbuf *cbret);
|
||||
int nacm_access_pre(clicon_handle h, char *peername, char *username, cxobj **xnacmp);
|
||||
int verify_nacm_user(clicon_handle h, enum nacm_credentials_t cred, char *peername, char *nacmname, cbuf *cbret);
|
||||
int nacm_access_pre(clixon_handle h, char *peername, char *username, cxobj **xnacmp);
|
||||
int verify_nacm_user(clixon_handle h, enum nacm_credentials_t cred, char *peername, char *nacmname, cbuf *cbret);
|
||||
|
||||
#endif /* _CLIXON_NACM_H */
|
||||
|
|
|
|||
|
|
@ -147,14 +147,6 @@ typedef enum withdefaults_type withdefaults_type;
|
|||
/*
|
||||
* Macros
|
||||
*/
|
||||
/*! Generate textual error log from Netconf error message
|
||||
*
|
||||
* @param[in] xerr Netconf error xml tree on the form: <rpc-error>
|
||||
* @param[in] format Format string
|
||||
* @param[in] arg String argument to format (optional)
|
||||
*/
|
||||
#define clixon_netconf_error(h, x, f, a) clixon_netconf_error_fn((h), __FUNCTION__, __LINE__, (x), (f), (a))
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
|
@ -196,24 +188,34 @@ int netconf_data_not_unique(cbuf *cb, cxobj *x, cvec *cvk);
|
|||
int netconf_data_not_unique_xml(cxobj **xret, cxobj *x, cvec *cvk);
|
||||
int netconf_minmax_elements_xml(cxobj **xret, cxobj *xp, char *name, int max);
|
||||
int netconf_trymerge(cxobj *x, yang_stmt *yspec, cxobj **xret);
|
||||
int netconf_module_features(clicon_handle h);
|
||||
int netconf_module_load(clicon_handle h);
|
||||
int netconf_module_features(clixon_handle h);
|
||||
int netconf_module_load(clixon_handle h);
|
||||
char *netconf_db_find(cxobj *xn, char *name);
|
||||
int netconf_err2cb(clicon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
const netconf_content netconf_content_str2int(char *str);
|
||||
const char *netconf_content_int2str(netconf_content nr);
|
||||
int netconf_capabilites(clicon_handle h, cbuf *cb);
|
||||
int netconf_hello_server(clicon_handle h, cbuf *cb, uint32_t session_id);
|
||||
int netconf_hello_req(clicon_handle h, cbuf *cb);
|
||||
int clixon_netconf_error_fn(clicon_handle h, const char *fn, const int line, cxobj *xerr, const char *fmt, const char *arg);
|
||||
int netconf_capabilites(clixon_handle h, cbuf *cb);
|
||||
int netconf_hello_server(clixon_handle h, cbuf *cb, uint32_t session_id);
|
||||
int netconf_hello_req(clixon_handle h, cbuf *cb);
|
||||
int clixon_netconf_internal_error(cxobj *xerr, char *msg, char *arg);
|
||||
int netconf_parse_uint32(char *name, char *valstr, char *defaultstr, uint32_t defaultval, cbuf *cbret, uint32_t *value);
|
||||
int netconf_parse_uint32_xml(char *name, char *valstr, char *defaultstr, uint32_t defaultval, cxobj **xerr, uint32_t *value);
|
||||
int netconf_message_id_next(clicon_handle h);
|
||||
int netconf_message_id_next(clixon_handle h);
|
||||
int netconf_framing_preamble(netconf_framing_type framing, cbuf *cb);
|
||||
int netconf_framing_postamble(netconf_framing_type framing, cbuf *cb);
|
||||
int netconf_output(int s, cbuf *xf, char *msg);
|
||||
int netconf_output_encap(netconf_framing_type framing, cbuf *cb);
|
||||
int netconf_input_chunked_framing(char ch, int *state, size_t *size);
|
||||
|
||||
/* Netconf error handling */
|
||||
#define clixon_err_netconf(h,c,s,x,_fmt, args...) clixon_err_netconf_fn((h), __FUNCTION__, __LINE__, (c), (s), (x), _fmt , ##args)
|
||||
|
||||
int netconf_err2cb(clixon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_err_netconf_fn(clixon_handle h, const char *fn, const int line, int category,
|
||||
int suberr, cxobj *xerr, const char *format, ...) __attribute__ ((format (printf, 7, 8)));;
|
||||
|
||||
#if 1 /* COMPAT_6_5 */
|
||||
/* doesnt work if arg != NULL */
|
||||
#define clixon_netconf_error(h, x, f, a) clixon_err_netconf_fn((h), __FUNCTION__, __LINE__, OE_XML, 0,(x), (f) , NULL)
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_NETCONF_LIB_H */
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int netconf_monitoring_state_get(clicon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int netconf_monitoring_statistics_init(clicon_handle h);
|
||||
int netconf_monitoring_counter_inc(clicon_handle h, char *name);
|
||||
int netconf_monitoring_state_get(clixon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int netconf_monitoring_statistics_init(clixon_handle h);
|
||||
int netconf_monitoring_counter_inc(clixon_handle h, char *name);
|
||||
|
||||
#endif /* _CLIXON_NETCONF_MONITORING_H_ */
|
||||
|
|
|
|||
|
|
@ -109,105 +109,105 @@ enum regexp_mode{
|
|||
*/
|
||||
|
||||
/* Debug dump config options */
|
||||
int clicon_option_dump(clicon_handle h, int dblevel);
|
||||
int clicon_option_dump(clixon_handle h, int dblevel);
|
||||
|
||||
/*! Dump config options on stdio using output format */
|
||||
int clicon_option_dump1(clicon_handle h, FILE *f, int format, int pretty);
|
||||
int clicon_option_dump1(clixon_handle h, FILE *f, int format, int pretty);
|
||||
|
||||
/* Add a clicon options overriding file setting */
|
||||
int clicon_option_add(clicon_handle h, const char *name, char *value);
|
||||
int clicon_option_add(clixon_handle h, const char *name, char *value);
|
||||
|
||||
/* Initialize options: set defaults, read config-file, etc */
|
||||
int clicon_options_main(clicon_handle h);
|
||||
int clicon_options_main(clixon_handle h);
|
||||
|
||||
/*! Check if a clicon option has a value */
|
||||
int clicon_option_exists(clicon_handle h, const char *name);
|
||||
int clicon_option_exists(clixon_handle h, const char *name);
|
||||
|
||||
/* String options, default NULL */
|
||||
char *clicon_option_str(clicon_handle h, const char *name);
|
||||
int clicon_option_str_set(clicon_handle h, const char *name, char *val);
|
||||
char *clicon_option_str(clixon_handle h, const char *name);
|
||||
int clicon_option_str_set(clixon_handle h, const char *name, char *val);
|
||||
|
||||
/* Option values gixen as int, default -1 */
|
||||
int clicon_option_int(clicon_handle h, const char *name);
|
||||
int clicon_option_int_set(clicon_handle h, const char *name, int val);
|
||||
int clicon_option_int(clixon_handle h, const char *name);
|
||||
int clicon_option_int_set(clixon_handle h, const char *name, int val);
|
||||
|
||||
/* Option values gixen as bool, default false */
|
||||
int clicon_option_bool(clicon_handle h, const char *name);
|
||||
int clicon_option_bool_set(clicon_handle h, const char *name, int val);
|
||||
int clicon_option_bool(clixon_handle h, const char *name);
|
||||
int clicon_option_bool_set(clixon_handle h, const char *name, int val);
|
||||
|
||||
/* Delete a single option via handle */
|
||||
int clicon_option_del(clicon_handle h, const char *name);
|
||||
int clicon_option_del(clixon_handle h, const char *name);
|
||||
|
||||
/*-- Standard option access functions for YANG options --*/
|
||||
static inline char *clicon_configfile(clicon_handle h){
|
||||
static inline char *clicon_configfile(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_CONFIGFILE");
|
||||
}
|
||||
static inline char *clicon_yang_main_file(clicon_handle h){
|
||||
static inline char *clicon_yang_main_file(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_MAIN_FILE");
|
||||
}
|
||||
static inline char *clicon_yang_main_dir(clicon_handle h){
|
||||
static inline char *clicon_yang_main_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_MAIN_DIR");
|
||||
}
|
||||
static inline char *clicon_yang_module_main(clicon_handle h){
|
||||
static inline char *clicon_yang_module_main(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_MODULE_MAIN");
|
||||
}
|
||||
static inline char *clicon_yang_module_revision(clicon_handle h){
|
||||
static inline char *clicon_yang_module_revision(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_YANG_MODULE_REVISION");
|
||||
}
|
||||
static inline char *clicon_backend_dir(clicon_handle h){
|
||||
static inline char *clicon_backend_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_BACKEND_DIR");
|
||||
}
|
||||
static inline char *clicon_netconf_dir(clicon_handle h){
|
||||
static inline char *clicon_netconf_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_NETCONF_DIR");
|
||||
}
|
||||
static inline char *clicon_restconf_dir(clicon_handle h){
|
||||
static inline char *clicon_restconf_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_RESTCONF_DIR");
|
||||
}
|
||||
static inline char *clicon_cli_dir(clicon_handle h){
|
||||
static inline char *clicon_cli_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_CLI_DIR");
|
||||
}
|
||||
static inline char *clicon_clispec_dir(clicon_handle h){
|
||||
static inline char *clicon_clispec_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_CLISPEC_DIR");
|
||||
}
|
||||
static inline char *clicon_cli_mode(clicon_handle h){
|
||||
static inline char *clicon_cli_mode(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_CLI_MODE");
|
||||
}
|
||||
static inline int clicon_cli_tab_mode(clicon_handle h){
|
||||
static inline int clicon_cli_tab_mode(clixon_handle h){
|
||||
return clicon_option_int(h, "CLICON_CLI_TAB_MODE");
|
||||
}
|
||||
static inline char *clicon_sock_str(clicon_handle h){
|
||||
static inline char *clicon_sock_str(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_SOCK");
|
||||
}
|
||||
static inline char *clicon_sock_group(clicon_handle h){
|
||||
static inline char *clicon_sock_group(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_SOCK_GROUP");
|
||||
}
|
||||
static inline char *clicon_backend_user(clicon_handle h){
|
||||
static inline char *clicon_backend_user(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_BACKEND_USER");
|
||||
}
|
||||
static inline char *clicon_backend_pidfile(clicon_handle h){
|
||||
static inline char *clicon_backend_pidfile(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_BACKEND_PIDFILE");
|
||||
}
|
||||
static inline char *clicon_xmldb_dir(clicon_handle h){
|
||||
static inline char *clicon_xmldb_dir(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_XMLDB_DIR");
|
||||
}
|
||||
static inline char *clicon_nacm_recovery_user(clicon_handle h){
|
||||
static inline char *clicon_nacm_recovery_user(clixon_handle h){
|
||||
return clicon_option_str(h, "CLICON_NACM_RECOVERY_USER");
|
||||
}
|
||||
|
||||
/*-- Specific option access functions for YANG options w type conversion--*/
|
||||
int clicon_cli_varonly(clicon_handle h);
|
||||
int clicon_sock_family(clicon_handle h);
|
||||
int clicon_sock_port(clicon_handle h);
|
||||
int clicon_autocommit(clicon_handle h);
|
||||
int clicon_startup_mode(clicon_handle h);
|
||||
enum priv_mode_t clicon_backend_privileges_mode(clicon_handle h);
|
||||
enum priv_mode_t clicon_restconf_privileges_mode(clicon_handle h);
|
||||
enum nacm_credentials_t clicon_nacm_credentials(clicon_handle h);
|
||||
int clicon_cli_varonly(clixon_handle h);
|
||||
int clicon_sock_family(clixon_handle h);
|
||||
int clicon_sock_port(clixon_handle h);
|
||||
int clicon_autocommit(clixon_handle h);
|
||||
int clicon_startup_mode(clixon_handle h);
|
||||
enum priv_mode_t clicon_backend_privileges_mode(clixon_handle h);
|
||||
enum priv_mode_t clicon_restconf_privileges_mode(clixon_handle h);
|
||||
enum nacm_credentials_t clicon_nacm_credentials(clixon_handle h);
|
||||
|
||||
enum datastore_cache clicon_datastore_cache(clicon_handle h);
|
||||
enum regexp_mode clicon_yang_regexp(clicon_handle h);
|
||||
enum datastore_cache clicon_datastore_cache(clixon_handle h);
|
||||
enum regexp_mode clicon_yang_regexp(clixon_handle h);
|
||||
/*-- Specific option access functions for non-yang options --*/
|
||||
int clicon_quiet_mode(clicon_handle h);
|
||||
int clicon_quiet_mode_set(clicon_handle h, int val);
|
||||
int clicon_quiet_mode(clixon_handle h);
|
||||
int clicon_quiet_mode_set(clixon_handle h, int val);
|
||||
|
||||
#endif /* _CLIXON_OPTIONS_H_ */
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (*clicon_rpc_cb)(
|
||||
clicon_handle h,
|
||||
clixon_handle h,
|
||||
cxobj *xn,
|
||||
cbuf *cbret,
|
||||
void *arg,
|
||||
|
|
@ -84,7 +84,7 @@ typedef int (*clicon_rpc_cb)(
|
|||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (*clicon_upgrade_cb)(
|
||||
clicon_handle h,
|
||||
clixon_handle h,
|
||||
cxobj *xn,
|
||||
char *ns,
|
||||
uint16_t op,
|
||||
|
|
@ -121,19 +121,19 @@ typedef enum clixon_auth_type clixon_auth_type_t;
|
|||
* this callback is called *before* privileges are dropped.
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
typedef int (plgstart_t)(clicon_handle); /* Plugin start */
|
||||
typedef int (plgstart_t)(clixon_handle); /* Plugin start */
|
||||
|
||||
/* Called just before or after a server has "daemonized", ie put in background.
|
||||
* Backend: If daemon privileges are dropped this callback is called *before* privileges are dropped.
|
||||
* If daemon is started in foreground (-F): pre-daemon is not called, but daemon called
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
typedef int (plgdaemon_t)(clicon_handle); /* Plugin pre/post daemonized */
|
||||
typedef int (plgdaemon_t)(clixon_handle); /* Plugin pre/post daemonized */
|
||||
|
||||
/* Called just before plugin unloaded.
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
typedef int (plgexit_t)(clicon_handle); /* Plugin exit */
|
||||
typedef int (plgexit_t)(clixon_handle); /* Plugin exit */
|
||||
|
||||
/* For yang extension/unknown handling.
|
||||
* Called at parsing of yang module containing an unknown statement of an extension.
|
||||
|
|
@ -147,7 +147,7 @@ typedef int (plgexit_t)(clicon_handle); /* Plugin exit */
|
|||
* @retval 0 OK, all callbacks executed OK
|
||||
* @retval -1 Error in one callback
|
||||
*/
|
||||
typedef int (plgextension_t)(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
typedef int (plgextension_t)(clixon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
|
||||
/*! Called by restconf on each incoming request to check credentials and return username
|
||||
*/
|
||||
|
|
@ -188,7 +188,7 @@ typedef int (plgextension_t)(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
|||
*
|
||||
* @note user should be freed by caller
|
||||
*/
|
||||
typedef int (plgauth_t)(clicon_handle h, void *req, clixon_auth_type_t auth_type, char **authp);
|
||||
typedef int (plgauth_t)(clixon_handle h, void *req, clixon_auth_type_t auth_type, char **authp);
|
||||
|
||||
/*! Reset system status
|
||||
*
|
||||
|
|
@ -204,7 +204,7 @@ typedef int (plgauth_t)(clicon_handle h, void *req, clixon_auth_type_t auth_type
|
|||
* @retval 0 OK
|
||||
* @retval -1 Fatal error
|
||||
*/
|
||||
typedef int (plgreset_t)(clicon_handle h, const char *db);
|
||||
typedef int (plgreset_t)(clixon_handle h, const char *db);
|
||||
|
||||
/* Provide state data from plugin
|
||||
*
|
||||
|
|
@ -225,7 +225,7 @@ typedef int (plgreset_t)(clicon_handle h, const char *db);
|
|||
* @note The system does not validate the xml, unless CLICON_VALIDATE_STATE_XML is set
|
||||
* @see clixon_pagination_cb_register for special paginated state data callback
|
||||
*/
|
||||
typedef int (plgstatedata_t)(clicon_handle h, cvec *nsc, char *xpath, cxobj *xtop);
|
||||
typedef int (plgstatedata_t)(clixon_handle h, cvec *nsc, char *xpath, cxobj *xtop);
|
||||
|
||||
/*! Pagination-data type
|
||||
*
|
||||
|
|
@ -243,7 +243,7 @@ typedef void *pagination_data;
|
|||
* @retval 0 OK
|
||||
* @retval -1 Fatal error
|
||||
*/
|
||||
typedef int (plglockdb_t)(clicon_handle h, char *db, int lock, int id);
|
||||
typedef int (plglockdb_t)(clixon_handle h, char *db, int lock, int id);
|
||||
|
||||
/*! Transaction-data type
|
||||
*
|
||||
|
|
@ -252,7 +252,7 @@ typedef int (plglockdb_t)(clicon_handle h, char *db, int lock, int id);
|
|||
typedef void *transaction_data;
|
||||
|
||||
/* Transaction callback */
|
||||
typedef int (trans_cb_t)(clicon_handle h, transaction_data td);
|
||||
typedef int (trans_cb_t)(clixon_handle h, transaction_data td);
|
||||
|
||||
/*! Hook to override default prompt with explicit function
|
||||
*
|
||||
|
|
@ -261,7 +261,7 @@ typedef int (trans_cb_t)(clicon_handle h, transaction_data td);
|
|||
* @param[in] mode Cligen syntax mode
|
||||
* @retval prompt Prompt to prepend all CLigen command lines
|
||||
*/
|
||||
typedef char *(cli_prompthook_t)(clicon_handle, char *mode);
|
||||
typedef char *(cli_prompthook_t)(clixon_handle, char *mode);
|
||||
|
||||
/*! General-purpose datastore upgrade callback called once on startupo
|
||||
*
|
||||
|
|
@ -274,7 +274,7 @@ typedef char *(cli_prompthook_t)(clicon_handle, char *mode);
|
|||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (datastore_upgrade_t)(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
typedef int (datastore_upgrade_t)(clixon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
/*! YANG schema mount
|
||||
*
|
||||
|
|
@ -298,7 +298,7 @@ typedef int (datastore_upgrade_t)(clicon_handle h, const char *db, cxobj *xt, mo
|
|||
* at proper parse-time, but this is not visible in the yanglib return
|
||||
* @see RFC 8528 (schema-mount) and RFC 8525 (yang-lib)
|
||||
*/
|
||||
typedef int (yang_mount_t)(clicon_handle h, cxobj *xt, int *config,
|
||||
typedef int (yang_mount_t)(clixon_handle h, cxobj *xt, int *config,
|
||||
validate_level *vl, cxobj **yanglib);
|
||||
|
||||
/*! YANG module patch
|
||||
|
|
@ -312,7 +312,7 @@ typedef int (yang_mount_t)(clicon_handle h, cxobj *xt, int *config,
|
|||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (yang_patch_t)(clicon_handle h, yang_stmt *ymod);
|
||||
typedef int (yang_patch_t)(clixon_handle h, yang_stmt *ymod);
|
||||
|
||||
/*! Callback to customize Netconf error message
|
||||
*
|
||||
|
|
@ -322,7 +322,7 @@ typedef int (yang_patch_t)(clicon_handle h, yang_stmt *ymod);
|
|||
* @retval 0 OK, with cberr set
|
||||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (netconf_errmsg_t)(clicon_handle, cxobj *xerr, cbuf *cberr);
|
||||
typedef int (netconf_errmsg_t)(clixon_handle, cxobj *xerr, cbuf *cberr);
|
||||
|
||||
/*! Callback for printing version output and exit
|
||||
*
|
||||
|
|
@ -335,7 +335,7 @@ typedef int (netconf_errmsg_t)(clicon_handle, cxobj *xerr, cbuf *cberr);
|
|||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
typedef int (plgversion_t)(clicon_handle, FILE*);
|
||||
typedef int (plgversion_t)(clixon_handle, FILE*);
|
||||
|
||||
/*! Startup status for use in startup-callback
|
||||
*
|
||||
|
|
@ -355,7 +355,7 @@ enum startup_status{
|
|||
* Note: Implicit init function
|
||||
*/
|
||||
struct clixon_plugin_api;
|
||||
typedef struct clixon_plugin_api* (plginit_t)(clicon_handle); /* Clixon plugin Init */
|
||||
typedef struct clixon_plugin_api* (plginit_t)(clixon_handle); /* Clixon plugin Init */
|
||||
|
||||
struct clixon_plugin_api{
|
||||
/*--- Common fields. ---*/
|
||||
|
|
@ -464,62 +464,62 @@ typedef struct {
|
|||
* @retval NULL Failure (if clixon_err() called), module disabled otherwise.
|
||||
* @see CLIXON_PLUGIN_INIT default symbol
|
||||
*/
|
||||
clixon_plugin_api *clixon_plugin_init(clicon_handle h);
|
||||
clixon_plugin_api *clixon_plugin_init(clixon_handle h);
|
||||
|
||||
clixon_plugin_api *clixon_plugin_api_get(clixon_plugin_t *cp);
|
||||
char *clixon_plugin_name_get(clixon_plugin_t *cp);
|
||||
plghndl_t clixon_plugin_handle_get(clixon_plugin_t *cp);
|
||||
|
||||
clixon_plugin_t *clixon_plugin_each(clicon_handle h, clixon_plugin_t *cpprev);
|
||||
clixon_plugin_t *clixon_plugin_each(clixon_handle h, clixon_plugin_t *cpprev);
|
||||
|
||||
clixon_plugin_t *clixon_plugin_each_revert(clicon_handle h, clixon_plugin_t *cpprev, int nr);
|
||||
clixon_plugin_t *clixon_plugin_each_revert(clixon_handle h, clixon_plugin_t *cpprev, int nr);
|
||||
|
||||
clixon_plugin_t *clixon_plugin_find(clicon_handle h, const char *name);
|
||||
clixon_plugin_t *clixon_plugin_find(clixon_handle h, const char *name);
|
||||
|
||||
int clixon_plugins_load(clicon_handle h, const char *function, const char *dir, const char *regexp);
|
||||
int clixon_plugins_load(clixon_handle h, const char *function, const char *dir, const char *regexp);
|
||||
|
||||
int clixon_pseudo_plugin(clicon_handle h, const char *name, clixon_plugin_t **cpp);
|
||||
int clixon_pseudo_plugin(clixon_handle h, const char *name, clixon_plugin_t **cpp);
|
||||
|
||||
int plugin_context_check(clicon_handle h, void **wh, const char *name, const char *fn);
|
||||
int plugin_context_check(clixon_handle h, void **wh, const char *name, const char *fn);
|
||||
|
||||
int clixon_plugin_start_one(clixon_plugin_t *cp, clicon_handle h);
|
||||
int clixon_plugin_start_all(clicon_handle h);
|
||||
int clixon_plugin_start_one(clixon_plugin_t *cp, clixon_handle h);
|
||||
int clixon_plugin_start_all(clixon_handle h);
|
||||
|
||||
int clixon_plugin_auth_all(clicon_handle h, void *req, clixon_auth_type_t auth_type, char **authp);
|
||||
int clixon_plugin_auth_all(clixon_handle h, void *req, clixon_auth_type_t auth_type, char **authp);
|
||||
|
||||
int clixon_plugin_extension_one(clixon_plugin_t *cp, clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
int clixon_plugin_extension_all(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
int clixon_plugin_extension_one(clixon_plugin_t *cp, clixon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
int clixon_plugin_extension_all(clixon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
|
||||
int clixon_plugin_datastore_upgrade_one(clixon_plugin_t *cp, clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
int clixon_plugin_datastore_upgrade_all(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
int clixon_plugin_datastore_upgrade_one(clixon_plugin_t *cp, clixon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
int clixon_plugin_datastore_upgrade_all(clixon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
int clixon_plugin_yang_mount_one(clixon_plugin_t *cp, clicon_handle h, cxobj *xt, int *config, validate_level *vl, cxobj **yanglib);
|
||||
int clixon_plugin_yang_mount_all(clicon_handle h, cxobj *xt, int *config, validate_level *vl, cxobj **yanglib);
|
||||
int clixon_plugin_yang_mount_one(clixon_plugin_t *cp, clixon_handle h, cxobj *xt, int *config, validate_level *vl, cxobj **yanglib);
|
||||
int clixon_plugin_yang_mount_all(clixon_handle h, cxobj *xt, int *config, validate_level *vl, cxobj **yanglib);
|
||||
|
||||
int clixon_plugin_yang_patch_one(clixon_plugin_t *cp, clicon_handle h, yang_stmt *ymod);
|
||||
int clixon_plugin_yang_patch_all(clicon_handle h, yang_stmt *ymod);
|
||||
int clixon_plugin_yang_patch_one(clixon_plugin_t *cp, clixon_handle h, yang_stmt *ymod);
|
||||
int clixon_plugin_yang_patch_all(clixon_handle h, yang_stmt *ymod);
|
||||
|
||||
int clixon_plugin_netconf_errmsg_one(clixon_plugin_t *cp, clicon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_plugin_netconf_errmsg_all(clicon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_plugin_netconf_errmsg_one(clixon_plugin_t *cp, clixon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_plugin_netconf_errmsg_all(clixon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
|
||||
int clixon_plugin_version_one(clixon_plugin_t *cp, clicon_handle h, FILE *f);
|
||||
int clixon_plugin_version_all(clicon_handle h, FILE *f);
|
||||
int clixon_plugin_version_one(clixon_plugin_t *cp, clixon_handle h, FILE *f);
|
||||
int clixon_plugin_version_all(clixon_handle h, FILE *f);
|
||||
|
||||
/* rpc callback API */
|
||||
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, const char *ns, const char *name);
|
||||
int rpc_callback_call(clicon_handle h, cxobj *xe, void *arg, int *nrp, cbuf *cbret);
|
||||
int rpc_callback_register(clixon_handle h, clicon_rpc_cb cb, void *arg, const char *ns, const char *name);
|
||||
int rpc_callback_call(clixon_handle h, cxobj *xe, void *arg, int *nrp, cbuf *cbret);
|
||||
|
||||
/* action callback API */
|
||||
int action_callback_register(clicon_handle h, yang_stmt *ya, clicon_rpc_cb cb, void *arg);
|
||||
int action_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg, void *regarg);
|
||||
int action_callback_register(clixon_handle h, yang_stmt *ya, clicon_rpc_cb cb, void *arg);
|
||||
int action_callback_call(clixon_handle h, cxobj *xe, cbuf *cbret, void *arg, void *regarg);
|
||||
|
||||
/* upgrade callback API */
|
||||
int upgrade_callback_reg_fn(clicon_handle h, clicon_upgrade_cb cb, const char *strfn, const char *ns, void *arg);
|
||||
int upgrade_callback_call(clicon_handle h, cxobj *xt, char *ns, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret);
|
||||
int upgrade_callback_reg_fn(clixon_handle h, clicon_upgrade_cb cb, const char *strfn, const char *ns, void *arg);
|
||||
int upgrade_callback_call(clixon_handle h, cxobj *xt, char *ns, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret);
|
||||
|
||||
const int clixon_auth_type_str2int(char *auth_type);
|
||||
const char *clixon_auth_type_int2str(clixon_auth_type_t auth_type);
|
||||
int clixon_plugin_module_init(clicon_handle h);
|
||||
int clixon_plugin_module_exit(clicon_handle h);
|
||||
int clixon_plugin_module_init(clixon_handle h);
|
||||
int clixon_plugin_module_exit(clixon_handle h);
|
||||
|
||||
#endif /* _CLIXON_PLUGIN_H_ */
|
||||
|
|
|
|||
|
|
@ -58,23 +58,23 @@ typedef enum proc_operation {
|
|||
* @param[in] pe Process entry
|
||||
* @param[in,out] op Process operation
|
||||
*/
|
||||
typedef int (proc_cb_t)(clicon_handle h,
|
||||
typedef int (proc_cb_t)(clixon_handle h,
|
||||
process_entry_t *pe,
|
||||
proc_operation *operation);
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clixon_proc_socket(char **argv, int sock_flags, pid_t *pid, int *sock);
|
||||
int clixon_proc_socket(clixon_handle h, char **argv, int sock_flags, pid_t *pid, int *sock);
|
||||
int clixon_proc_socket_close(pid_t pid, int sock);
|
||||
int clixon_process_pid(clicon_handle h, const char *name, pid_t *pid);
|
||||
int clixon_process_pid(clixon_handle h, const char *name, pid_t *pid);
|
||||
proc_operation clixon_process_op_str2int(char *opstr);
|
||||
int clixon_process_argv_get(clicon_handle h, const char *name, char ***argv, int *argc);
|
||||
int clixon_process_register(clicon_handle h, const char *name, const char *descr, const char *netns, uid_t uid, gid_t gid, int fdkeep, proc_cb_t *callback, char **argv, int argc);
|
||||
int clixon_process_delete_all(clicon_handle h);
|
||||
int clixon_process_operation(clicon_handle h, const char *name, proc_operation op, const int wrapit);
|
||||
int clixon_process_status(clicon_handle h, const char *name, cbuf *cbret);
|
||||
int clixon_process_start_all(clicon_handle h);
|
||||
int clixon_process_waitpid(clicon_handle h);
|
||||
int clixon_process_argv_get(clixon_handle h, const char *name, char ***argv, int *argc);
|
||||
int clixon_process_register(clixon_handle h, const char *name, const char *descr, const char *netns, uid_t uid, gid_t gid, int fdkeep, proc_cb_t *callback, char **argv, int argc);
|
||||
int clixon_process_delete_all(clixon_handle h);
|
||||
int clixon_process_operation(clixon_handle h, const char *name, proc_operation op, const int wrapit);
|
||||
int clixon_process_status(clixon_handle h, const char *name, cbuf *cbret);
|
||||
int clixon_process_start_all(clixon_handle h);
|
||||
int clixon_process_waitpid(clixon_handle h);
|
||||
|
||||
#endif /* _CLIXON_PROC_H_ */
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ enum format_enum format_str2int(char *str);
|
|||
struct clicon_msg *clicon_msg_encode(uint32_t id, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int clicon_msg_decode(struct clicon_msg *msg, yang_stmt *yspec, uint32_t *id, cxobj **xml, cxobj **xerr);
|
||||
|
||||
int clicon_connect_unix(clicon_handle h, char *sockpath);
|
||||
int clicon_connect_unix(clixon_handle h, char *sockpath);
|
||||
|
||||
|
||||
int clicon_rpc_connect_unix(clicon_handle h,
|
||||
int clicon_rpc_connect_unix(clixon_handle h,
|
||||
char *sockpath,
|
||||
int *sock0);
|
||||
|
||||
int clicon_rpc_connect_inet(clicon_handle h,
|
||||
int clicon_rpc_connect_inet(clixon_handle h,
|
||||
char *dst,
|
||||
uint16_t port,
|
||||
int *sock0);
|
||||
|
|
@ -84,7 +84,7 @@ int clicon_msg_rcv(int s, const char *descr, int intr, struct clicon_msg **msg,
|
|||
|
||||
int clicon_msg_rcv1(int s, const char *descr, cbuf *cb, int *eof);
|
||||
|
||||
int send_msg_notify_xml(clicon_handle h, int s, const char *descr, cxobj *xev);
|
||||
int send_msg_notify_xml(clixon_handle h, int s, const char *descr, cxobj *xev);
|
||||
|
||||
int send_msg_reply(int s, const char *descr, char *data, uint32_t datalen);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,34 +42,34 @@
|
|||
#ifndef _CLIXON_PROTO_CLIENT_H_
|
||||
#define _CLIXON_PROTO_CLIENT_H_
|
||||
|
||||
int clicon_rpc_connect(clicon_handle h, int *sock0);
|
||||
int clicon_rpc_msg(clicon_handle h, struct clicon_msg *msg, cxobj **xret0);
|
||||
int clicon_rpc_msg_persistent(clicon_handle h, struct clicon_msg *msg, cxobj **xret0, int *sock0);
|
||||
int clicon_rpc_netconf(clicon_handle h, char *xmlst, cxobj **xret, int *sp);
|
||||
int clicon_rpc_netconf_xml(clicon_handle h, cxobj *xml, cxobj **xret, int *sp);
|
||||
int clicon_rpc_get_config(clicon_handle h, char *username, char *db, char *xpath, cvec *nsc, char *defaults, cxobj **xret);
|
||||
int clicon_rpc_edit_config(clicon_handle h, char *db, enum operation_type op,
|
||||
int clicon_rpc_connect(clixon_handle h, int *sock0);
|
||||
int clicon_rpc_msg(clixon_handle h, struct clicon_msg *msg, cxobj **xret0);
|
||||
int clicon_rpc_msg_persistent(clixon_handle h, struct clicon_msg *msg, cxobj **xret0, int *sock0);
|
||||
int clicon_rpc_netconf(clixon_handle h, char *xmlst, cxobj **xret, int *sp);
|
||||
int clicon_rpc_netconf_xml(clixon_handle h, cxobj *xml, cxobj **xret, int *sp);
|
||||
int clicon_rpc_get_config(clixon_handle h, char *username, char *db, char *xpath, cvec *nsc, char *defaults, cxobj **xret);
|
||||
int clicon_rpc_edit_config(clixon_handle h, char *db, enum operation_type op,
|
||||
char *xml);
|
||||
int clicon_rpc_copy_config(clicon_handle h, char *db1, char *db2);
|
||||
int clicon_rpc_delete_config(clicon_handle h, char *db);
|
||||
int clicon_rpc_lock(clicon_handle h, char *db);
|
||||
int clicon_rpc_unlock(clicon_handle h, char *db);
|
||||
int clicon_rpc_get2(clicon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, char *defaults, int bind, cxobj **xret);
|
||||
int clicon_rpc_get(clicon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, char *defaults, cxobj **xret);
|
||||
int clicon_rpc_get_pageable_list(clicon_handle h, char *datastore, char *xpath,
|
||||
int clicon_rpc_copy_config(clixon_handle h, char *db1, char *db2);
|
||||
int clicon_rpc_delete_config(clixon_handle h, char *db);
|
||||
int clicon_rpc_lock(clixon_handle h, char *db);
|
||||
int clicon_rpc_unlock(clixon_handle h, char *db);
|
||||
int clicon_rpc_get2(clixon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, char *defaults, int bind, cxobj **xret);
|
||||
int clicon_rpc_get(clixon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, char *defaults, cxobj **xret);
|
||||
int clicon_rpc_get_pageable_list(clixon_handle h, char *datastore, char *xpath,
|
||||
cvec *nsc, netconf_content content, int32_t depth, char *defaults,
|
||||
uint32_t offset, uint32_t limit,
|
||||
char *direction, char *sort, char *where,
|
||||
cxobj **xt);
|
||||
int clicon_rpc_close_session(clicon_handle h);
|
||||
int clicon_rpc_kill_session(clicon_handle h, uint32_t session_id);
|
||||
int clicon_rpc_validate(clicon_handle h, char *db);
|
||||
int clicon_rpc_commit(clicon_handle h, int confirmed, int cancel, uint32_t timeout, char *persist, char *persist_id);
|
||||
int clicon_rpc_discard_changes(clicon_handle h);
|
||||
int clicon_rpc_create_subscription(clicon_handle h, char *stream, char *filter, int *s);
|
||||
int clicon_rpc_debug(clicon_handle h, int level);
|
||||
int clicon_rpc_restconf_debug(clicon_handle h, int level);
|
||||
int clicon_hello_req(clicon_handle h, char *transport, char *source_host, uint32_t *id);
|
||||
int clicon_rpc_restart_plugin(clicon_handle h, char *plugin);
|
||||
int clicon_rpc_close_session(clixon_handle h);
|
||||
int clicon_rpc_kill_session(clixon_handle h, uint32_t session_id);
|
||||
int clicon_rpc_validate(clixon_handle h, char *db);
|
||||
int clicon_rpc_commit(clixon_handle h, int confirmed, int cancel, uint32_t timeout, char *persist, char *persist_id);
|
||||
int clicon_rpc_discard_changes(clixon_handle h);
|
||||
int clicon_rpc_create_subscription(clixon_handle h, char *stream, char *filter, int *s);
|
||||
int clicon_rpc_debug(clixon_handle h, int level);
|
||||
int clicon_rpc_restconf_debug(clixon_handle h, int level);
|
||||
int clicon_hello_req(clixon_handle h, char *transport, char *source_host, uint32_t *id);
|
||||
int clicon_rpc_restart_plugin(clixon_handle h, char *plugin);
|
||||
|
||||
#endif /* _CLIXON_PROTO_CLIENT_H_ */
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
* Prototypes
|
||||
*/
|
||||
int regexp_xsd2posix(char *xsd, char **posix);
|
||||
int regex_compile(clicon_handle h, char *regexp, void **recomp);
|
||||
int regex_exec(clicon_handle h, void *recomp, char *string);
|
||||
int regex_free(clicon_handle h, void *recomp);
|
||||
int regex_compile(clixon_handle h, char *regexp, void **recomp);
|
||||
int regex_exec(clixon_handle h, void *recomp, char *string);
|
||||
int regex_free(clixon_handle h, void *recomp);
|
||||
|
||||
#endif /* _CLIXON_REGEX_H_ */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
* @param[in] arg Extra argument provided in stream_ss_add
|
||||
* @see stream_ss_add
|
||||
*/
|
||||
typedef int (*stream_fn_t)(clicon_handle h, int op, cxobj *event, void *arg);
|
||||
typedef int (*stream_fn_t)(clixon_handle h, int op, cxobj *event, void *arg);
|
||||
|
||||
struct stream_subscription{
|
||||
qelem_t ss_q; /* queue header */
|
||||
|
|
@ -89,30 +89,30 @@ typedef struct event_stream event_stream_t;
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
event_stream_t *stream_find(clicon_handle h, const char *name);
|
||||
int stream_add(clicon_handle h, const char *name, const char *description, int replay_enabled, struct timeval *retention);
|
||||
int stream_delete_all(clicon_handle h, int force);
|
||||
int stream_get_xml(clicon_handle h, int access, cbuf *cb);
|
||||
event_stream_t *stream_find(clixon_handle h, const char *name);
|
||||
int stream_add(clixon_handle h, const char *name, const char *description, int replay_enabled, struct timeval *retention);
|
||||
int stream_delete_all(clixon_handle h, int force);
|
||||
int stream_get_xml(clixon_handle h, int access, cbuf *cb);
|
||||
int stream_timer_setup(int fd, void *arg);
|
||||
/* Subscriptions */
|
||||
struct stream_subscription *stream_ss_add(clicon_handle h, char *stream,
|
||||
struct stream_subscription *stream_ss_add(clixon_handle h, char *stream,
|
||||
char *xpath, struct timeval *start, struct timeval *stop,
|
||||
stream_fn_t fn, void *arg);
|
||||
int stream_ss_rm(clicon_handle h, event_stream_t *es, struct stream_subscription *ss, int force);
|
||||
int stream_ss_rm(clixon_handle h, event_stream_t *es, struct stream_subscription *ss, int force);
|
||||
struct stream_subscription *stream_ss_find(event_stream_t *es,
|
||||
stream_fn_t fn, void *arg);
|
||||
int stream_ss_delete_all(clicon_handle h, stream_fn_t fn, void *arg);
|
||||
int stream_ss_delete(clicon_handle h, char *name, stream_fn_t fn, void *arg);
|
||||
int stream_ss_delete_all(clixon_handle h, stream_fn_t fn, void *arg);
|
||||
int stream_ss_delete(clixon_handle h, char *name, stream_fn_t fn, void *arg);
|
||||
|
||||
int stream_notify_xml(clicon_handle h, char *stream, cxobj *xml);
|
||||
int stream_notify(clicon_handle h, char *stream, const char *event, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
int stream_notify_xml(clixon_handle h, char *stream, cxobj *xml);
|
||||
int stream_notify(clixon_handle h, char *stream, const char *event, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
/* Replay */
|
||||
int stream_replay_add(event_stream_t *es, struct timeval *tv, cxobj *xv);
|
||||
int stream_replay_trigger(clicon_handle h, char *stream, stream_fn_t fn, void *arg);
|
||||
int stream_replay_trigger(clixon_handle h, char *stream, stream_fn_t fn, void *arg);
|
||||
|
||||
/* Experimental publish streams using SSE. CLIXON_PUBLISH_STREAMS should be set */
|
||||
int stream_publish(clicon_handle h, char *stream);
|
||||
int stream_publish(clixon_handle h, char *stream);
|
||||
int stream_publish_init();
|
||||
int stream_publish_exit();
|
||||
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_yang_validate_rpc(clicon_handle h, cxobj *xrpc, int expanddefault, cxobj **xret);
|
||||
int xml_yang_validate_rpc_reply(clicon_handle h, cxobj *xrpc, cxobj **xret);
|
||||
int xml_yang_validate_add(clicon_handle h, cxobj *xt, cxobj **xret);
|
||||
int xml_yang_validate_rpc(clixon_handle h, cxobj *xrpc, int expanddefault, cxobj **xret);
|
||||
int xml_yang_validate_rpc_reply(clixon_handle h, cxobj *xrpc, cxobj **xret);
|
||||
int xml_yang_validate_add(clixon_handle h, cxobj *xt, cxobj **xret);
|
||||
int xml_yang_validate_list_key_only(cxobj *xt, cxobj **xret);
|
||||
int xml_yang_validate_all(clicon_handle h, cxobj *xt, cxobj **xret);
|
||||
int xml_yang_validate_all_top(clicon_handle h, cxobj *xt, cxobj **xret);
|
||||
int rpc_reply_check(clicon_handle h, char *rpcname, cbuf *cbret);
|
||||
int xml_yang_validate_all(clixon_handle h, cxobj *xt, cxobj **xret);
|
||||
int xml_yang_validate_all_top(clixon_handle h, cxobj *xt, cxobj **xret);
|
||||
int rpc_reply_check(clixon_handle h, char *rpcname, cbuf *cbret);
|
||||
|
||||
#endif /* _CLIXON_VALIDATE_H_ */
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
* Canonical XML version (just for info)
|
||||
* https://www.w3.org/TR/xml-c14n
|
||||
*/
|
||||
|
||||
#ifndef _CLIXON_XML_H
|
||||
#define _CLIXON_XML_H
|
||||
|
||||
|
|
@ -306,12 +307,11 @@ int xml_operation(char *opstr, enum operation_type *op);
|
|||
char *xml_operation2str(enum operation_type op);
|
||||
int xml_attr_insert2val(char *instr, enum insert_type *ins);
|
||||
cxobj *xml_add_attr(cxobj *xn, char *name, char *value, char *prefix, char *ns);
|
||||
int clicon_log_xml(int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
int clixon_log_xml(clixon_handle h, int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
int clixon_debug_xml(int dbglevel, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
#ifdef XML_EXPLICIT_INDEX
|
||||
int xml_search_index_p(cxobj *x);
|
||||
|
||||
int xml_search_vector_get(cxobj *x, char *name, clixon_xvec **xvec);
|
||||
int xml_search_child_insert(cxobj *xp, cxobj *x);
|
||||
int xml_search_child_rm(cxobj *xp, cxobj *x);
|
||||
|
|
@ -319,9 +319,4 @@ cxobj *xml_child_index_each(cxobj *xparent, char *name, cxobj *xprev, enum cx
|
|||
|
||||
#endif
|
||||
|
||||
/* 6.4 backward compatability */
|
||||
#if 1
|
||||
#define clicon_debug_xml clixon_debug_xml
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_XML_H */
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@
|
|||
*/
|
||||
int xml_bind_yang_unknown_anydata(int val);
|
||||
int xml_bind_netconf_message_id_optional(int val);
|
||||
int xml_bind_yang_rpc(clicon_handle h, cxobj *xrpc, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang_rpc_reply(clicon_handle h, cxobj *xrpc, char *name, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang0(clicon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang(clicon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang_rpc(clixon_handle h, cxobj *xrpc, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang_rpc_reply(clixon_handle h, cxobj *xrpc, char *name, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang0(clixon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_yang(clixon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||
int xml_bind_special(cxobj *xd, yang_stmt *yspec, char *schema_nodeid);
|
||||
|
||||
#endif /* _CLIXON_XML_BIND_H_ */
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_changelog_upgrade(clicon_handle h, cxobj *xn, char *ns, uint16_t op, uint32_t from, uint32_t to, void *arg, cbuf *cbret);
|
||||
int clixon_xml_changelog_init(clicon_handle h);
|
||||
int xml_namespace_vec(clicon_handle h, cxobj *xt, char *ns, cxobj ***vec, size_t *veclen);
|
||||
int xml_changelog_upgrade(clixon_handle h, cxobj *xn, char *ns, uint16_t op, uint32_t from, uint32_t to, void *arg, cbuf *cbret);
|
||||
int clixon_xml_changelog_init(clixon_handle h);
|
||||
int xml_namespace_vec(clixon_handle h, cxobj *xt, char *ns, cxobj ***vec, size_t *veclen);
|
||||
|
||||
#endif /* _CLIXON_XML_CHANGELOG_H */
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef enum yang_class yang_class;
|
|||
* Prototypes
|
||||
*/
|
||||
int xml_default_recurse(cxobj *xn, int state);
|
||||
int xml_global_defaults(clicon_handle h, cxobj *xn, cvec *nsc, const char *xpath, yang_stmt *yspec, int state);
|
||||
int xml_global_defaults(clixon_handle h, cxobj *xn, cvec *nsc, const char *xpath, yang_stmt *yspec, int state);
|
||||
int xml_defaults_nopresence(cxobj *xn, int purge);
|
||||
int xml_add_default_tag(cxobj *x, uint16_t flags);
|
||||
int xml_flag_state_default_value(cxobj *x, uint16_t flag);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_nsctx_namespace_netconf_default(clicon_handle h);
|
||||
int xml_nsctx_namespace_netconf_default(clixon_handle h);
|
||||
cvec *xml_nsctx_init(char *prefix, char *ns);
|
||||
int xml_nsctx_free(cvec *nsc);
|
||||
char *xml_nsctx_get(cvec *nsc, char *prefix);
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ int yang_abs_schema_nodeid(yang_stmt *ys, char *schema_nodeid, yang_stmt
|
|||
int yang_desc_schema_nodeid(yang_stmt *yn, char *schema_nodeid, yang_stmt **yres);
|
||||
int yang_config(yang_stmt *ys);
|
||||
int yang_config_ancestor(yang_stmt *ys);
|
||||
int yang_features(clicon_handle h, yang_stmt *yt);
|
||||
int yang_features(clixon_handle h, yang_stmt *yt);
|
||||
cvec *yang_arg2cvec(yang_stmt *ys, char *delimi);
|
||||
int yang_key_match(yang_stmt *yn, char *name, int *lastkey);
|
||||
int yang_type_cache_regexp_set(yang_stmt *ytype, int rxmode, cvec *regexps);
|
||||
|
|
@ -322,10 +322,10 @@ int yang_type_cache_set(yang_stmt *ys, yang_stmt *resolved, int options,
|
|||
yang_stmt *yang_anydata_add(yang_stmt *yp, char *name);
|
||||
int yang_extension_value(yang_stmt *ys, char *name, char *ns, int *exist, char **value);
|
||||
int yang_sort_subelements(yang_stmt *ys);
|
||||
int yang_init(clicon_handle h);
|
||||
int yang_init(clixon_handle h);
|
||||
int yang_single_child_type(yang_stmt *ys, enum rfc_6020 subkeyw);
|
||||
void *yang_action_cb_get(yang_stmt *ys);
|
||||
int yang_action_cb_add(yang_stmt *ys, void *rc);
|
||||
int ys_populate_feature(clicon_handle h, yang_stmt *ys);
|
||||
int ys_populate_feature(clixon_handle h, yang_stmt *ys);
|
||||
|
||||
#endif /* _CLIXON_YANG_H_ */
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@ typedef struct {
|
|||
modstate_diff_t * modstate_diff_new(void);
|
||||
int modstate_diff_free(modstate_diff_t *);
|
||||
|
||||
int yang_modules_init(clicon_handle h);
|
||||
char *yang_modules_revision(clicon_handle h);
|
||||
int yang_modules_state_build(clicon_handle h, yang_stmt *yspec, char *msid, int brief, cbuf *cb);
|
||||
int yang_modules_state_get(clicon_handle h, yang_stmt *yspec, char *xpath,
|
||||
int yang_modules_init(clixon_handle h);
|
||||
char *yang_modules_revision(clixon_handle h);
|
||||
int yang_modules_state_build(clixon_handle h, yang_stmt *yspec, char *msid, int brief, cbuf *cb);
|
||||
int yang_modules_state_get(clixon_handle h, yang_stmt *yspec, char *xpath,
|
||||
cvec *nsc, int brief, cxobj **xret);
|
||||
int clixon_module_upgrade(clicon_handle h, cxobj *xt, modstate_diff_t *msd, cbuf *cb);
|
||||
int clixon_module_upgrade(clixon_handle h, cxobj *xt, modstate_diff_t *msd, cbuf *cb);
|
||||
yang_stmt *yang_find_module_by_prefix(yang_stmt *ys, char *prefix);
|
||||
yang_stmt *yang_find_module_by_prefix_yspec(yang_stmt *yspec, char *prefix);
|
||||
yang_stmt *yang_find_module_by_namespace(yang_stmt *yspec, char *ns);
|
||||
|
|
@ -78,7 +78,7 @@ yang_stmt *yang_find_module_by_namespace_revision(yang_stmt *yspec, const char *
|
|||
yang_stmt *yang_find_module_by_name_revision(yang_stmt *yspec, const char *name, const char *revision);
|
||||
yang_stmt *yang_find_module_by_name(yang_stmt *yspec, char *name);
|
||||
int yang_metadata_annotation_check(cxobj *x, yang_stmt *ymod, int *ismeta);
|
||||
int yang_metadata_init(clicon_handle h);
|
||||
int yang_lib2yspec(clicon_handle h, cxobj *yanglib,yang_stmt *yspec);
|
||||
int yang_metadata_init(clixon_handle h);
|
||||
int yang_lib2yspec(clixon_handle h, cxobj *yanglib,yang_stmt *yspec);
|
||||
|
||||
#endif /* _CLIXON_YANG_MODULE_H_ */
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@
|
|||
*/
|
||||
int ys_grouping_resolve(yang_stmt *yuses, char *prefix, char *name, yang_stmt **ygrouping0);
|
||||
yang_stmt *yang_parse_file(FILE *fp, const char *name, yang_stmt *ysp);
|
||||
int yang_file_find_match(clicon_handle h, const char *module, const char *revision, cbuf *fbuf);
|
||||
yang_stmt *yang_parse_filename(clicon_handle h, const char *filename, yang_stmt *ysp);
|
||||
yang_stmt *yang_parse_module(clicon_handle h, const char *module, const char *revision, yang_stmt *yspec, char *origname);
|
||||
int yang_parse_post(clicon_handle h, yang_stmt *yspec, int modmin);
|
||||
int yang_spec_parse_module(clicon_handle h, const char *module,
|
||||
int yang_file_find_match(clixon_handle h, const char *module, const char *revision, cbuf *fbuf);
|
||||
yang_stmt *yang_parse_filename(clixon_handle h, const char *filename, yang_stmt *ysp);
|
||||
yang_stmt *yang_parse_module(clixon_handle h, const char *module, const char *revision, yang_stmt *yspec, char *origname);
|
||||
int yang_parse_post(clixon_handle h, yang_stmt *yspec, int modmin);
|
||||
int yang_spec_parse_module(clixon_handle h, const char *module,
|
||||
const char *revision, yang_stmt *yspec);
|
||||
yang_stmt *yang_parse_str(char *str, const char *name, yang_stmt *yspec);
|
||||
int yang_spec_parse_file(clicon_handle h, char *filename, yang_stmt *yspec);
|
||||
int yang_spec_load_dir(clicon_handle h, char *dir, yang_stmt *yspec);
|
||||
int yang_spec_parse_file(clixon_handle h, char *filename, yang_stmt *yspec);
|
||||
int yang_spec_load_dir(clixon_handle h, char *dir, yang_stmt *yspec);
|
||||
int ys_parse_date_arg(char *datearg, uint32_t *dateint);
|
||||
cg_var *ys_parse(yang_stmt *ys, enum cv_type cvtype);
|
||||
int ys_parse_sub(yang_stmt *ys, const char *filename, char *extra);
|
||||
|
|
|
|||
|
|
@ -58,13 +58,13 @@ int yang_schema_mount_point0(yang_stmt *y);
|
|||
int yang_schema_mount_point(yang_stmt *y);
|
||||
int yang_mount_get(yang_stmt *yu, char *xpath, yang_stmt **yspec);
|
||||
int yang_mount_set(yang_stmt *yu, char *xpath, yang_stmt *yspec);
|
||||
int xml_yang_mount_get(clicon_handle h, cxobj *x, validate_level *vl, yang_stmt **yspec);
|
||||
int xml_yang_mount_set(clicon_handle h, cxobj *x, yang_stmt *yspec);
|
||||
int xml_yang_mount_get(clixon_handle h, cxobj *x, validate_level *vl, yang_stmt **yspec);
|
||||
int xml_yang_mount_set(clixon_handle h, cxobj *x, yang_stmt *yspec);
|
||||
int yang_mount_get_yspec_any(yang_stmt *y, yang_stmt **yspec);
|
||||
int yang_mount_freeall(cvec *cvv);
|
||||
int yang_schema_mount_statedata(clicon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int yang_schema_mount_statistics(clicon_handle h, cxobj *xt, int modules, cbuf *cb);
|
||||
int yang_schema_yanglib_parse_mount(clicon_handle h, cxobj *xt);
|
||||
int yang_schema_get_child(clicon_handle h, cxobj *x1, cxobj *x1c, yang_stmt **yc);
|
||||
int yang_schema_mount_statedata(clixon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int yang_schema_mount_statistics(clixon_handle h, cxobj *xt, int modules, cbuf *cb);
|
||||
int yang_schema_yanglib_parse_mount(clixon_handle h, cxobj *xt);
|
||||
int yang_schema_get_child(clixon_handle h, cxobj *x1, cxobj *x1c, yang_stmt **yc);
|
||||
|
||||
#endif /* _CLIXON_YANG_SCHEMA_MOUNT_H_ */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ int yang2cv_type(char *ytype, enum cv_type *cv_type);
|
|||
char *cv2yang_type(enum cv_type cv_type);
|
||||
yang_stmt *yang_find_identity(yang_stmt *ys, char *identity);
|
||||
yang_stmt *yang_find_identity_nsc(yang_stmt *yspec, char *identity, cvec *nsc);
|
||||
int ys_cv_validate(clicon_handle h, cg_var *cv, yang_stmt *ys, yang_stmt **ysub, char **reason);
|
||||
int ys_cv_validate(clixon_handle h, cg_var *cv, yang_stmt *ys, yang_stmt **ysub, char **reason);
|
||||
int clicon_type2cv(char *type, char *rtype, yang_stmt *ys, enum cv_type *cvtype);
|
||||
int yang_type_get(yang_stmt *ys, char **otype, yang_stmt **restype,
|
||||
int *options, cvec **cvv,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue