Work in progress ...
FossilOrigin-Name: 33e1ed226e6651e85e45bdc2f54c9e0b616d51b13ec76d2df0e01c22ded791e6
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
CC=clang
|
||||
ifndef CC
|
||||
CC=gcc
|
||||
endif
|
||||
@ -81,7 +82,6 @@ CAPWAPOBJS= \
|
||||
cwread_discovery_response.o \
|
||||
cwsend_discovery_request.o \
|
||||
cwread_image_data_request.o \
|
||||
cwsend_image_data_request.o \
|
||||
cwsend_image_data_response.o \
|
||||
cwsend_join_request.o \
|
||||
cwsend_join_response.o \
|
||||
@ -122,8 +122,10 @@ CAPWAPOBJS= \
|
||||
cw_readelem_radio_operational_state.o \
|
||||
cw_readelem_statistics_timer.o \
|
||||
cw_readelem_wtp_reboot_statistics.o\
|
||||
cwmsg_addelem_vendor_cisco_ap_timesync.o
|
||||
cwmsg_addelem_vendor_cisco_ap_timesync.o \
|
||||
lw_checksum.o
|
||||
|
||||
# cwsend_image_data_request.o
|
||||
|
||||
|
||||
# cwmsg_set_control_header.o
|
||||
@ -154,7 +156,8 @@ CONNOBJS= conn.o \
|
||||
conn_get_message.o \
|
||||
conn_get_response.o \
|
||||
conn_prepare_configuration_update_request.o \
|
||||
conn_prepare_request.o
|
||||
conn_prepare_request.o \
|
||||
conn_prepare_image_data_request.o
|
||||
|
||||
|
||||
|
||||
|
@ -318,7 +318,7 @@ extern int wtpinfo_set_radioinfo(struct wtpinfo * wtpinfo,uint8_t *msgelem, int
|
||||
|
||||
struct image_data{
|
||||
uint8_t * data;
|
||||
int type;
|
||||
uint8_t type;
|
||||
int len;
|
||||
};
|
||||
|
||||
|
@ -169,9 +169,11 @@ void connlist_remove(struct connlist *cl,struct conn * conn);
|
||||
void connlist_destroy(struct connlist * cl);
|
||||
void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len);
|
||||
|
||||
|
||||
struct image_identifier;
|
||||
struct image_data;
|
||||
|
||||
extern void conn_prepare_request(struct conn * conn, int type);
|
||||
extern int conn_prepare_image_data_request(struct conn * conn, struct image_data *, struct image_identifier *id );
|
||||
|
||||
#define conn_is_error(conn) (conn->dtls_error)
|
||||
|
||||
|
@ -28,10 +28,10 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
*((uint32_t*)(acd+4))=htonl((acinfo->active_wtps<<16) | acinfo->max_wtps);
|
||||
*((uint32_t*)(acd+8))=htonl((acinfo->security<<24) | (acinfo->rmac<<16) | acinfo->dtls_policy );
|
||||
|
||||
|
||||
int len = 12;
|
||||
int sublen;
|
||||
|
||||
|
||||
sublen = 4;
|
||||
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
@ -39,18 +39,36 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
|
||||
len+=4;
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=3; len++;
|
||||
*(acd+len)=4; len++;
|
||||
*(acd+len)=1; len++;
|
||||
*(acd+len)=72; len++;
|
||||
/* *(acd+len)=5; len++;
|
||||
*(acd+len)=5; len++;
|
||||
*(acd+len)=6; len++;
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=8; len++;
|
||||
*/
|
||||
|
||||
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
len+=4;
|
||||
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
|
||||
len+=4;
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=3; len++;
|
||||
*(acd+len)=1; len++;
|
||||
*(acd+len)=72; len++;
|
||||
*(acd+len)=5; len++;
|
||||
*(acd+len)=6; len++;
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=8; len++;
|
||||
|
||||
|
||||
|
||||
|
||||
goto b;
|
||||
|
||||
/* software version subelement */
|
||||
|
||||
/* *((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
len+=4;
|
||||
sublen=strlen((const char*)acinfo->software_version);
|
||||
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
|
||||
@ -58,16 +76,16 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
memcpy(acd+len,acinfo->software_version,sublen);
|
||||
len+=sublen;
|
||||
|
||||
*/
|
||||
|
||||
/* hardware version subelement */
|
||||
/* *((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
len+=4;
|
||||
sublen=strlen((const char*)acinfo->hardware_version);
|
||||
*((uint32_t*)(acd+len))=htonl((4<<16)|sublen);
|
||||
len+=4;
|
||||
memcpy(acd+len,acinfo->hardware_version,sublen);
|
||||
len+=sublen;
|
||||
*/
|
||||
b:
|
||||
cwmsg_addelem(msg,CWMSGELEM_AC_DESCRIPTOR,acd,len);
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,20 @@
|
||||
/*
|
||||
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 "cwmsg.h"
|
||||
|
@ -16,6 +16,13 @@
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Defines cwread_change_state_even_request function.
|
||||
*
|
||||
* Full text
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "capwap.h"
|
||||
@ -48,7 +55,9 @@ foundX:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Read elements of a Change State Event Request message.
|
||||
*/
|
||||
int cwread_change_state_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
|
||||
{
|
||||
int mand[] = {
|
||||
|
@ -32,7 +32,8 @@ static int readelem(void * eparm,int type,uint8_t* msgelem,int len)
|
||||
{
|
||||
|
||||
struct eparm * e = (struct eparm*)eparm;
|
||||
cw_dbg(DBG_CW_MSGELEM,"Reading conf staus req msgelem, type=%d - %s ,len=%d\n",type,cw_msgelemtostr(type),len);
|
||||
// cw_dbg(DBG_CW_MSGELEM,"Reading conf staus req msgelem, type=%d - %s ,len=%d\n",type,cw_msgelemtostr(type),len);
|
||||
cw_dbg_msgelem(CWMSG_CONFIGURATION_STATUS_REQUEST, type, msgelem,len);
|
||||
|
||||
/* mandatory elements */
|
||||
if (cw_readelem_ac_name(&e->wtpinfo->ac_name,type,msgelem,len))
|
||||
|
@ -25,23 +25,23 @@ void cwsend_join_response(struct conn * conn,int seqnum, int rc, struct radioinf
|
||||
|
||||
|
||||
|
||||
// uint8_t buffer[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
// buffer[0]=0; /* Mwar Type */
|
||||
// buffer[1]=1; /* h/w version */
|
||||
// buffer[2]=2; /* h/w Release */
|
||||
// buffer[3]=0; /* h/w Maint */
|
||||
// buffer[4]=3; /* h/w Build */
|
||||
uint8_t buffer[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
buffer[0]=0; /* Mwar Type */
|
||||
buffer[1]=1; /* h/w version */
|
||||
buffer[2]=2; /* h/w Release */
|
||||
buffer[3]=0; /* h/w Maint */
|
||||
buffer[4]=3; /* h/w Build */
|
||||
|
||||
// buffer[5]=5; /* s/w version */
|
||||
// buffer[6]=0; /* s/w Release */
|
||||
// buffer[7]=19; /* s/w Maint */
|
||||
// buffer[8]=3; /* s/w Build */
|
||||
buffer[5]=5; /* s/w version */
|
||||
buffer[6]=0; /* s/w Release */
|
||||
buffer[7]=19; /* s/w Maint */
|
||||
buffer[8]=3; /* s/w Build */
|
||||
|
||||
// *((uint16_t*)(buffer+9))=htons(13); /* Active MS */
|
||||
// *((uint16_t*)(buffer+9+2))=htons(23); /* Supported MS */
|
||||
// *((uint16_t*)(buffer+9+4))=htons(5); /* Active RAD's */
|
||||
// *((uint16_t*)(buffer+9+6))=htons(15); /* Supported RAD's */
|
||||
// cwmsg_addelem_vendor_specific_payload(cwmsg,CW_VENDOR_ID_CISCO, 205, buffer,4);
|
||||
*((uint16_t*)(buffer+9))=htons(13); /* Active MS */
|
||||
*((uint16_t*)(buffer+9+2))=htons(23); /* Supported MS */
|
||||
*((uint16_t*)(buffer+9+4))=htons(5); /* Active RAD's */
|
||||
*((uint16_t*)(buffer+9+6))=htons(15); /* Supported RAD's */
|
||||
cwmsg_addelem_vendor_specific_payload(cwmsg,CW_VENDOR_ID_CISCO, CWVENDOR_CISCO_MWAR, buffer,34);
|
||||
|
||||
|
||||
conn_send_response(conn,cwmsg,seqnum);
|
||||
|
@ -21,11 +21,16 @@
|
||||
/**
|
||||
* Calculate the 16-bit checksum for LWAPP image data message
|
||||
* elements with opcode 3 - used by Cisco also in CAPWAP
|
||||
* (But it's not always correct, the real algo might be another)
|
||||
*/
|
||||
uint16_t lw_checksum(uint8_t * d, int len)
|
||||
{
|
||||
int i;
|
||||
uint32_t cs = 0xffff;
|
||||
// uint32_t cs = 0xffff;
|
||||
if (len==0)
|
||||
return 0xffff;
|
||||
|
||||
uint32_t cs = 0;
|
||||
for (i = 0; i < len; i += 2) {
|
||||
uint16_t w = d[i] << 8;
|
||||
|
||||
@ -36,5 +41,9 @@ uint16_t lw_checksum(uint8_t * d, int len)
|
||||
cs += cs >> 16;
|
||||
cs &= 0xffff;
|
||||
}
|
||||
return (uint16_t) cs;
|
||||
return (uint16_t) cs&0xffff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user