Fixed a lot of bugs with action lists.

FossilOrigin-Name: 8508ea2ae3a0a1d1ec2ac76ddf1c7813f802c656f4ffb1b463769347405ae85a
This commit is contained in:
7u83@mail.ru 2015-05-01 11:55:02 +00:00
parent 25cd668ca7
commit 4423c1d79e
5 changed files with 21 additions and 8 deletions

View File

@ -154,10 +154,10 @@ static int cw_action_out_cmp(const void *elem1, const void *elem2)
}
else{
if (!e1->item_id) {
r = strcmp("", e2->item_id);
r = strcmp(CW_ITEM_NONE, e2->item_id);
}
else if (!e2->item_id){
r = strcmp(e1->item_id,"");
r = strcmp(e1->item_id,CW_ITEM_NONE);
}
else{
r = strcmp(e1->item_id, e2->item_id);
@ -185,7 +185,7 @@ static int cw_action_out_cmp(const void *elem1, const void *elem2)
void *cw_actionlist_add(struct avltree *t, void *a, size_t s)
{
void *r = mavl_replace_data(t, a, sizeof(struct cw_action_in));
void *r = mavl_replace_data(t, a, s); //sizeof(struct cw_action_in));
if (r) {
return r;
}
@ -199,6 +199,7 @@ void *cw_actionlist_add(struct avltree *t, void *a, size_t s)
}
#include "dbg.h" // Tube
/**
* Create an action list for outgoing message lements
@ -212,6 +213,7 @@ 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

@ -34,7 +34,7 @@ cw_action_out_t capwap_80211_actions_wtp_out[]={
*/
/* 802.11 Radio Information */
{CW_MSG_DISCOVERY_REQUEST, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_RADIO_INFOS /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
,
@ -43,8 +43,11 @@ cw_action_out_t capwap_80211_actions_wtp_out[]={
*/
/* 802.11 Radio Information */
{CW_MSG_JOIN_REQUEST, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
{CW_MSG_JOIN_REQUEST, CW_ITEM_RADIO_INFOS, 0,
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1},
{0,0,0}
};

View File

@ -89,6 +89,7 @@ const char CW_ITEM_WTP_BOARD_MACADDRESS[]="wtp_board_macadddress";
const char CW_ITEM_WTP_BOARD_ID[]="wtp_board_id";
const char CW_ITEM_WTP_BOARD_REVISION[]="wtp_board_revision";
const char CW_ITEM_WTP_BOARD_SERIALNO[]="serial_no";
const char CW_ITEM_RADIO_INFOS[]="radio_infos";
//const char CW_ITEM_XY[]="wtp_name";

View File

@ -169,7 +169,7 @@ extern const char CW_ITEM_WTP_BOOTLOADER_VERSION[];
extern const char CW_ITEM_WTP_RADIOS_IN_USE[];
extern const char CW_ITEM_WTP_MAX_RADIOS[];
extern const char CW_ITEM_RADIO_INFOS[];

View File

@ -63,11 +63,18 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
return -1;
}
DBGX("Found am %p %p",am,am->item_id);
DBGX("Teh ELEM ID found '%s'",am->item_id);
cw_action_out_t *ae;
int len = 0;
while(NULL != (ae=avliter_next(&i))) {
//DBGX("Put %d %d\n",ae->msg_id,ae->elem_id);
DBGX("Put %d %i %p\n",ae->msg_id,ae->elem_id,ae->item_id);
DBGX("Elem ID %s",ae->item_id);
if ( ae->item_id ) {
DBGX("Item ID: %s %p",ae->item_id,CW_ITEM_NONE);
}
if (ae->msg_id != as.msg_id) {
/* Element is from next msg, close action */