diff --git a/src/capwap/conn_send_cwmsg.c b/src/capwap/conn_send_cwmsg.c index b4f7a7e7..df903cbe 100644 --- a/src/capwap/conn_send_cwmsg.c +++ b/src/capwap/conn_send_cwmsg.c @@ -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); }