Added connect/disconnect/getopt/setopt and handle to xmldb API; Added datastore 'text'; Moved apps/dbctrl to datastore/

This commit is contained in:
Olof hagsand 2017-04-15 13:53:58 +02:00
parent 85af4342dc
commit d26a801bc0
25 changed files with 1501 additions and 912 deletions

View file

@ -58,18 +58,17 @@
#define handle(h) (assert(clicon_handle_check(h)==0),(struct clicon_handle *)(h))
/*
* clicon_handle
* Internal structire of basic handle. Also header of all other handles.
* see struct clicon_cli_handle, struct clicon_backend_handle, etc
/*! Internal structure of basic handle. Also header of all other handles.
* @note If you change here, you must also change the structs below:
* @see struct cli_handle, struct backend_handle
*/
struct clicon_handle {
int ch_magic; /* magic (HDR) */
clicon_hash_t *ch_copt; /* clicon option list (HDR) */
clicon_hash_t *ch_data; /* internal clicon data (HDR) */
void *ch_xmldb; /* XMLDB storage handle, uie xmldb_handle */
};
/*! Internal call to allocate a CLICON handle.
*
* There may be different variants of handles with some common options.
@ -166,3 +165,31 @@ clicon_data(clicon_handle h)
return ch->ch_data;
}
/*! Set or reset XMLDB storage handle
* @param[in] h Clicon handle
* @param[in] xh XMLDB storage handle. If NULL reset it
* @note Just keep note of it, dont allocate it or so.
*/
int
clicon_handle_xmldb_set(clicon_handle h,
void *xh)
{
struct clicon_handle *ch = handle(h);
ch->ch_xmldb = xh;
return 0;
}
/*! Get XMLDB storage handle
* @param[in] h Clicon handle
* @retval xh XMLDB storage handle. If not connected return NULL
*/
void *
clicon_handle_xmldb_get(clicon_handle h)
{
struct clicon_handle *ch = handle(h);
return ch->ch_xmldb;
}