全文预览

IP数据包解析计算机网络课程设计

上传者:你的雨天 |  格式:doc  |  页数:16 |  大小:152KB

文档介绍
FragOff;?};?BYTETimeToLive;?BYTEProtocol;?WORDHdrChksum;?DWORDSrcAddr;?DWORDDstAddr;?BYTEOptions;}IP_HEADER;//逐位解析IP头中的信息,获取版本号voidgetVersion(BYTEb,BYTE&version){?version=b>>4;}voidgetIHL(BYTEb,BYTE&result){?result=(b&0x0f)*4;}//解析服务类型char*parseServiceType_getProcedence(BYTEb){?switch(b>>5){ case7: workControl"; case6: return"workControl"; case5: return"CRITIC/ECP"; case4: return"FlashOverride"; case3: return"Falsh"; case2: return"Immediate"; case1: return"Priority"; case0: return"Routine"; default: return"Unknown";?}}char*parseServiceType_getTOS(BYTEb){?b=(b>>1)&0x0f;?switch(b){ case0: return"Normalservice";case1: return"arycost"; case2: return"Maximizereliability"; case4: return"Maximizethroughput"; case8: return"Minimizedelay"; case15: return"Maximizesecurity"; default: return"Unknown";

收藏

分享

举报
下载此文档