[Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)
* Applies to all c/h/y/l/sh files and .editorconfig
This commit is contained in:
parent
a9d1ab006c
commit
d84c529ff1
376 changed files with 38147 additions and 38133 deletions
|
|
@ -52,8 +52,8 @@ int xmldb_disconnect(clicon_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,
|
||||
cvec *nsc, const char *xpath,
|
||||
int copy, cxobj **xtop, modstate_diff_t *msd, cxobj **xerr);
|
||||
cvec *nsc, const char *xpath,
|
||||
int copy, 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] */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ int clixon_event_reg_fd(int fd, int (*fn)(int, void*), void *arg, char *str);
|
|||
int clixon_event_unreg_fd(int s, int (*fn)(int, void*));
|
||||
|
||||
int clixon_event_reg_timeout(struct timeval t, int (*fn)(int, void*),
|
||||
void *arg, char *str);
|
||||
void *arg, char *str);
|
||||
|
||||
int clixon_event_unreg_timeout(int (*fn)(int, void*), void *arg);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
|
||||
int clicon_file_dirent(const char *dir, struct dirent **ent,
|
||||
const char *regexp, mode_t type);
|
||||
const char *regexp, mode_t type);
|
||||
|
||||
int clicon_files_recursive(const char *dir, const char *regexp, cvec *cvv);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
#define _CLIXON_HASH_H_
|
||||
|
||||
struct clicon_hash {
|
||||
qelem_t h_qelem;
|
||||
qelem_t h_qelem;
|
||||
char *h_key;
|
||||
size_t h_vlen;
|
||||
size_t h_vlen;
|
||||
void *h_val;
|
||||
};
|
||||
typedef struct clicon_hash *clicon_hash_t;
|
||||
|
|
@ -71,13 +71,13 @@ int clicon_hash_keys(clicon_hash_t *hash, char ***vector, size_t *nke
|
|||
* printf ("%s = %s\n", k, (char *)clicon_hash_value(h, k, NULL));
|
||||
* } hash_each_end();
|
||||
*/
|
||||
#define clicon_hash_each(__hash__, __key__) \
|
||||
{ \
|
||||
int __i__; \
|
||||
size_t __n__; \
|
||||
char **__k__ = hash_keys((__hash__),&__n__); \
|
||||
if (__k__) { \
|
||||
#define clicon_hash_each(__hash__, __key__) \
|
||||
{ \
|
||||
int __i__; \
|
||||
size_t __n__; \
|
||||
char **__k__ = hash_keys((__hash__),&__n__); \
|
||||
if (__k__) { \
|
||||
for(__i__ = 0; __i__ < __n__ && ((__key__) = __k__[__i__]); __i__++)
|
||||
#define clicon_hash_each_end(__hash__) if (__k__) free(__k__); } }
|
||||
#define clicon_hash_each_end(__hash__) if (__k__) free(__k__); } }
|
||||
|
||||
#endif /* _CLIXON_HASH_H_ */
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ enum nacm_access{
|
|||
*/
|
||||
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,
|
||||
cxobj *nacm_xtree);
|
||||
cxobj *nacm_xtree);
|
||||
int nacm_datanode_write(clicon_handle h, cxobj *xr, cxobj *xt,
|
||||
enum nacm_access access,
|
||||
char *username, cxobj *xnacm, cbuf *cbret);
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -124,11 +124,11 @@ int netconf_in_use(cbuf *cb, char *type, char *message);
|
|||
int netconf_invalid_value(cbuf *cb, char *type, char *message);
|
||||
int netconf_invalid_value_xml(cxobj **xret, char *type, char *message);
|
||||
int netconf_too_big(cbuf *cb, char *type, char *message);
|
||||
int netconf_missing_attribute(cbuf *cb, char *type, char *info, char *message);
|
||||
int netconf_missing_attribute(cbuf *cb, char *type, char *info, char *message);
|
||||
int netconf_missing_attribute_xml(cxobj **xret, char *type, char *info, char *message);
|
||||
int netconf_bad_attribute(cbuf *cb, char *type, char *info, char *message);
|
||||
int netconf_bad_attribute_xml(cxobj **xret, char *type, char *info, char *message);
|
||||
int netconf_unknown_attribute(cbuf *cb, char *type, char *info, char *message);
|
||||
int netconf_unknown_attribute(cbuf *cb, char *type, char *info, char *message);
|
||||
int netconf_missing_element(cbuf *cb, char *type, char *element, char *message);
|
||||
int netconf_missing_element_xml(cxobj **xret, char *type, char *element, char *message);
|
||||
int netconf_bad_element(cbuf *cb, char *type, char *info, char *element);
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ typedef struct {
|
|||
char *cp_prefix; /* Prefix or module name, should be resolved + id to cp_yang */
|
||||
char *cp_id; /* Identifier */
|
||||
cvec *cp_cvk; /* Key values: list of (name:value) pairs alt (NULL:value)
|
||||
* Can also be single uint32, if so positional eg x/y[42]
|
||||
* This seems kludgy but follows RFC 7950 Sec 9.13
|
||||
*/
|
||||
* Can also be single uint32, if so positional eg x/y[42]
|
||||
* This seems kludgy but follows RFC 7950 Sec 9.13
|
||||
*/
|
||||
yang_stmt *cp_yang; /* Corresponding yang spec (after XML match - ie resolved) */
|
||||
} clixon_path;
|
||||
|
||||
|
|
@ -82,13 +82,13 @@ int api_path_fmt2api_path(const char *api_path_fmt, cvec *cvv, char **api_path,
|
|||
int api_path_fmt2xpath(char *api_path_fmt, cvec *cvv, char **xpath);
|
||||
int api_path2xpath(char *api_path, yang_stmt *yspec, char **xpath, cvec **nsc, cxobj **xerr);
|
||||
int api_path2xml(char *api_path, yang_stmt *yspec, cxobj *xtop,
|
||||
yang_class nodeclass, int strict,
|
||||
cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr);
|
||||
yang_class nodeclass, int strict,
|
||||
cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr);
|
||||
int xml2api_path_1(cxobj *x, cbuf *cb);
|
||||
int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format,
|
||||
...) __attribute__ ((format (printf, 5, 6)));;
|
||||
...) __attribute__ ((format (printf, 5, 6)));;
|
||||
int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format,
|
||||
...) __attribute__ ((format (printf, 5, 6)));;
|
||||
...) __attribute__ ((format (printf, 5, 6)));;
|
||||
int clixon_instance_id_bind(yang_stmt *yt, cvec *nsctx, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
int clixon_instance_id_parse(yang_stmt *yt, clixon_path **cplistp, cxobj **xerr, const char *format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ typedef int (*clicon_upgrade_cb)(
|
|||
*/
|
||||
enum clixon_auth_type {
|
||||
CLIXON_AUTH_NONE = 0, /* Message is authenticated automatically to
|
||||
anonymous user, maye be changed by ca-auth callback
|
||||
FEATURE clixon-restconf:allow-auth-none must be enabled */
|
||||
anonymous user, maye be changed by ca-auth callback
|
||||
FEATURE clixon-restconf:allow-auth-none must be enabled */
|
||||
CLIXON_AUTH_CLIENT_CERTIFICATE, /* TLS Client certification authentication */
|
||||
CLIXON_AUTH_USER, /* User-defined authentication according to ca-auth callback.
|
||||
Such as "password" authentication */
|
||||
Such as "password" authentication */
|
||||
};
|
||||
typedef enum clixon_auth_type clixon_auth_type_t;
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ typedef int (plgdaemon_t)(clicon_handle); /* Plugin pre/post daemon
|
|||
/* Called just before plugin unloaded.
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
typedef int (plgexit_t)(clicon_handle); /* Plugin exit */
|
||||
typedef int (plgexit_t)(clicon_handle); /* Plugin exit */
|
||||
|
||||
/* For yang extension handling.
|
||||
* Called at parsing of yang module containing a statement of an extension.
|
||||
|
|
@ -293,36 +293,36 @@ struct clixon_plugin_api{
|
|||
char ca_name[MAXPATHLEN]; /* Name of plugin (given by plugin) */
|
||||
plginit2_t *ca_init; /* Clixon plugin Init (implicit) */
|
||||
plgstart_t *ca_start; /* Plugin start */
|
||||
plgexit_t *ca_exit; /* Plugin exit */
|
||||
plgexit_t *ca_exit; /* Plugin exit */
|
||||
plgextension_t *ca_extension; /* Yang extension handler */
|
||||
union {
|
||||
struct { /* cli-specific */
|
||||
cli_prompthook_t *ci_prompt; /* Prompt hook */
|
||||
cligen_susp_cb_t *ci_suspend; /* Ctrl-Z hook, see cligen getline */
|
||||
cligen_interrupt_cb_t *ci_interrupt; /* Ctrl-C, see cligen getline */
|
||||
} cau_cli;
|
||||
struct { /* restconf-specific */
|
||||
plgauth_t *cr_auth; /* Auth credentials */
|
||||
} cau_restconf;
|
||||
struct { /* netconf-specific */
|
||||
} cau_netconf;
|
||||
struct { /* backend-specific */
|
||||
struct { /* cli-specific */
|
||||
cli_prompthook_t *ci_prompt; /* Prompt hook */
|
||||
cligen_susp_cb_t *ci_suspend; /* Ctrl-Z hook, see cligen getline */
|
||||
cligen_interrupt_cb_t *ci_interrupt; /* Ctrl-C, see cligen getline */
|
||||
} cau_cli;
|
||||
struct { /* restconf-specific */
|
||||
plgauth_t *cr_auth; /* Auth credentials */
|
||||
} cau_restconf;
|
||||
struct { /* netconf-specific */
|
||||
} cau_netconf;
|
||||
struct { /* backend-specific */
|
||||
plgdaemon_t *cb_pre_daemon; /* Plugin just before daemonization (only daemon) */
|
||||
plgdaemon_t *cb_daemon; /* Plugin daemonized (always called) */
|
||||
plgreset_t *cb_reset; /* Reset system status */
|
||||
plgreset_t *cb_reset; /* Reset system status */
|
||||
|
||||
plgstatedata_t *cb_statedata; /* Provide state data XML from plugin */
|
||||
plglockdb_t *cb_lockdb; /* Database lock changed state */
|
||||
trans_cb_t *cb_trans_begin; /* Transaction start */
|
||||
trans_cb_t *cb_trans_validate; /* Transaction validation */
|
||||
trans_cb_t *cb_trans_complete; /* Transaction validation complete */
|
||||
trans_cb_t *cb_trans_commit; /* Transaction commit */
|
||||
trans_cb_t *cb_trans_commit_done; /* Transaction when commit done */
|
||||
trans_cb_t *cb_trans_revert; /* Transaction revert */
|
||||
trans_cb_t *cb_trans_end; /* Transaction completed */
|
||||
trans_cb_t *cb_trans_abort; /* Transaction aborted */
|
||||
datastore_upgrade_t *cb_datastore_upgrade; /* General-purpose datastore upgrade */
|
||||
} cau_backend;
|
||||
plgstatedata_t *cb_statedata; /* Provide state data XML from plugin */
|
||||
plglockdb_t *cb_lockdb; /* Database lock changed state */
|
||||
trans_cb_t *cb_trans_begin; /* Transaction start */
|
||||
trans_cb_t *cb_trans_validate; /* Transaction validation */
|
||||
trans_cb_t *cb_trans_complete; /* Transaction validation complete */
|
||||
trans_cb_t *cb_trans_commit; /* Transaction commit */
|
||||
trans_cb_t *cb_trans_commit_done; /* Transaction when commit done */
|
||||
trans_cb_t *cb_trans_revert; /* Transaction revert */
|
||||
trans_cb_t *cb_trans_end; /* Transaction completed */
|
||||
trans_cb_t *cb_trans_abort; /* Transaction aborted */
|
||||
datastore_upgrade_t *cb_datastore_upgrade; /* General-purpose datastore upgrade */
|
||||
} cau_backend;
|
||||
} u;
|
||||
};
|
||||
/* Access fields */
|
||||
|
|
@ -373,11 +373,11 @@ typedef struct plugin_context plugin_context_t;
|
|||
* When namespace and name match, the callback is made
|
||||
*/
|
||||
typedef struct {
|
||||
qelem_t rc_qelem; /* List header */
|
||||
qelem_t rc_qelem; /* List header */
|
||||
clicon_rpc_cb rc_callback; /* RPC Callback */
|
||||
void *rc_arg; /* Application specific argument to cb */
|
||||
void *rc_arg; /* Application specific argument to cb */
|
||||
char *rc_namespace;/* Namespace to combine with name tag */
|
||||
char *rc_name; /* Xml/json tag/name */
|
||||
char *rc_name; /* Xml/json tag/name */
|
||||
} rpc_callback_t;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ int clicon_connect_unix(clicon_handle h, char *sockpath);
|
|||
|
||||
|
||||
int clicon_rpc_connect_unix(clicon_handle h,
|
||||
char *sockpath,
|
||||
int *sock0);
|
||||
char *sockpath,
|
||||
int *sock0);
|
||||
|
||||
int clicon_rpc_connect_inet(clicon_handle h,
|
||||
char *dst,
|
||||
uint16_t port,
|
||||
int *sock0);
|
||||
char *dst,
|
||||
uint16_t port,
|
||||
int *sock0);
|
||||
|
||||
int clicon_rpc(int sock, struct clicon_msg *msg, char **xret, int *eof);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,17 +49,17 @@ 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,
|
||||
char *xml);
|
||||
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_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,
|
||||
cvec *nsc, netconf_content content, int32_t depth, char *defaults,
|
||||
uint32_t offset, uint32_t limit,
|
||||
char *direction, char *sort, char *where,
|
||||
cxobj **xt);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@
|
|||
* @endcode
|
||||
*/
|
||||
typedef struct _qelem_t {
|
||||
struct _qelem_t *q_next;
|
||||
struct _qelem_t *q_prev;
|
||||
struct _qelem_t *q_next;
|
||||
struct _qelem_t *q_prev;
|
||||
} qelem_t;
|
||||
|
||||
/*! Append element 'elem' to queue.
|
||||
|
|
@ -64,17 +64,17 @@ typedef struct _qelem_t {
|
|||
* @endcode
|
||||
*/
|
||||
#define ADDQ(elem, pred) { \
|
||||
register qelem_t *Xe = (qelem_t *) (elem); \
|
||||
register qelem_t *Xp = (qelem_t *) (pred); \
|
||||
if (pred) { \
|
||||
Xe->q_next = Xp; \
|
||||
Xe->q_prev = Xp->q_prev; \
|
||||
Xp->q_prev->q_next = Xe; \
|
||||
Xp->q_prev = Xe; \
|
||||
} else { \
|
||||
Xe->q_next = Xe->q_prev = Xe; \
|
||||
pred = elem; \
|
||||
} \
|
||||
register qelem_t *Xe = (qelem_t *) (elem); \
|
||||
register qelem_t *Xp = (qelem_t *) (pred); \
|
||||
if (pred) { \
|
||||
Xe->q_next = Xp; \
|
||||
Xe->q_prev = Xp->q_prev; \
|
||||
Xp->q_prev->q_next = Xe; \
|
||||
Xp->q_prev = Xe; \
|
||||
} else { \
|
||||
Xe->q_next = Xe->q_prev = Xe; \
|
||||
pred = elem; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! Insert element 'elem' in queue after 'pred'
|
||||
|
|
@ -87,17 +87,17 @@ typedef struct _qelem_t {
|
|||
* @endcode
|
||||
*/
|
||||
#define INSQ(elem, pred) { \
|
||||
register qelem_t *Xe = (qelem_t *) (elem); \
|
||||
register qelem_t *Xp = (qelem_t *) (pred); \
|
||||
if (pred) { \
|
||||
Xe->q_next = Xp; \
|
||||
Xe->q_prev = Xp->q_prev; \
|
||||
Xp->q_prev->q_next = Xe; \
|
||||
Xp->q_prev = Xe; \
|
||||
} else { \
|
||||
Xe->q_next = Xe->q_prev = Xe; \
|
||||
} \
|
||||
pred = elem; \
|
||||
register qelem_t *Xe = (qelem_t *) (elem); \
|
||||
register qelem_t *Xp = (qelem_t *) (pred); \
|
||||
if (pred) { \
|
||||
Xe->q_next = Xp; \
|
||||
Xe->q_prev = Xp->q_prev; \
|
||||
Xp->q_prev->q_next = Xe; \
|
||||
Xp->q_prev = Xe; \
|
||||
} else { \
|
||||
Xe->q_next = Xe->q_prev = Xe; \
|
||||
} \
|
||||
pred = elem; \
|
||||
}
|
||||
|
||||
/*! Remove element 'elem' from queue. 'head' is the pointer to the queue and
|
||||
|
|
@ -111,15 +111,15 @@ typedef struct _qelem_t {
|
|||
* DELQ(el, list, struct a*);
|
||||
* @endcode
|
||||
*/
|
||||
#define DELQ(elem, head, type) { \
|
||||
register qelem_t *Xe = (qelem_t *) elem; \
|
||||
if (Xe->q_next == Xe) \
|
||||
head = NULL; \
|
||||
(Xe->q_prev->q_next = Xe->q_next)->q_prev = Xe->q_prev; \
|
||||
if (elem == head) \
|
||||
head = (type)Xe->q_next; \
|
||||
}
|
||||
|
||||
#define DELQ(elem, head, type) { \
|
||||
register qelem_t *Xe = (qelem_t *) elem; \
|
||||
if (Xe->q_next == Xe) \
|
||||
head = NULL; \
|
||||
(Xe->q_prev->q_next = Xe->q_next)->q_prev = Xe->q_prev; \
|
||||
if (elem == head) \
|
||||
head = (type)Xe->q_next; \
|
||||
}
|
||||
|
||||
/*! Get next entry in list
|
||||
* @param[in] type Type of element
|
||||
* @param[in] el Return next element after elem.
|
||||
|
|
@ -127,7 +127,7 @@ typedef struct _qelem_t {
|
|||
* struct a *list; # existing element (or list)
|
||||
* NEXTQ(struct a*, el);
|
||||
*/
|
||||
#define NEXTQ(type, elem) ((type)((elem)?((qelem_t *)(elem))->q_next:NULL))
|
||||
#define PREVQ(type, elem) ((type)((elem)?((qelem_t *)(elem))->q_prev:NULL))
|
||||
#define NEXTQ(type, elem) ((type)((elem)?((qelem_t *)(elem))->q_next:NULL))
|
||||
#define PREVQ(type, elem) ((type)((elem)?((qelem_t *)(elem))->q_prev:NULL))
|
||||
|
||||
#endif /* _CLIXON_QUEUE_H_ */
|
||||
#endif /* _CLIXON_QUEUE_H_ */
|
||||
|
|
|
|||
|
|
@ -68,7 +68,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)(clicon_handle h, int op, cxobj *event, void *arg);
|
||||
|
||||
struct stream_subscription{
|
||||
qelem_t ss_q; /* queue header */
|
||||
|
|
@ -111,11 +111,11 @@ int stream_get_xml(clicon_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,
|
||||
char *xpath, struct timeval *start, struct timeval *stop,
|
||||
stream_fn_t fn, void *arg);
|
||||
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);
|
||||
struct stream_subscription *stream_ss_find(event_stream_t *es,
|
||||
stream_fn_t fn, void *arg);
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ static inline char * strdup4(char *str)
|
|||
int len;
|
||||
len = align4(strlen(str)+1);
|
||||
if ((dup = (char*) malloc(len)) == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
memcpy(dup, str, strlen(str)+1);
|
||||
return dup;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ enum insert_type{ /* edit-config insert */
|
|||
|
||||
/* XML object types */
|
||||
enum cxobj_type {CX_ERROR=-1,
|
||||
CX_ELMNT,
|
||||
CX_ATTR,
|
||||
CX_BODY};
|
||||
CX_ELMNT,
|
||||
CX_ATTR,
|
||||
CX_BODY};
|
||||
|
||||
/* How to bind yang to XML top-level when parsing
|
||||
* Assume an XML tree x with parent xp (or NULL) and a set of children c1,c2:
|
||||
|
|
@ -147,13 +147,13 @@ enum cxobj_type {CX_ERROR=-1,
|
|||
enum yang_bind{
|
||||
YB_NONE=0, /* Dont do Yang binding */
|
||||
YB_MODULE, /* Search for matching yang binding among top-level symbols of Yang modules of direct
|
||||
* children
|
||||
* Ie, xml looks like: <top><x>... where "x" is a top-level symbol in a module
|
||||
*/
|
||||
* children
|
||||
* Ie, xml looks like: <top><x>... where "x" is a top-level symbol in a module
|
||||
*/
|
||||
YB_MODULE_NEXT, /* Search for matching yang binding among top-level symbols of Yang modules of
|
||||
* next-level children
|
||||
* Ie, xml looks like: <top><config><x>... where "x" is a top-level symbol in a module
|
||||
*/
|
||||
* next-level children
|
||||
* Ie, xml looks like: <top><config><x>... where "x" is a top-level symbol in a module
|
||||
*/
|
||||
YB_PARENT, /* Assume yang binding of existing parent and match its children by name */
|
||||
YB_RPC, /* Assume top-level xml is an incoming netconf RPC message (or hello) */
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ typedef struct clixon_xml_vec clixon_xvec; /* struct defined in clicon_xml_vec.c
|
|||
* xml_flag() flags:
|
||||
*/
|
||||
#define XML_FLAG_MARK 0x01 /* General-purpose eg expand and xpath_vec selection and
|
||||
* diffs between candidate and running */
|
||||
* diffs between candidate and running */
|
||||
#define XML_FLAG_TRANSIENT 0x02 /* Marker for dynamic algorithms, unmark asap */
|
||||
#define XML_FLAG_ADD 0x04 /* Node is added (commits) or parent added rec*/
|
||||
#define XML_FLAG_DEL 0x08 /* Node is deleted (commits) or parent deleted rec */
|
||||
|
|
@ -201,7 +201,7 @@ int xml_prefix_set(cxobj *xn, char *name);
|
|||
char *nscache_get(cxobj *x, 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 *ns);
|
||||
int nscache_set(cxobj *x, char *prefix, char *ns);
|
||||
int nscache_clear(cxobj *x);
|
||||
int nscache_replace(cxobj *x, cvec *ns);
|
||||
cxobj *xml_parent(cxobj *xn);
|
||||
|
|
@ -255,7 +255,7 @@ int xml_enumerate_get(cxobj *x);
|
|||
char *xml_body(cxobj *xn);
|
||||
cxobj *xml_body_get(cxobj *xn);
|
||||
char *xml_find_type_value(cxobj *xn_parent, const char *prefix,
|
||||
const char *name, enum cxobj_type type);
|
||||
const char *name, enum cxobj_type type);
|
||||
cxobj *xml_find_type(cxobj *xn_parent, const char *prefix, const char *name, enum cxobj_type type);
|
||||
char *xml_find_value(cxobj *xn_parent, const char *name);
|
||||
char *xml_find_body(cxobj *xn, const char *name);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int xmltree2cbuf(cbuf *cb, cxobj *x, int level);
|
|||
int clixon_xml_parse_file(FILE *f, yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr);
|
||||
int clixon_xml_parse_string(const char *str, yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr);
|
||||
int clixon_xml_parse_va(yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr,
|
||||
const char *format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
const char *format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
int clixon_xml_attr_copy(cxobj *xin, cxobj *xout, char *name);
|
||||
|
||||
#endif /* _CLIXON_XML_IO_H_ */
|
||||
#endif /* _CLIXON_XML_IO_H_ */
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ int isxmlns(cxobj *x);
|
|||
int xmlns_assign(cxobj *x);
|
||||
int xml2cvec(cxobj *xt, yang_stmt *ys, cvec **cvv0);
|
||||
int cvec2xml_1(cvec *cvv, char *toptag, cxobj *xp, cxobj **xt0);
|
||||
int xml_diff(yang_stmt *yspec, cxobj *x0, cxobj *x1,
|
||||
cxobj ***first, int *firstlen,
|
||||
cxobj ***second, int *secondlen,
|
||||
cxobj ***changed_x0, cxobj ***changed_x1, int *changedlen);
|
||||
int xml_diff(yang_stmt *yspec, cxobj *x0, cxobj *x1,
|
||||
cxobj ***first, int *firstlen,
|
||||
cxobj ***second, int *secondlen,
|
||||
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_tree_prune_flags(cxobj *xt, int flags, int mask);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ int xml_nsctx_namespace_netconf_default(clicon_handle h);
|
|||
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 *ns, char **prefix);
|
||||
int xml_nsctx_get_prefix(cvec *cvv, char *ns, char **prefix);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ int xml_insert(cxobj *xp, cxobj *xc, enum insert_type ins, char *key_val, cvec *
|
|||
int xml_sort_verify(cxobj *x, void *arg);
|
||||
#ifdef XML_EXPLICIT_INDEX
|
||||
int xml_search_indexvar_binary_pos(cxobj *xp, char *indexvar, clixon_xvec *xvec,
|
||||
int low, int upper, int max, int *eq);
|
||||
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 *ns, char *name,
|
||||
cvec *cvk, clixon_xvec *xvec);
|
||||
cvec *cvk, clixon_xvec *xvec);
|
||||
int clixon_xml_find_pos(cxobj *xp, yang_stmt *yc, uint32_t pos, clixon_xvec *xvec);
|
||||
|
||||
#endif /* _CLIXON_XML_SORT_H */
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ int xpath_vec_ctx(cxobj *xcur, cvec *nsc, const char *xpath, int localonly, xp
|
|||
|
||||
int xpath_vec_bool(cxobj *xcur, cvec *nsc, const char *xpformat, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags,
|
||||
cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7)));
|
||||
cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7)));
|
||||
|
||||
/* Functions with explicit namespace context (nsc) set. If you do not need
|
||||
* explicit namespace contexts (most do not) consider using the API functions
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
* An application can use any flags above that
|
||||
* @see cv_flag
|
||||
*/
|
||||
#define V_UNSET 0x10 /* Used by XML code to denote a value is not default */
|
||||
#define V_UNSET 0x10 /* Used by XML code to denote a value is not default */
|
||||
|
||||
/*
|
||||
* Yang flags used in
|
||||
|
|
@ -54,12 +54,12 @@
|
|||
#define YANG_FLAG_MARK 0x01 /* (Dynamic) marker for dynamic algorithms, eg expand and DAG */
|
||||
#define YANG_FLAG_TMP 0x02 /* (Dynamic) marker for dynamic algorithms, eg DAG detection */
|
||||
#define YANG_FLAG_NOKEY 0x04 /* Key not mandatory in this list, see eg yang-data extension in
|
||||
* RFC 8040 / ietf-restconf.yang
|
||||
* see restconf_main_extension_cb
|
||||
*/
|
||||
* RFC 8040 / ietf-restconf.yang
|
||||
* see restconf_main_extension_cb
|
||||
*/
|
||||
#ifdef XML_EXPLICIT_INDEX
|
||||
#define YANG_FLAG_INDEX 0x08 /* This yang node under list is (extra) index. --> you can access
|
||||
* list elements using this index with binary search */
|
||||
* list elements using this index with binary search */
|
||||
#endif
|
||||
#ifdef USE_CONFIG_FLAG_CACHE
|
||||
#define YANG_FLAG_CONFIG_CACHE 0x10 /* Ancestor config cache is active */
|
||||
|
|
@ -67,9 +67,9 @@
|
|||
#endif
|
||||
|
||||
#define YANG_FLAG_DISABLED 0x40 /* Disabled due to if-feature evaluate to false
|
||||
* Transformed to ANYDATA but some code may need to check
|
||||
* why it is an ANYDATA
|
||||
*/
|
||||
* Transformed to ANYDATA but some code may need to check
|
||||
* why it is an ANYDATA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Types
|
||||
|
|
@ -279,9 +279,9 @@ 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);
|
||||
int yang_type_cache_get(yang_stmt *ytype, yang_stmt **resolved, int *options,
|
||||
cvec **cvv, cvec *patterns, int *rxmode, cvec *regexps, uint8_t *fraction);
|
||||
cvec **cvv, cvec *patterns, int *rxmode, cvec *regexps, uint8_t *fraction);
|
||||
int yang_type_cache_set(yang_stmt *ys, yang_stmt *resolved, int options, cvec *cvv,
|
||||
cvec *patterns, uint8_t fraction);
|
||||
cvec *patterns, uint8_t fraction);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int yang_modules_init(clicon_handle h);
|
|||
char *yang_modules_revision(clicon_handle h);
|
||||
|
||||
int yang_modules_state_get(clicon_handle h, yang_stmt *yspec, char *xpath,
|
||||
cvec *nsc, int brief, cxobj **xret);
|
||||
cvec *nsc, int brief, cxobj **xret);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
yang_stmt *yang_parse_file(FILE *fp, const char *name, yang_stmt *ysp);
|
||||
yang_stmt *yang_parse_filename(const char *filename, yang_stmt *ysp);
|
||||
int yang_spec_parse_module(clicon_handle h, const char *module,
|
||||
const char *revision, yang_stmt *yspec);
|
||||
const char *revision, 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 ys_parse_date_arg(char *datearg, uint32_t *dateint);
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ 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 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,
|
||||
cvec *patterns, cvec *regexps,
|
||||
int *options, cvec **cvv,
|
||||
cvec *patterns, cvec *regexps,
|
||||
uint8_t *fraction_digits);
|
||||
int yang_type_resolve(yang_stmt *yorig, yang_stmt *ys,
|
||||
yang_stmt *ytype,
|
||||
yang_stmt **restype, int *options,
|
||||
cvec **cvv, cvec *patterns, cvec *regexps,
|
||||
uint8_t *fraction);
|
||||
yang_stmt *ytype,
|
||||
yang_stmt **restype, int *options,
|
||||
cvec **cvv, cvec *patterns, cvec *regexps,
|
||||
uint8_t *fraction);
|
||||
enum cv_type yang_type2cv(yang_stmt *ys);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue