FossilOrigin-Name: 4ab68091de5e289ccb0c5e6296215cbbc740cd234eec00a2c22b9a938801554c
This commit is contained in:
7u83@mail.ru 2015-04-24 17:50:28 +00:00
parent b6f35abd40
commit d26132dea1
4 changed files with 0 additions and 306 deletions

View File

@ -1,58 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include "capwap.h"
#include <stdio.h>
/*
* for each capwap message element in msgelems call the callback function
*/
int cw_foreach_msgelem(uint8_t * msgelems, int len,
int (*callback) (void *, int, uint8_t *, int),
void *arg)
{
uint32_t val;
int type;
int elen;
int i = 0;
do {
val = ntohl(*(uint32_t *) (msgelems + i));
type = (val >> 16) & 0xFFFF;
elen = val & 0xffff;
if (i + elen + 4 > len) {
/*
printf("***************************************************************************\n");
printf("Type: %d\n",type);
printf("Bumm %d %d\n",i+elen+4,len);
*/
return 0;
}
callback(arg, type, msgelems + i + 4, elen);
i += elen + 4;
// printf("left = %d\n",len-i);
} while (i < len);
return 1;
}

View File

@ -1,86 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
* @brief Defines cwread_change_state_even_request function.
*
*/
#include <stdio.h>
#include "capwap.h"
#include "cw_log.h"
#include "cw_util.h"
struct eparm {
int * mand;
uint32_t result_code;
struct wtpinfo * wtpinfo;
};
static int readelem(void * eparm,int type,uint8_t* msgelem,int len)
{
struct eparm * e = (struct eparm*)eparm;
cw_dbg_msgelem(CW_MSG_CHANGE_STATE_EVENT_REQUEST,type,msgelem,len);
/* mandatory elements */
if (cw_readelem_result_code(&e->result_code,type,msgelem,len))
goto foundX;
if (cw_readelem_radio_operational_state(e->wtpinfo->radioinfo,type,msgelem,len))
goto foundX;
return 0;
foundX:
cw_mand_elem_found(e->mand,type);
return 1;
}
/**
* Read elements of a Change State Event Request message.
* @param wtpinfo wtpinfo where the results are stored.
* @param msg a pointer to the message
* @param len length of the message
* @return result code
*/
int cwread_change_state_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
{
int mand[] = {
CW_ELEM_RADIO_OPERATIONAL_STATE,
CW_ELEM_RESULT_CODE,
-1};
struct eparm eparm;
eparm.wtpinfo = wtpinfo;
eparm.mand=mand;
cw_dbg(DBG_ELEM,"Reading change state event request, len=%d",len);
cw_foreach_msgelem(msg,len,readelem,&eparm);
if (cw_is_missing_mand_elems(mand)){
char str[512];
cw_get_missing_mand_elems(str,mand);
cw_dbg(DBG_CW_RFC, "Missing msgelems in change state event request: %s",str);
}
return eparm.result_code;
}

View File

@ -1,95 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
* @brief Implents configuration status request
*/
#include <stdio.h>
#include "capwap.h"
#include "cw_log.h"
#include "cw_util.h"
struct eparm{
int * mand;
struct wtpinfo * wtpinfo;
};
static int readelem(void * eparm,int type,uint8_t* msgelem,int len)
{
struct eparm * e = (struct eparm*)eparm;
cw_dbg_msgelem(CW_MSG_CONFIGURATION_STATUS_REQUEST, type, msgelem,len);
/* mandatory elements */
/* ac name */
if (cw_readelem_ac_name(&e->wtpinfo->ac_name,type,msgelem,len))
goto foundX;
/* radio administrative state */
if (cw_readelem_radio_administrative_state(e->wtpinfo->radioinfo, type,msgelem,len))
goto foundX;
/* statistics timer */
if (cw_readelem_statistics_timer(&e->wtpinfo->statistics_timer, type,msgelem,len))
goto foundX;
/* reboot statistics */
if (cw_readelem_wtp_reboot_statistics(&e->wtpinfo->reboot_statistics,type,msgelem,len))
goto foundX;
/* non-mantatory elements */
if (cw_readelem_vendor_specific_payload
(e->wtpinfo, CW_MSG_CONFIGURATION_STATUS_REQUEST, type, msgelem, len))
return 1;
return 0;
foundX:
cw_mand_elem_found(e->mand,type);
return 1;
}
void cwread_configuration_status_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
{
int mand[] = {
CW_ELEM_AC_NAME,
CW_ELEM_WTP_REBOOT_STATISTICS,
CWMSGELEM_RADIO_ADMINISTRATIVE_STATE,
CW_ELEM_STATISTICS_TIMER,
-1};
struct eparm eparm;
eparm.wtpinfo = wtpinfo;
eparm.mand=mand;
cw_dbg(DBG_ELEM,"Reading configuration status request, len=%d",len);
cw_foreach_msgelem(msg,len,readelem,&eparm);
if (cw_is_missing_mand_elems(mand)){
char str[512];
cw_get_missing_mand_elems(str,mand);
cw_dbg(DBG_CW_RFC, "Missing msgelems in configuration status request: %s",str);
}
}

View File

@ -1,67 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include "capwap.h"
#include "acinfo.h"
#include "cw_log.h"
#include "cw_util.h"
static int acinfo_readelem_join_resp(void * a,int type,uint8_t* msgelem,int len)
{
cw_dbg_msgelem(CW_MSG_JOIN_RESPONSE, type, msgelem, len);
struct ac_info * acinfo = (struct ac_info *)a;
// cw_log_debug1("Process join resp msgelem, type=%d, len=%d\n",type,len);
if (cw_readelem_result_code(&acinfo->result_code,type,msgelem,len))
goto foundX;
if (acinfo_readelem_ecn_support(acinfo,type,msgelem,len))
goto foundX;
if (cw_readelem_ac_descriptor(acinfo,type,msgelem,len))
goto foundX;
if (acinfo_readelem_ac_name(acinfo,type,msgelem,len))
return 1;
if (acinfo_readelem_ctrl_ip_addr(acinfo,type,msgelem,len))
return 1;
/* if (acinfo_readelem_cw_local_ip_addr(acinfo,type,msgelem,len))
return 1;
*/
return 0;
foundX:
return 1;
}
void cwread_join_response(struct ac_info * acinfo, uint8_t * msg, int len)
{
// cw_log_debug1("Reading join response");
cw_foreach_msgelem(msg,len,acinfo_readelem_join_resp,acinfo);
}