Working ...

FossilOrigin-Name: 0b484bb6111d188fefc9543e9c09e9b4e1e15aac6877dc4d23d48163f9d22f26
This commit is contained in:
7u83@mail.ru 2014-08-26 05:42:56 +00:00
parent e509c8ccce
commit c576a8d722
5 changed files with 33 additions and 11 deletions

View File

@ -1,5 +1,5 @@
#ifndef __WTPLIST_H
#define __WPTLIST_H
#define __WTPLIST_H
#include <sys/socket.h>

View File

@ -18,6 +18,9 @@
#include "capwap.h"
#include "lwapp.h"
#include "string.h" //tube
/*
static void cwmsg_addelem_image_data(struct cwmsg *cwmsg, struct image_data *data)
{
@ -36,7 +39,8 @@ int conn_prepare_image_data_request(struct conn * conn, struct image_data * data
//uint8_t buf[1024];
//memset(buf,0xff,1024);
uint8_t type=3;
@ -51,6 +55,7 @@ int conn_prepare_image_data_request(struct conn * conn, struct image_data * data
&checksum,2,
// d, sizeof(d)
data->data, data->len
// buf,1024
);

View File

@ -38,10 +38,10 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
len+=4;
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
len+=4;
*(acd+len)=7; len++;
*(acd+len)=4; len++;
*(acd+len)=1; len++;
*(acd+len)=5; len++;
*(acd+len)=0; len++;
*(acd+len)=72; len++;
*(acd+len)=71; len++;
*(acd+len)=5; len++;
*(acd+len)=6; len++;
*(acd+len)=7; len++;

View File

@ -30,9 +30,7 @@ struct eparm{
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_msgelem(CWMSG_CONFIGURATION_STATUS_REQUEST, type, msgelem,len);
/* mandatory elements */

View File

@ -23,11 +23,11 @@
* 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)
uint16_t lw1_checksum(uint8_t * d, int len)
{
int i;
// uint32_t cs = 0xffff;
if (len==0)
// uint32_t cs = 0xffff;
if (len == 0)
return 0xffff;
uint32_t cs = 0;
@ -41,9 +41,28 @@ uint16_t lw_checksum(uint8_t * d, int len)
cs += cs >> 16;
cs &= 0xffff;
}
return (uint16_t) cs&0xffff;
return (uint16_t) cs & 0xffff;
}
uint16_t lw_checksum(uint8_t * d, int len)
{
int i;
// uint32_t cs = 0xffff;
if (len == 0)
return 0xffff;
uint32_t cs = 0x0;
for (i = 0; i < len; i += 2) {
cs += (cs >> 16);
cs &= 0xffff;
uint16_t w = d[i] << 8;
if (i + 1 < len)
w |= d[i + 1];
cs += w ^= 0xffff;
}
cs += (cs >> 16);
return (uint16_t) cs & 0xffff;
}