Simple SQLite3 interface is available.

FossilOrigin-Name: 5bbd9c9c08c71292176295c13c8a5021e9ea7476998d4312f6bc900ae773a412
This commit is contained in:
7u83@mail.ru
2015-05-02 00:02:06 +00:00
parent 2dbe69d18c
commit 718b3c75b1
15 changed files with 160 additions and 70 deletions

View File

@ -76,6 +76,7 @@ MAVLOBJS= \
mavl_foreach.o \
mavl_foreach_lr.o \
mavl_merge.o \
mavl_create_conststr.o \
utf8.o \
file.o

View File

@ -166,10 +166,12 @@ static int cw_action_out_cmp(const void *elem1, const void *elem2)
if (r != 0)
return r;
/*
r = e1->vendor_id - e2->vendor_id;
if (r != 0)
return r;
*/
return 0;
}
@ -213,7 +215,6 @@ cw_actionlist_out_t cw_actionlist_out_create()
cw_action_out_t *cw_actionlist_out_add(cw_actionlist_out_t t, struct cw_action_out * a)
{
DBGX("Adding out action: %d %d %p ",a->msg_id,a->elem_id,a->item_id);
return cw_actionlist_add(t, a, sizeof(struct cw_action_out));
}

View File

@ -318,7 +318,7 @@ cw_action_out_t capwap_actions_ac_out[] = {
/* -------------------------------------------------------------------------------
* Echo Response
* Echo Response OUT
*/
{CW_MSG_ECHO_RESPONSE, CW_ITEM_NONE}
@ -326,14 +326,19 @@ cw_action_out_t capwap_actions_ac_out[] = {
/* -------------------------------------------------------------------------------
* Update Request
* Update Request OUT
*/
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_NONE}
,
/* Result Code */
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_WTP_NAME, 0,
CW_ELEM_WTP_NAME, NULL,cw_out_generic, cw_out_get_outgoing, 1}
CW_ELEM_WTP_NAME, NULL,cw_out_generic, cw_out_get_outgoing, 0}
,
/* Location Data */
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_LOCATION_DATA, 0,
CW_ELEM_LOCATION_DATA, NULL,cw_out_generic, cw_out_get_outgoing,0}
,

View File

@ -163,6 +163,10 @@ cw_action_in_t capwap_actions_wtp_in[] = {
CW_ACTION_IN_WTP_NAME, 0}
,
/* Location Data */
{0, 0, CW_STATE_RUN, CW_MSG_CONFIGURATION_UPDATE_REQUEST,
CW_ACTION_IN_LOCATION_DATA, 0}
,
/* Element: Vendor Specific */

View File

@ -161,11 +161,11 @@ cw_action_out_t cipwap_actions_ac_out[] = {
* Configuration Update Request
*/
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_WTP_NAME, CW_VENDOR_ID_CISCO,
CW_CISCO_RAD_NAME, NULL,cw_out_generic, cw_out_get_outgoing,1}
CW_CISCO_RAD_NAME, NULL,cw_out_generic, cw_out_get_outgoing,0}
,
{CW_MSG_CONFIGURATION_UPDATE_REQUEST, CW_ITEM_AP_MODE_AND_TYPE, CW_VENDOR_ID_CISCO,
CW_CISCO_AP_MODE_AND_TYPE, NULL,cw_out_generic, cw_out_get_outgoing,1}
CW_CISCO_AP_MODE_AND_TYPE, NULL,cw_out_generic, cw_out_get_outgoing,0}
,

View File

@ -74,7 +74,7 @@ int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst) //
);
}
else{
cw_dbg(DBG_WARN,"No output for element %s%d -(%s) in %s. Item %d not found.",
cw_dbg(DBG_WARN,"No output for element %s%d -(%s) in %s. Item %s not found.",
vendor,
a->elem_id, cw_strelemp(conn->actions, a->elem_id)
, cw_strmsg(a->msg_id),a->item_id);

View File

@ -113,7 +113,7 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
* alread initilaized in buffer
* Message alements are taken fom actiondef in #conn->action
*/
int cw_put_custum_msg(struct conn *conn, uint8_t * rawout, mbag_t elems)
int cw_put_custom_msg(struct conn *conn, uint8_t * rawout, mavl_conststr_t elems)
{
/* rawout is already initialized, so we can get
msg type from buffer */
@ -122,13 +122,21 @@ int cw_put_custum_msg(struct conn *conn, uint8_t * rawout, mbag_t elems)
MAVLITER_DEFINE(it,elems);
mavliter_foreach(&it){
mavliter_get(&it);
const char *i= mavliter_get(&it);
/* preapare action search */
cw_action_out_t as;
as.msg_id=msg_id;
as.item_id=i;
as.vendor_id=0;
cw_action_out_t as;
as.item_id = CW_ITEM_NONE;
as.vendor_id = 0;

View File

@ -212,6 +212,12 @@ extern void * mavliter_seek(mavliter_t *i,void *d);
typedef mavl_t mavl_conststr_t;
extern mavl_conststr_t mavl_create_conststr();
/*
static inline void *mavl_replace_data(struct mavl *t, void *data, int len)
{

View File

@ -0,0 +1,12 @@
#include "mavl.h"
static int cmp(const void *v1,const void*v2)
{
return strcmp( (char*)v1,(char*)v2);
}
mavl_conststr_t mavl_create_conststr()
{
return mavl_create(cmp,NULL);
}

View File

@ -30,7 +30,7 @@ static void mavl_del_all0(struct mavl *t ,struct mavlnode * n)
void mavl_del_all(struct mavl *t)
{
mavl_del_all0(t,t->root);
t->root=0;
t->root=NULL;
}

View File

@ -42,7 +42,7 @@ static struct mbag_item * mbag_fromstr(const char *src)
return NULL;
i->type = MBAG_STR;
i->data = strdup(src);
i->data = strndup(src,2000);
return i;
}