91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.66MB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2023-10-31
  • 語言: C/C++
  • 標簽: 幀結構??32位校驗??

資源簡介

Ethernet 幀結構解析程序,用C++的

資源截圖

代碼片段和文件信息


/*I?declare?that?the?assignment?here?submitted?is?original?except?for?source?material?explicitly?acknowledged.?
I?also?acknowledge?that?I?am?aware?of?University?policy?and?regulations?on?honesty?in?academic?work?and?of?the?disciplinary?guidelines?and?procedures?applicable?to?breaches?of?such?policy?and?regulations.?
This?asignment?was?finished?under?the?help?of?jianghongmin?.


黃晨晨 ???????????????2012年9月23日
Signature Date

黃晨晨 ??????????123520081202005
Name Student?ID

CS400____ Advanced?Windows?Network?Programming
Course?code Course?title
*/








#include?
#include?
#include?
using?namespace?std;
/*ulPolynomial?=?0x04c11db7*/
unsigned?long?crc32_table[256];?
//字節bit交換(0?-7)(1-6)...
unsigned?long?Reflect(unsigned?long?ref?char?ch);
//?創建查表數組
void?Init_CRC32_Table();

unsigned?long?GetCRC32(?char?*szData?unsigned?long?dwSize);


void?main(int?argc?char*?argv[])
{
//?檢測命令行參數的正確性
if?(argc?!=?2)
{
cout?< exit(0);
}
//?檢測輸入文件是否存在,并可以按所需的權限和方式打開
ifstream?file;

//file.open(“E:\\testframe“ios::in|ios::binary|ios::_Nocreate);
file.open(argv[1]?ios::in|ios::binary|ios::_Nocreate);
if?(!file.is_open())
{
cout?< exit(0);
}

Init_CRC32_Table();


//?變量聲明及初始化
int?nSN?=?1; //?幀序號
int?nCheck?=?0; //?校驗碼
int?nCurrDataOffset?=?22; //?幀頭偏移量
int?nCurrDataLength?=?0; //?數據字段長度
bool?bParseCont?=?true; //?是否繼續對輸入文件進行解析
int?nFileEnd?=?0; //?輸入文件的長度


//?計算輸入文件的長度
file.seekg(0?ios::end); //?把文件指針移到文件的末尾
nFileEnd?=?file.tellg(); //?取得輸入文件的長度
file.seekg(0?ios::beg); //?文件指針位置初始化

cout.fill(‘0‘); //?顯示初始化
cout.setf(ios::uppercase); //?以大寫字母輸出




//?定位到輸入文件中的第一個有效幀
//?從文件頭開始,找到第一個連續的“AA-AA-AA-AA-AA-AA-AA-AB”
while?(?true?)
{
for?(int?j?=?0;?j? {
if?(file.tellg()?>=?nFileEnd) //?安全性檢測
{
cout<<“沒有找到合法的幀“< file.close();
exit(0);
}
//?看當前字符是不是0xaa,如果不是,則重新尋找7個連續的0xaa
if?(file.get()?!=?0xaa)
{
j?=?-1;
}
}

if?(file.tellg()?>=?nFileEnd) //?安全性檢測
{
cout<<“沒有找到合法的幀“< file.close();
exit(0);
}

if?(file.get()?==?0xab) //?判斷7個連續的0xaa之后是否為0xab
{
break;
}
}


file.seekg(-8ios::cur);


//?主控循環

while?(?bParseCont?)?//?當仍然可以繼續解析輸入文件時繼續解析
{
//?將數據字段偏移量定位在上述二進制串之后14字節處,并準備進入解析階段
nCurrDataOffset?=?(int)file.tellg()?+?22;


//?檢測剩余文件是否可能包含完整幀頭
if?((int)file.tellg()?+?14?>?nFileEnd)//從目的地址到類型字段共14B
{
cout< file.close();
exit(0);
}

????int?c; //?讀入字節
int?i?=?0; //?循環控制變量
int?EtherType?=?0; //?由幀中讀出的類型字段
bool?bAccept?=?true; //?是否接受該幀


//?輸出幀的序號
cout?<ame#:\t\t“?<
//?輸出前導碼,只輸出,不校驗
cout?< for?(i?=?0;?i?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2282??2012-09-23?16:48??huangcc\huangcc\Debug\cl.command.1.tlog

?????文件??????16880??2012-09-23?16:48??huangcc\huangcc\Debug\CL.read.1.tlog

?????文件???????1496??2012-09-23?16:48??huangcc\huangcc\Debug\CL.write.1.tlog

?????文件???????3310??2012-09-23?14:20??huangcc\huangcc\Debug\huangcc.Build.CppClean.log

?????文件????????406??2012-09-23?14:23??huangcc\huangcc\Debug\huangcc.exe.embed.manifest

?????文件????????472??2012-09-23?16:48??huangcc\huangcc\Debug\huangcc.exe.embed.manifest.res

?????文件????????381??2012-09-23?16:48??huangcc\huangcc\Debug\huangcc.exe.intermediate.manifest

?????文件????????114??2012-09-23?16:48??huangcc\huangcc\Debug\huangcc.lastbuildstate

?????文件???????2854??2012-09-23?16:48??huangcc\huangcc\Debug\huangcc.log

?????文件????????204??2012-09-23?14:20??huangcc\huangcc\Debug\huangcc_manifest.rc

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.6936-cvtres.read.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.6936-cvtres.write.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.6936.read.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.6936.write.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.7828-cvtres.read.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.7828-cvtres.write.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.7828.read.1.tlog

?????文件??????????2??2012-09-23?16:48??huangcc\huangcc\Debug\link.7828.write.1.tlog

?????文件???????3562??2012-09-23?16:48??huangcc\huangcc\Debug\link.command.1.tlog

?????文件???????6218??2012-09-23?16:48??huangcc\huangcc\Debug\link.read.1.tlog

?????文件???????2226??2012-09-23?16:48??huangcc\huangcc\Debug\link.write.1.tlog

?????文件????????886??2012-09-23?16:48??huangcc\huangcc\Debug\mt.command.1.tlog

?????文件????????874??2012-09-23?16:48??huangcc\huangcc\Debug\mt.read.1.tlog

?????文件????????390??2012-09-23?16:48??huangcc\huangcc\Debug\mt.write.1.tlog

?????文件?????207983??2012-09-23?16:48??huangcc\huangcc\Debug\parser.obj

?????文件?????207767??2012-09-23?14:44??huangcc\huangcc\Debug\praser.obj

?????文件???????1294??2012-09-23?16:48??huangcc\huangcc\Debug\rc.command.1.tlog

?????文件????????818??2012-09-23?16:48??huangcc\huangcc\Debug\rc.read.1.tlog

............此處省略19個文件信息

評論

共有 條評論