* C-API: Added xpath_first_localonly() as an xpath function that skips prefix and namespace checks.
* Added experimental code for optizing XPath search using binary search. * Enable with XPATH_LIST_OPTIMIZE * Changed `clicon_rpc_generate_error(msg, xerr)` to `clicon_rpc_generate_error(xerr, msg, arg)`
This commit is contained in:
parent
ab46ce9820
commit
7ad16bd84b
56 changed files with 602 additions and 227 deletions
|
|
@ -44,7 +44,7 @@ int clicon_rpc_msg(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_generate_error(const char *format, cxobj *xerr);
|
||||
int clicon_rpc_generate_error(cxobj *xerr, const char *fmt, const char *arg);
|
||||
int clicon_rpc_get_config(clicon_handle h, char *username, char *db, char *xpath, cvec *nsc, cxobj **xret);
|
||||
int clicon_rpc_edit_config(clicon_handle h, char *db, enum operation_type op,
|
||||
char *xml);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ int clicon_str2int(const map_str2int *mstab, char *str);
|
|||
int clicon_str2int_search(const map_str2int *mstab, char *str, int upper);
|
||||
int nodeid_split(char *nodeid, char **prefix, char **id);
|
||||
char *clixon_trim(char *str);
|
||||
int clicon_strcmp(char *s1, char *s2);
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
char *clicon_strndup (const char *, size_t);
|
||||
#endif /* ! HAVE_STRNDUP */
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ int xml_sort(cxobj *x0, void *arg);
|
|||
int xml_insert(cxobj *xp, cxobj *xc, enum insert_type ins, char *key_val, cvec *nsckey);
|
||||
int xml_sort_verify(cxobj *x, void *arg);
|
||||
int match_base_child(cxobj *x0, cxobj *x1c, yang_stmt *yc, cxobj **x0cp);
|
||||
cxobj *xml_binsearch(cxobj *xp, char *name, char *keyname, char *keyval);
|
||||
int xml_binsearch(cxobj *xp, char *name, char *keyname, char *keyval, cxobj **xret);
|
||||
|
||||
#endif /* _CLIXON_XML_SORT_H */
|
||||
|
|
|
|||
|
|
@ -101,10 +101,13 @@ enum xp_type{
|
|||
};
|
||||
|
||||
/*! XPATH Parsing generates a tree of nodes that is later traversed
|
||||
* That is, a tree-structured XPATH.
|
||||
* Note that the structure follows XPATH 1.0 closely. The drawback wit this is that the tree gets
|
||||
* very deep very quickly, even for simple XPATHs.
|
||||
*/
|
||||
struct xpath_tree{
|
||||
enum xp_type xs_type;
|
||||
int xs_int; /* step-> axis-type */
|
||||
int xs_int; /* step-> axis_type */
|
||||
double xs_double;
|
||||
char *xs_strnr; /* original string xs_double: numeric value */
|
||||
char *xs_s0;
|
||||
|
|
@ -122,9 +125,10 @@ char* xpath_tree_int2str(int nodetype);
|
|||
int xpath_tree_print_cb(cbuf *cb, xpath_tree *xs);
|
||||
int xpath_tree_print(FILE *f, xpath_tree *xs);
|
||||
int xpath_tree2cbuf(xpath_tree *xs, cbuf *xpathcb);
|
||||
int xpath_tree_eq(xpath_tree *xt1, xpath_tree *xt2, cvec *match);
|
||||
int xpath_tree_free(xpath_tree *xs);
|
||||
int xpath_parse(char *xpath, xpath_tree **xptree);
|
||||
int xpath_vec_ctx(cxobj *xcur, cvec *nsc, char *xpath, xp_ctx **xrp);
|
||||
int xpath_vec_ctx(cxobj *xcur, cvec *nsc, char *xpath, int localonly, xp_ctx **xrp);
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
int xpath_vec_bool(cxobj *xcur, cvec *nsc, char *xpformat, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
|
@ -144,9 +148,11 @@ int xpath_vec_flag(cxobj *xcur, cvec *nsc, char *xpformat, uint16_t flags,
|
|||
*/
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
cxobj *xpath_first(cxobj *xcur, cvec *nsc, char *xpformat, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
cxobj *xpath_first_localonly(cxobj *xcur, char *xpformat, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int xpath_vec(cxobj *xcur, cvec *nsc, char *xpformat, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 3, 6)));
|
||||
#else
|
||||
cxobj *xpath_first(cxobj *xcur, cvec *nsc, char *xpformat, ...);
|
||||
cxobj *xpath_first_localonly(cxobj *xcur, char *xpformat, ...);
|
||||
int xpath_vec(cxobj *xcur, cvec *nsc, char *xpformat, cxobj ***vec, size_t *veclen, ...);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ extern const map_str2int ctxmap[];
|
|||
int ctx_free(xp_ctx *xc);
|
||||
xp_ctx *ctx_dup(xp_ctx *xc);
|
||||
int ctx_nodeset_replace(xp_ctx *xc, cxobj **vec, size_t veclen);
|
||||
int ctx_print(cbuf *cb, int id, xp_ctx *xc, char *str);
|
||||
int ctx_print_cb(cbuf *cb, xp_ctx *xc, int indent, char *str);
|
||||
int ctx_print(FILE *f, xp_ctx *xc, char *str);
|
||||
int ctx2boolean(xp_ctx *xc);
|
||||
int ctx2string(xp_ctx *xc, char **str0);
|
||||
int ctx2number(xp_ctx *xc, double *n0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue