Not needed anymore
FossilOrigin-Name: 3da1e976b5e27b351c9ae756fcf18316e5dcfc7fa9f7233278e2341a40fb09aa
This commit is contained in:
parent
89e80e0a44
commit
1caf8d1ef9
@ -1,10 +0,0 @@
|
||||
|
||||
#include "capwap.h"
|
||||
|
||||
void cwmsg_addelem_result_code(struct cwmsg *msg,int rc)
|
||||
{
|
||||
uint8_t c[4];
|
||||
*((uint32_t*)c)= htonl(rc);
|
||||
cwmsg_addelem(msg,CW_ELEM_RESULT_CODE,c,4);
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "capwap.h"
|
||||
#include "bstr.h"
|
||||
|
||||
|
||||
static int add_board_data_subelem(uint8_t *msg,int type, bstr_t data)
|
||||
{
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
|
||||
int l = bstr_len(data);
|
||||
*((uint32_t *) (msg)) = htonl(type << 16 | l);
|
||||
memcpy(msg + 4, bstr_data(data), l);
|
||||
return l+4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cwmsg_addelem_wtp_board_data(struct cwmsg *cwmsg, struct wtpinfo *wtpinfo)
|
||||
{
|
||||
uint8_t msg[1024];
|
||||
|
||||
/* vendor identifier */
|
||||
*((uint32_t *) msg) = htonl(wtpinfo->vendor_id);
|
||||
|
||||
int len = 4;
|
||||
|
||||
/* mandatory sub-elements */
|
||||
|
||||
|
||||
len += add_board_data_subelem(msg+len,CWBOARDDATA_MODELNO,wtpinfo->model_no);
|
||||
|
||||
len += add_board_data_subelem(msg+len,CWBOARDDATA_SERIALNO,wtpinfo->serial_no);
|
||||
|
||||
|
||||
/* other sub-elements */
|
||||
|
||||
len += add_board_data_subelem(msg+len,CWBOARDDATA_BOARDID,wtpinfo->board_id);
|
||||
|
||||
len += add_board_data_subelem(msg+len,CWBOARDDATA_REVISION,wtpinfo->board_revision);
|
||||
|
||||
|
||||
|
||||
if (wtpinfo->macaddress) {
|
||||
*((uint32_t *) (msg + len)) =
|
||||
htonl(CWBOARDDATA_MACADDRESS << 16 | wtpinfo->macaddress_len);
|
||||
memcpy(msg + len + 4, wtpinfo->macaddress, wtpinfo->macaddress_len);
|
||||
len += wtpinfo->macaddress_len + 4;
|
||||
}
|
||||
|
||||
cwmsg_addelem(cwmsg, CW_ELEM_WTP_BOARD_DATA, msg, len);
|
||||
}
|
@ -1,53 +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"
|
||||
|
||||
/*
|
||||
* for each capwap message element in msgelems call the callback function
|
||||
*/
|
||||
int process_msgelems(uint8_t * msgelems, int len,
|
||||
int (*callback)(void*,int,uint8_t*,int),void *arg )
|
||||
{
|
||||
// printf("NUNU %08X\n",msgelems);
|
||||
|
||||
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("Error AAA");
|
||||
// exit(88);
|
||||
return 0;
|
||||
}
|
||||
|
||||
callback(arg,type,msgelems+i+4,elen);
|
||||
// process_joinmsgelem(wtpman,msgelems+i+4,type,elen);
|
||||
// printf("type %d, len %d\n",type,elen);
|
||||
i+=elen+4;
|
||||
// printf("I %d, len %d\n",i,len);
|
||||
|
||||
} while (i<len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user