freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

解析arp數(shù)據(jù)包計(jì)算機(jī)網(wǎng)絡(luò)與通信課程設(shè)計(jì)(編輯修改稿)

2024-07-13 05:16 本頁面
 

【文章內(nèi)容簡介】 net卡 for(d=alldevs。d。d=dnext) { //以混雜模式打開網(wǎng)卡,以接受所有的幀 if((adhandle=pcap_open_live(dname,1000,1,300,errbuf))==NULL) { cout\nUnable to open the adapter.。 pcap_freealldevs(alldevs)。 //釋放設(shè)備列表 return。 } if(pcap_datalink(adhandle)==DLT_EN10MBamp。amp。daddresses!=NULL) break。 }l 編譯過濾器并設(shè)置過濾器,只捕獲ARP數(shù)據(jù)包c(diǎn)har packet_filter[]=”ether proto \\arp”。 //過濾,選擇arp協(xié)議if(pcap_pile(adhandle,amp。fcode,packet_filter,1,netmask)0){ cout\nUnable to pile the packet the syntax.\n。 pcap_freealldevs(alldevs)。 return。}//設(shè)置過濾器if(pcap_setfilter(adhandle,amp。fcode)0){ cout\nError setting the filter.\n。 pcap_freealldevs(alldevs)。 return。}l 循環(huán)捕獲ARP包,并進(jìn)行解析while((result=pcap_next_ex(adhandle,amp。header,amp。pkt_data))=0){ 輸出ARP數(shù)據(jù)包的各個(gè)域的內(nèi)容到文件和屏幕上 }l 源程序includepragma ment(lib,) //用到ntobs()//等同于點(diǎn)擊projectsettinglink打開object/library module編輯框后加入文件pragma ment(lib,)include //此頭文件沒有包含在VC中,需要另外加入includeinclude //格式化輸出需要用到include //用到_getch() //注意到接收的數(shù)據(jù)包頭中代表類型,數(shù)據(jù)長度的字段采用的是bigendian //所以對(duì)于2B/4B的數(shù)據(jù)要用ntohs()轉(zhuǎn)換為本機(jī)形式 //ARP包結(jié)構(gòu)struct arppkt{ unsigned short hdtyp。 // unsigned short protyp。 unsigned char hdsize。 unsigned char prosize。 unsigned short op。 u_char smac[6]。 u_char sip[4]。 u_char dmac[6]。 u_char dip[4]。}。void packet_handler(const pcap_pkthdr *header,const u_char *pkt_data,ostreamamp。 out)。void main(int argc,char *argv[ ]){ if(argc!=2) { coutUsage:arpparse logfilenameendl。 coutpress any key to continue.endl。 _getch()。 return。 } pcap_if_t *alldevs。 pcap_if_t *d。 pcap_t *adhandle。 char errbuf[PCAP_ERRBUF_SIZE]。 u_int netmask。 char packet_filter[]=ether proto \\arp。 struct bpf_program fcode。 struct pcap_pkthdr *header。 const u_char *pkt_data。 if(pcap_findalldevs(amp。alldevs,errbuf)==1) { coutError in pcap_findalldevs:errbuf。 return。 } for(d=al
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1