Moved with-defaults processing from get(-config) to xmldb_get when reading db

With-defaults: fixed cornercase in xpath used in list pagination
C-API: Added `with-defaults` parameter (default 0) to `xmldb_get0()`
This commit is contained in:
Olof hagsand 2022-12-16 16:42:05 +01:00
parent e885d63f68
commit 0d41d49fa9
19 changed files with 420 additions and 196 deletions

View file

@ -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, 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] */

View file

@ -129,6 +129,17 @@ enum framing_type{
};
typedef enum framing_type netconf_framing_type;
/* NETCONF with-defaults
* @see RFC 6243
*/
enum withdefaults_type{
WITHDEFAULTS_REPORT_ALL = 0, /* default */
WITHDEFAULTS_TRIM,
WITHDEFAULTS_EXPLICIT,
WITHDEFAULTS_REPORT_ALL_TAGGED
};
typedef enum withdefaults_type withdefaults_type;
/*
* Macros
*/
@ -142,6 +153,8 @@ typedef enum framing_type netconf_framing_type;
/*
* Prototypes
*/
char *withdefaults_int2str(int keyword);
int withdefaults_str2int(char *str);
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);

View file

@ -79,5 +79,8 @@ int yang_xml_mandatory(cxobj *xt, yang_stmt *ys);
int xml_rpc_isaction(cxobj *xn);
int xml_find_action(cxobj *xn, int top, cxobj **xap);
int purge_tagged_nodes(cxobj *xn, char *ns, char *name, char *value, int keepnode);
int xml_add_default_tag(cxobj *x, uint16_t flags);
int xml_flag_state_default_value(cxobj *x, uint16_t flag);
int xml_flag_default_value(cxobj *x, uint16_t flag);
#endif /* _CLIXON_XML_MAP_H_ */