Added nsc parameter to xmldb_get()
This commit is contained in:
parent
08b128f4d7
commit
46552066d1
5 changed files with 12 additions and 8 deletions
|
|
@ -12,7 +12,9 @@
|
||||||
* Fixed multi-namespace for augmented state which was not covered in 4.2.0.
|
* Fixed multi-namespace for augmented state which was not covered in 4.2.0.
|
||||||
|
|
||||||
### API changes on existing features (you may need to change your code)
|
### API changes on existing features (you may need to change your code)
|
||||||
* C-API: Added clicon_handle as parameter to all `clicon_connect_` functions to get better error message
|
* C-API
|
||||||
|
* Added clicon_handle as parameter to all `clicon_connect_` functions to get better error message
|
||||||
|
* Added nsc parameter to `xmldb_get()`
|
||||||
* Yang files reorganized into three classes: clixon, mandatory, optional (previous "standard" split into mandatory and optional).
|
* Yang files reorganized into three classes: clixon, mandatory, optional (previous "standard" split into mandatory and optional).
|
||||||
* Clixon and mandatory yang spec are always installed
|
* Clixon and mandatory yang spec are always installed
|
||||||
* Optional yang files are loaded only if configured with `--enable-optyangs` (flipped logic and changed from `disable-stdyangs`). NOTE: you must do this to run examples and tests.
|
* Optional yang files are loaded only if configured with `--enable-optyangs` (flipped logic and changed from `disable-stdyangs`). NOTE: you must do this to run examples and tests.
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ startup_extraxml(clicon_handle h,
|
||||||
* It should be empty if extra-xml is null and reset plugins did nothing
|
* It should be empty if extra-xml is null and reset plugins did nothing
|
||||||
* then skip validation.
|
* then skip validation.
|
||||||
*/
|
*/
|
||||||
if (xmldb_get(h, tmp_db, NULL, &xt0) < 0)
|
if (xmldb_get(h, tmp_db, NULL, NULL, &xt0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xt0==NULL || xml_child_nr(xt0)==0)
|
if (xt0==NULL || xml_child_nr(xt0)==0)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ int xmldb_validate_db(const char *db);
|
||||||
int xmldb_connect(clicon_handle h);
|
int xmldb_connect(clicon_handle h);
|
||||||
int xmldb_disconnect(clicon_handle h);
|
int xmldb_disconnect(clicon_handle h);
|
||||||
/* in clixon_datastore_read.[ch] */
|
/* in clixon_datastore_read.[ch] */
|
||||||
int xmldb_get(clicon_handle h, const char *db, char *xpath, cxobj **xtop);
|
int xmldb_get(clicon_handle h, const char *db, cvec *nsc, char *xpath, cxobj **xtop);
|
||||||
int xmldb_get0(clicon_handle h, const char *db,
|
int xmldb_get0(clicon_handle h, const char *db,
|
||||||
cvec *nc, char *xpath,
|
cvec *nsc, char *xpath,
|
||||||
int copy, cxobj **xtop, modstate_diff_t *msd);
|
int copy, cxobj **xtop, modstate_diff_t *msd);
|
||||||
int xmldb_get0_clear(clicon_handle h, cxobj *x);
|
int xmldb_get0_clear(clicon_handle h, cxobj *x);
|
||||||
int xmldb_get0_free(clicon_handle h, cxobj **xp);
|
int xmldb_get0_free(clicon_handle h, cxobj **xp);
|
||||||
|
|
|
||||||
|
|
@ -647,12 +647,13 @@ xmldb_get_zerocopy(clicon_handle h,
|
||||||
/*! Get content of datastore and return a copy of the XML tree
|
/*! Get content of datastore and return a copy of the XML tree
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
* @param[in] db Name of database to search in (filename including dir path
|
* @param[in] db Name of database to search in (filename including dir path
|
||||||
|
* @param[in] nsc XML namespace context for XPATH
|
||||||
* @param[in] xpath String with XPATH syntax. or NULL for all
|
* @param[in] xpath String with XPATH syntax. or NULL for all
|
||||||
* @param[out] xret Single return XML tree. Free with xml_free()
|
* @param[out] xret Single return XML tree. Free with xml_free()
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
* @code
|
* @code
|
||||||
* if (xmldb_get(xh, "running", "/interfaces/interface[name="eth"]", &xt) < 0)
|
* if (xmldb_get(xh, "running", NULL, "/interfaces/interface[name="eth"]", &xt) < 0)
|
||||||
* err;
|
* err;
|
||||||
* xml_free(xt);
|
* xml_free(xt);
|
||||||
* @endcode
|
* @endcode
|
||||||
|
|
@ -661,10 +662,11 @@ xmldb_get_zerocopy(clicon_handle h,
|
||||||
int
|
int
|
||||||
xmldb_get(clicon_handle h,
|
xmldb_get(clicon_handle h,
|
||||||
const char *db,
|
const char *db,
|
||||||
|
cvec *nsc,
|
||||||
char *xpath,
|
char *xpath,
|
||||||
cxobj **xret)
|
cxobj **xret)
|
||||||
{
|
{
|
||||||
return xmldb_get0(h, db, NULL, xpath, 1, xret, NULL);
|
return xmldb_get0(h, db, nsc, xpath, 1, xret, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Zero-copy variant of get content of database
|
/*! Zero-copy variant of get content of database
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ main(int argc, char **argv)
|
||||||
xpath = argv[1];
|
xpath = argv[1];
|
||||||
else
|
else
|
||||||
xpath = "/";
|
xpath = "/";
|
||||||
if (xmldb_get(h, db, xpath, &xt) < 0)
|
if (xmldb_get(h, db, NULL, xpath, &xt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
clicon_xml2file(stdout, xt, 0, 0);
|
clicon_xml2file(stdout, xt, 0, 0);
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
@ -217,7 +217,7 @@ main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
xpath = "/";
|
xpath = "/";
|
||||||
for (i=0;i<nr;i++){
|
for (i=0;i<nr;i++){
|
||||||
if (xmldb_get(h, db, xpath, &xt) < 0)
|
if (xmldb_get(h, db, NULL, xpath, &xt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xt == NULL){
|
if (xt == NULL){
|
||||||
clicon_err(OE_DB, 0, "xt is NULL");
|
clicon_err(OE_DB, 0, "xt is NULL");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue