Dbg functions added.

FossilOrigin-Name: 76bf8637d6a0a5763f3113a89acd5b72e64466dfeb7bb7d23e223cf2716e767e
This commit is contained in:
7u83@mail.ru 2014-08-15 20:16:13 +00:00
parent c5f9345a0f
commit f5d2b3dd95
1 changed files with 32 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#include "conn.h"
#include "capwap.h"
#include "cw_log.h"
int conn_send_cwmsg(struct conn * conn, struct cwmsg * cwmsg)
{
uint32_t val;
@ -62,7 +64,17 @@ int conn_send_cwmsg(struct conn * conn, struct cwmsg * cwmsg)
// printf("Offset = %d\n",fragoffset);
// if (conn_send_packet(conn,ptr,mtu)<0)
// return -1;
// return -1;
{
char h[1024];
hdr_print(h,ptr,mtu);
cw_dbg(DBG_ALL,"Sending packet:\n%s",h);
}
cw_dbg_dmp(DBG_ALL,ptr,mtu,"Sending packet (mtu) ...");
if (conn->write(conn,ptr,mtu)<0)
return -1;
@ -80,11 +92,15 @@ int conn_send_cwmsg(struct conn * conn, struct cwmsg * cwmsg)
val = (preamble << 24) | ((hlen/4)<<19) | (cwmsg->rid<<14) |(wbid<<9) |
/*CWTH_FLAGS_T|*/ cwmsg->flags;
//printf("VAL = %08x, %08x\n",val,cwmsg->flags);
//printf("FRag offset :::::::::::::::::::::::::::: %d\n",fragoffset);
if (fragoffset){
val |= CWTH_FLAGS_F | CWTH_FLAGS_L;
}
// printf("Setting first byte %08X\n",val);
*((uint32_t*)ptr)=htonl(val);
@ -92,6 +108,20 @@ int conn_send_cwmsg(struct conn * conn, struct cwmsg * cwmsg)
val = conn->fragid<<16 | fragoffset<<3;
*((uint32_t*)(ptr+4))=htonl(val);
//int ii;
//for (ii=0; ii<4; ii++){
// printf("%02X ",ptr[ii]);
//}
//printf("\n");
{
char h[1024];
hdr_print(h,ptr,msglen-fragoffset*8+hlen);
cw_dbg(DBG_ALL,"Sending packet (nomutu):\n%s",h);
}
cw_dbg_dmp(DBG_ALL,ptr,msglen-fragoffset*8+hlen,"Sending packet (no mtu) ...");
return conn->write(conn,ptr,msglen-fragoffset*8+hlen);
}