* Restconf: added inline configuration using -R <xml> command line as an alternative to making advanced restconf configuration

This commit is contained in:
Olof hagsand 2021-05-25 15:21:45 +02:00
parent 1ef7a280d7
commit 164aa1cb4c
9 changed files with 161 additions and 41 deletions

View file

@ -272,7 +272,6 @@ int xml_search_child_insert(cxobj *xp, cxobj *x);
int xml_search_child_rm(cxobj *xp, cxobj *x);
cxobj *xml_child_index_each(cxobj *xparent, char *name, cxobj *xprev, enum cxobj_type type);
#endif
#endif /* _CLIXON_XML_H */

View file

@ -697,11 +697,15 @@ clixon_process_status(clicon_handle h,
if (pe->pe_description)
cprintf(cbret, "<description xmlns=\"%s\">%s</description>", CLIXON_LIB_NS, pe->pe_description);
cprintf(cbret, "<command xmlns=\"%s\">", CLIXON_LIB_NS);
/* the command may include any data, including XML (such as restconf -R command) and
therefore needs CDATA encoding */
cprintf(cbret, "<![CDATA[");
for (i=0; i<pe->pe_argc-1; i++){
if (i)
cprintf(cbret, " ");
cprintf(cbret, "%s", pe->pe_argv[i]);
}
cprintf(cbret, "]]>");
cprintf(cbret, "</command>");
cprintf(cbret, "<status xmlns=\"%s\">%s</status>", CLIXON_LIB_NS,
clicon_int2str(proc_state_map, pe->pe_state));