Changed code so that it will be compatible with c++.
1. Added #ifdef extern "C" to public header files. 2. Changed variables that are key words in c++, to different names (like ns instead of namespace). 3. Changed char* to const char* for constant strings.
This commit is contained in:
parent
eda4a58ebf
commit
58ea4eba27
27 changed files with 274 additions and 119 deletions
|
|
@ -41,6 +41,11 @@
|
|||
* file in clicon lib-routines.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This include file requires the following include file dependencies */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
|
@ -105,3 +110,8 @@
|
|||
*/
|
||||
extern const char CLIXON_BUILDSTR[];
|
||||
extern const char CLIXON_VERSION[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ int netconf_bad_element(cbuf *cb, char *type, char *info, char *element);
|
|||
int netconf_bad_element_xml(cxobj **xret, char *type, char *info, char *element);
|
||||
int netconf_unknown_element(cbuf *cb, char *type, char *element, char *message);
|
||||
int netconf_unknown_element_xml(cxobj **xret, char *type, char *element, char *message);
|
||||
int netconf_unknown_namespace(cbuf *cb, char *type, char *namespace, char *message);
|
||||
int netconf_unknown_namespace_xml(cxobj **xret, char *type, char *namespace, char *message);
|
||||
int netconf_unknown_namespace(cbuf *cb, char *type, char *ns, char *message);
|
||||
int netconf_unknown_namespace_xml(cxobj **xret, char *type, char *ns, char *message);
|
||||
int netconf_access_denied(cbuf *cb, char *type, char *message);
|
||||
int netconf_access_denied_xml(cxobj **xret, char *type, char *message);
|
||||
int netconf_lock_denied(cbuf *cb, char *info, char *message);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ typedef int (*clicon_rpc_cb)(
|
|||
/*! Registered Upgrade callback function
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xn XML tree to be updated
|
||||
* @param[in] namespace Namespace of module
|
||||
* @param[in] ns Namespace of module
|
||||
* @param[in] op One of XML_FLAG_ADD, _DEL, _CHANGE
|
||||
* @param[in] from From revision on the form YYYYMMDD (if DEL or CHANGE)
|
||||
* @param[in] to To revision on the form YYYYMMDD (if ADD or CHANGE)
|
||||
|
|
@ -84,7 +84,7 @@ typedef int (*clicon_rpc_cb)(
|
|||
typedef int (*clicon_upgrade_cb)(
|
||||
clicon_handle h,
|
||||
cxobj *xn,
|
||||
char *namespace,
|
||||
char *ns,
|
||||
uint16_t op,
|
||||
uint32_t from,
|
||||
uint32_t to,
|
||||
|
|
@ -255,7 +255,7 @@ struct clixon_plugin_api{
|
|||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define upgrade_callback_register(h, cb, namespace, arg) upgrade_callback_reg_fn((h), (cb), #cb, (namespace), (arg))
|
||||
#define upgrade_callback_register(h, cb, ns, arg) upgrade_callback_reg_fn((h), (cb), #cb, (ns), (arg))
|
||||
|
||||
typedef struct clixon_plugin_api clixon_plugin_api;
|
||||
|
||||
|
|
@ -306,13 +306,13 @@ int clixon_plugin_datastore_upgrade_one(clixon_plugin *cp, clicon_handle h, char
|
|||
int clixon_plugin_datastore_upgrade_all(clicon_handle h, char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
/* rpc callback API */
|
||||
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, char *namespace, char *name);
|
||||
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, char *ns, char *name);
|
||||
int rpc_callback_delete_all(clicon_handle h);
|
||||
int rpc_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg);
|
||||
|
||||
/* upgrade callback API */
|
||||
int upgrade_callback_reg_fn(clicon_handle h, clicon_upgrade_cb cb, const char *strfn, char *namespace, void *arg);
|
||||
int upgrade_callback_reg_fn(clicon_handle h, clicon_upgrade_cb cb, const char *strfn, char *ns, void *arg);
|
||||
int upgrade_callback_delete_all(clicon_handle h);
|
||||
int upgrade_callback_call(clicon_handle h, cxobj *xt, char *namespace, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret);
|
||||
int upgrade_callback_call(clicon_handle h, cxobj *xt, char *ns, uint16_t op, uint32_t from, uint32_t to, cbuf *cbret);
|
||||
|
||||
#endif /* _CLIXON_PLUGIN_H_ */
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static inline char * strdup4(char *str)
|
|||
char *dup;
|
||||
int len;
|
||||
len = align4(strlen(str)+1);
|
||||
if ((dup = malloc(len)) == NULL)
|
||||
if ((dup = (char*) malloc(len)) == NULL)
|
||||
return NULL;
|
||||
strncpy(dup, str, len);
|
||||
return dup;
|
||||
|
|
|
|||
|
|
@ -160,13 +160,13 @@ int xml_name_set(cxobj *xn, char *name);
|
|||
char *xml_prefix(cxobj *xn);
|
||||
int xml_prefix_set(cxobj *xn, char *name);
|
||||
char *nscache_get(cxobj *x, char *prefix);
|
||||
int nscache_get_prefix(cxobj *x, char *namespace, char **prefix);
|
||||
int nscache_get_prefix(cxobj *x, char *ns, char **prefix);
|
||||
cvec *nscache_get_all(cxobj *x);
|
||||
int nscache_set(cxobj *x, char *prefix, char *namespace);
|
||||
int nscache_set(cxobj *x, char *prefix, char *ns);
|
||||
int nscache_clear(cxobj *x);
|
||||
int nscache_replace(cxobj *x, cvec *ns);
|
||||
|
||||
int xmlns_set(cxobj *x, char *prefix, char *namespace);
|
||||
int xmlns_set(cxobj *x, char *prefix, char *ns);
|
||||
cxobj *xml_parent(cxobj *xn);
|
||||
int xml_parent_set(cxobj *xn, cxobj *parent);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_changelog_upgrade(clicon_handle h, cxobj *xn, char *namespace, uint16_t op, uint32_t from, uint32_t to, void *arg, cbuf *cbret);
|
||||
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 *namespace, cxobj ***vec, size_t *veclen);
|
||||
int xml_namespace_vec(clicon_handle h, cxobj *xt, char *ns, cxobj ***vec, size_t *veclen);
|
||||
|
||||
#endif /* _CLIXON_XML_CHANGELOG_H */
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ int xml_diff(yang_stmt *yspec, cxobj *x0, cxobj *x1,
|
|||
cxobj ***changed_x0, cxobj ***changed_x1, int *changedlen);
|
||||
int xml_tree_prune_flagged_sub(cxobj *xt, int flag, int test, int *upmark);
|
||||
int xml_tree_prune_flagged(cxobj *xt, int flag, int test);
|
||||
int xml_namespace_change(cxobj *x, char *namespace, char *prefix);
|
||||
int xml_namespace_change(cxobj *x, char *ns, char *prefix);
|
||||
int xml_default(cxobj *x);
|
||||
int xml_default_recurse(cxobj *xn);
|
||||
int xml_sanity(cxobj *x, void *arg);
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
cvec *xml_nsctx_init(char *prefix, char *namespace);
|
||||
cvec *xml_nsctx_init(char *prefix, char *ns);
|
||||
int xml_nsctx_free(cvec *nsc);
|
||||
char *xml_nsctx_get(cvec *nsc, char *prefix);
|
||||
int xml_nsctx_get_prefix(cvec *cvv, char *namespace, char **prefix);
|
||||
int xml_nsctx_add(cvec *nsc, char *prefix, char *namespace);
|
||||
int xml_nsctx_add(cvec *nsc, char *prefix, char *ns);
|
||||
int xml_nsctx_node(cxobj *x, cvec **ncp);
|
||||
int xml_nsctx_yang(yang_stmt *yn, cvec **ncp);
|
||||
int xml_nsctx_yangspec(yang_stmt *yspec, cvec **ncp);
|
||||
|
||||
int xml2ns(cxobj *x, char *localname, char **namespace);
|
||||
int xml2ns(cxobj *x, char *localname, char **ns);
|
||||
int xml2ns_recurse(cxobj *x);
|
||||
int xml2prefix(cxobj *xn, char *namespace, char **prefixp);
|
||||
int xml2prefix(cxobj *xn, char *ns, char **prefixp);
|
||||
|
||||
#endif /* _CLIXON_XML_NSCTX_H */
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int xml_cmp(cxobj *x1, cxobj *x2, int same, int skip1, char *explicit);
|
||||
int xml_cmp(cxobj *x1, cxobj *x2, int same, int skip1, char *expl);
|
||||
int xml_sort(cxobj *x0);
|
||||
int xml_sort_recurse(cxobj *xn);
|
||||
int xml_insert(cxobj *xp, cxobj *xc, enum insert_type ins, char *key_val, cvec *nsckey);
|
||||
|
|
@ -51,7 +51,7 @@ int xml_search_indexvar_binary_pos(cxobj *xp, char *indexvar, clixon_xvec *xvec,
|
|||
int low, int upper, int max, int *eq);
|
||||
#endif
|
||||
int match_base_child(cxobj *x0, cxobj *x1c, yang_stmt *yc, cxobj **x0cp);
|
||||
int clixon_xml_find_index(cxobj *xp, yang_stmt *yp, char *namespace, char *name,
|
||||
int clixon_xml_find_index(cxobj *xp, yang_stmt *yp, char *ns, char *name,
|
||||
cvec *cvk, clixon_xvec *xvec);
|
||||
int clixon_xml_find_pos(cxobj *xp, yang_stmt *yc, uint32_t pos, clixon_xvec *xvec);
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ yang_stmt *ys_prune(yang_stmt *yp, int i);
|
|||
|
||||
int ys_free(yang_stmt *ys);
|
||||
int yspec_free(yang_stmt *yspec);
|
||||
int ys_cp(yang_stmt *new, yang_stmt *old);
|
||||
int ys_cp(yang_stmt *nw, yang_stmt *old);
|
||||
yang_stmt *ys_dup(yang_stmt *old);
|
||||
int yn_insert(yang_stmt *ys_parent, yang_stmt *ys_child);
|
||||
yang_stmt *yn_each(yang_stmt *yn, yang_stmt *ys);
|
||||
|
|
@ -223,7 +223,7 @@ yang_stmt *yang_find_datanode(yang_stmt *yn, char *argument);
|
|||
yang_stmt *yang_find_schemanode(yang_stmt *yn, char *argument);
|
||||
char *yang_find_myprefix(yang_stmt *ys);
|
||||
char *yang_find_mynamespace(yang_stmt *ys);
|
||||
int yang_find_prefix_by_namespace(yang_stmt *ys, char *namespace, char **prefix);
|
||||
int yang_find_prefix_by_namespace(yang_stmt *ys, char *ns, char **prefix);
|
||||
yang_stmt *yang_myroot(yang_stmt *ys);
|
||||
yang_stmt *yang_choice(yang_stmt *y);
|
||||
int yang_order(yang_stmt *y);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ int yang_modules_state_get(clicon_handle h, yang_stmt *yspec, char *xpath,
|
|||
int clixon_module_upgrade(clicon_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 *namespace);
|
||||
yang_stmt *yang_find_module_by_namespace(yang_stmt *yspec, char *ns);
|
||||
yang_stmt *yang_find_module_by_name(yang_stmt *yspec, char *name);
|
||||
|
||||
#endif /* _CLIXON_YANG_MODULE_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue