資源描述:
《產(chǎn)品概念報告與設(shè)計》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、ARP分析報告目錄ARP分析報告目錄ARP分析報告第三章4.4BSD-Lite與FreeBSD5.0區(qū)別第一章ARP數(shù)據(jù)結(jié)構(gòu)和狀態(tài)機(jī)11.1ARP數(shù)據(jù)包格式和數(shù)據(jù)結(jié)構(gòu)11.2ARP狀態(tài)機(jī)2第二章ARP流程42.1總體流程42.2ARP接口52.2.1數(shù)據(jù)接口52.2.2與OS接口62.3輸入流程72.3.1arpintr72.3.2in_arpinput72.4請求解析流程82.4.1arpresolve82.4.2arprequest102.5超時檢測流程102.5.1arptimer102.5
2、.2arptfree10第三章4.4BSD-Lite與FreeBSD5.0區(qū)別123.1定義結(jié)構(gòu)區(qū)別123.2函數(shù)參數(shù)區(qū)別123.2.1arprequest函數(shù)123.2.2arpresolve函數(shù)133.2.3arp_rtrequest函數(shù)143.3其他區(qū)別14第15頁共15頁ARP分析報告第三章4.4BSD-Lite與FreeBSD5.0區(qū)別第一章ARP數(shù)據(jù)結(jié)構(gòu)和狀態(tài)機(jī)1.1ARP數(shù)據(jù)包格式和數(shù)據(jù)結(jié)構(gòu)以下是ARP分組的報文格式:以太網(wǎng)幀首部結(jié)構(gòu)ether_header如下:structethe
3、r_header{u_int8_tether_dhost[6];/*Ethernetdestinationaddress*/u_int8_tether_shost[6];/*Ethernetsourceaddress*/u_int16_tether_type;/*Ethernetframetype*/};其中幀類型ether_type有IP(0x0800)、XEROX_PUP(0x0200)、(ARP,0x0806),將來可能還有所擴(kuò)展。結(jié)構(gòu)arphdr定義了其后的5個字段,其信息用于在任何類型的
4、介質(zhì)上傳送ARP請求和回答:structarphdr{u_shortar_hrd;/*formatofhardwareaddress*/u_shortar_pro;/*formatofprotocoladdress*/u_charar_hln;/*lengthofhardwareaddress*/u_charar_pln;/*lengthofprotocoladdress*/u_shortar_op;/*ARP/RARPoperation*/};操作類型ar_op有ARP請求(1)、ARP應(yīng)答(2
5、)、RARP請求(3)、RARP應(yīng)答(4)。ether_arp結(jié)構(gòu)除了包含arphdr結(jié)構(gòu)外,還包含源主機(jī)和目的主機(jī)的地址:structether_arp{structarphdrea_hdr;/*fixed-sizeheader*/u_chararp_sha[6];/*senderhardwareaddress*/u_chararp_spa[4];/*senderprotocoladdress*/u_chararp_tha[6];/*targethardwareaddress*/u_charar
6、p_tpa[4];/*targetprotocoladdress*/};第15頁共15頁ARP分析報告第三章4.4BSD-Lite與FreeBSD5.0區(qū)別#definearp_hrdea_hdr.ar_hrd#definearp_proea_hdr.ar_pro#definearp_hlnea_hdr.ar_hln#definearp_plnea_hdr.ar_pln#definearp_opea_hdr.ar_op每個ARP結(jié)點使用一個llinfo_arp結(jié)構(gòu)存儲ARP結(jié)點的一些簡要信息。所有
7、這些結(jié)構(gòu)組成的鏈接表通常稱為ARP高速緩存,鏈表的頭結(jié)點是作為全局變量分配的。以下是llinfo_arp結(jié)構(gòu):structllinfo_arp{structllinfo_arp*la_next;structllinfo_arp*la_prew;structrtentry*la_rt;structmbuf*la_hold;/*lastpacketuntilresolved/timeout*/longla_asked;/*#timeswe’veQUERIEDforthisaddr*/};#define
8、la_timerla_rt->rt_rmx.rmx_expire/*deletiontimeinseconds*/la_rt指向相關(guān)的路由表結(jié)點,該路由表結(jié)點的rt_llinfo成員指向la_rt。ARP的信息關(guān)聯(lián)于路由表結(jié)點中的相關(guān)部分。la_hold用于沒有收到ARP應(yīng)答以前的保持最后一個IP報文。la_asked記錄了連續(xù)為某個IP地址發(fā)送請求而沒有收到回答的次數(shù)。當(dāng)這個數(shù)值達(dá)到某個限定值(一般為5)時,就認(rèn)為該主機(jī)是關(guān)閉的,并在其后一段時間內(nèi)不再發(fā)送該主機(jī)的ARP請求。最后