Add a test_c++.sh for c++ compiling with c++ code and with 32 bit systems.
This commit is contained in:
parent
593ed2ef3b
commit
d6580221d3
1 changed files with 50 additions and 39 deletions
|
|
@ -24,22 +24,47 @@ cat<<EOF > $cfile
|
||||||
* Called once everything has been initialized, right before
|
* Called once everything has been initialized, right before
|
||||||
* the main event loop is entered.
|
* the main event loop is entered.
|
||||||
*/
|
*/
|
||||||
int
|
|
||||||
plugin_start(clicon_handle h)
|
clixon_plugin_api * clixon_plugin_init(clicon_handle h);
|
||||||
|
|
||||||
|
int plugin_start(clicon_handle h)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int plugin_exit(clicon_handle h)
|
||||||
plugin_exit(clicon_handle h)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class netconf_test
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
struct clixon_plugin_api api;
|
||||||
|
plginit2_t *ca_init;
|
||||||
|
plgstart_t *ca_start;
|
||||||
|
plgexit_t *ca_exit;
|
||||||
|
|
||||||
|
public:
|
||||||
|
netconf_test(plginit2_t* init, plgstart_t* start, plgexit_t* exit, const char* str = "c++ netconf test") : api()
|
||||||
|
{
|
||||||
|
strcpy(api.ca_name, str);
|
||||||
|
api.ca_init = clixon_plugin_init;
|
||||||
|
api.ca_start = plugin_start;
|
||||||
|
api.ca_exit = plugin_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
clixon_plugin_api* get_api(void)
|
||||||
|
{
|
||||||
|
return &api;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static netconf_test api(clixon_plugin_init, plugin_start, plugin_exit);
|
||||||
|
|
||||||
/*! Local example netconf rpc callback
|
/*! Local example netconf rpc callback
|
||||||
*/
|
*/
|
||||||
int
|
int netconf_client_rpc(clicon_handle h,
|
||||||
netconf_client_rpc(clicon_handle h,
|
|
||||||
cxobj *xe,
|
cxobj *xe,
|
||||||
cbuf *cbret,
|
cbuf *cbret,
|
||||||
void *arg,
|
void *arg,
|
||||||
|
|
@ -50,56 +75,42 @@ netconf_client_rpc(clicon_handle h,
|
||||||
char *ns;
|
char *ns;
|
||||||
|
|
||||||
/* get namespace from rpc name, return back in each output parameter */
|
/* get namespace from rpc name, return back in each output parameter */
|
||||||
if ((ns = xml_find_type_value(xe, NULL, "xmlns", CX_ATTR)) == NULL){
|
if ((ns = xml_find_type_value(xe, NULL, "xmlns", CX_ATTR)) == NULL)
|
||||||
clicon_err(OE_XML, ENOENT, "No namespace given in rpc %s", xml_name(xe));
|
{
|
||||||
goto done;
|
clicon_err(OE_XML, ENOENT, "No namespace given in rpc %s", xml_name(xe));
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
cprintf(cbret, "<rpc-reply>");
|
cprintf(cbret, "<rpc-reply>");
|
||||||
if (!xml_child_nr_type(xe, CX_ELMNT))
|
if (!xml_child_nr_type(xe, CX_ELMNT))
|
||||||
cprintf(cbret, "<ok/>");
|
cprintf(cbret, "<ok/>");
|
||||||
else while ((x = xml_child_each(xe, x, CX_ELMNT)) != NULL) {
|
else
|
||||||
if (xmlns_set(x, NULL, ns) < 0)
|
while ((x = xml_child_each(xe, x, CX_ELMNT)) != NULL)
|
||||||
goto done;
|
{
|
||||||
if (clicon_xml2cbuf(cbret, x, 0, 0, -1) < 0)
|
if (xmlns_set(x, NULL, ns) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
if (clicon_xml2cbuf(cbret, x, 0, 0, -1) < 0)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
cprintf(cbret, "</rpc-reply>");
|
cprintf(cbret, "</rpc-reply>");
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
clixon_plugin_api * clixon_plugin_init(clicon_handle h);
|
|
||||||
|
|
||||||
static struct clixon_plugin_api api;
|
|
||||||
|
|
||||||
void api_initialization(void)
|
|
||||||
{
|
|
||||||
strcpy(api.ca_name, "c++ netconf test"); /* name */
|
|
||||||
api.ca_init = clixon_plugin_init; /* init */
|
|
||||||
api.ca_start = plugin_start; /* start */
|
|
||||||
api.ca_exit = plugin_exit; /* exit */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! Netconf plugin initialization
|
/*! Netconf plugin initialization
|
||||||
* @param[in] h Clixon handle
|
* @param[in] h Clixon handle
|
||||||
* @retval NULL Error with clicon_err set
|
* @retval NULL Error with clicon_err set
|
||||||
* @retval api Pointer to API struct
|
* @retval api Pointer to API struct
|
||||||
*/
|
*/
|
||||||
clixon_plugin_api *
|
clixon_plugin_api* clixon_plugin_init(clicon_handle h)
|
||||||
clixon_plugin_init(clicon_handle h)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
api_initialization();
|
|
||||||
|
|
||||||
clicon_debug(1, "%s netconf", __FUNCTION__);
|
clicon_debug(1, "%s netconf", __FUNCTION__);
|
||||||
/* Register local netconf rpc client (note not backend rpc client) */
|
/* Register local netconf rpc client (note not backend rpc client) */
|
||||||
if (rpc_callback_register(h, netconf_client_rpc, NULL,
|
if (rpc_callback_register(h, netconf_client_rpc, NULL, "urn:example:clixon", "client-rpc") < 0)
|
||||||
"urn:example:clixon", "client-rpc") < 0)
|
return NULL;
|
||||||
return NULL;
|
|
||||||
return &api;
|
return api.get_api();
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue