📄 udpgram.cpp
字号:
// UDPGram.cpp: implementation of the UDPGram class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "snifferpro.h"
#include "UDPGram.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
UDPGram::UDPGram()
{
}
UDPGram::UDPGram(const unsigned char *buf,const int buflen)
{
//char *buf=new char[bufferlen];
//int len=bufferlen;
unsigned char *pos;
//memcpy(buf,buffer,bufferlen);
pos=(unsigned char *)buf;
srcport=(*pos)*0x100+(*(pos+1));
pos+=2;
destport=(*pos)*0x100+(*(pos+1));
pos+=2;
totallen=(*pos)*0x100+(*(pos+1));
pos+=2;
checksum=(*pos)*0x100+(*(pos+1));
datalen=buflen-8;
if(datalen>0){
data=new char[datalen];
memcpy(data,buf+8,datalen);
}
else
data=NULL;
//delete[] buf;
}
UDPGram::~UDPGram()
{
if(data!=NULL)
delete[] data;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -