2018-03-17 17:29:09 +01:00
|
|
|
|
|
|
|
|
2016-03-28 16:51:06 +02:00
|
|
|
#include "dbg.h"
|
|
|
|
#include "log.h"
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-28 16:51:06 +02:00
|
|
|
#include "cw.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
/*
|
2016-03-28 16:51:06 +02:00
|
|
|
int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
|
|
int len, struct sockaddr *from)
|
|
|
|
{
|
2018-02-26 18:28:12 +01:00
|
|
|
// TODO XXXX
|
|
|
|
// const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->radioitems,a->item_id,CW_ITEM_NONE);
|
|
|
|
const cw_itemdef_t * idef = 0;
|
|
|
|
|
2016-03-28 16:51:06 +02:00
|
|
|
if (!idef){
|
|
|
|
cw_log(LOG_ERR,"No definition found for %s",a->item_id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int rid = cw_get_byte(data);
|
|
|
|
mbag_t radio = mbag_i_get_mbag(conn->radios, rid, NULL);
|
|
|
|
if (!radio) {
|
|
|
|
if (a->vendor_id != 0
|
2018-02-23 13:59:36 +01:00
|
|
|
|| ( (a->vendor_id == 0) && (a->msg_id != CAPWAP_MSG_DISCOVERY_REQUEST
|
2018-02-23 17:23:53 +01:00
|
|
|
&& a->msg_id != CAPWAP_MSG_JOIN_REQUEST) )) {
|
2016-03-28 16:51:06 +02:00
|
|
|
cw_dbg(DBG_ELEM_ERR, "Radio not found %d", rid);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
mbag_i_set_mbag(conn->radios,rid,mbag_create());
|
|
|
|
radio = mbag_i_get_mbag(conn->radios, rid, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rc = mbag_set_from_buf(radio,idef->type,a->item_id,data+1,len-1);
|
|
|
|
if (!rc){
|
|
|
|
cw_log(LOG_ERR,
|
|
|
|
"Can't handle item type %s in definition for incomming msg %d (%s) - %d, cw_in_radio_generic.",
|
|
|
|
idef->type->name, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2018-03-17 17:29:09 +01:00
|
|
|
*/
|
2016-03-28 16:51:06 +02:00
|
|
|
|