版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、簡(jiǎn)單路由器設(shè)計(jì)與實(shí)現(xiàn)(選做)1.實(shí)驗(yàn)?zāi)康氖煜げ⒄莆章酚善鞯墓ぷ髟?;熟悉winpcap編程,掌握數(shù)據(jù)包捕獲與發(fā)送的方法;在理解ip協(xié)議、icmp協(xié)議與路由基本工作原理的基礎(chǔ)上,完成一個(gè)(軟件)路由器基本功能的設(shè)計(jì)與編程實(shí)現(xiàn)。2.實(shí)驗(yàn)環(huán)境Ø 接入局域網(wǎng)的pc機(jī);Ø 操作系統(tǒng):windows xp, windows 7等;Ø 推薦開(kāi)發(fā)工具:visual studio 2010;Ø 推薦編程語(yǔ)言:c+/ visual c+;Ø 函數(shù)庫(kù)/開(kāi)發(fā)包:winpcap。3.實(shí)驗(yàn)內(nèi)容(1) 學(xué)習(xí)并掌握winpcap編程:自行完成winpcap教程中的內(nèi)容,從而掌
2、握winpcap編程。內(nèi)容包括但不限于:a) 獲取設(shè)備列表;b) 打開(kāi)一個(gè)適配器并抓包(分組);c) 解析分組;d) 發(fā)送分組;學(xué)習(xí)內(nèi)容及源程序參見(jiàn)winpcap官方教程:/docs/docs_412/html/group_wpcap_tut.html。(2) 利用winpcap開(kāi)發(fā)包實(shí)現(xiàn)簡(jiǎn)單路由程序,該路由程序應(yīng)該至少包括以下功能:a) ip數(shù)據(jù)包捕獲和轉(zhuǎn)發(fā);b) arp請(qǐng)求與解析;c) 重新計(jì)算ip數(shù)據(jù)包的頭部校驗(yàn)和;d) 處理ip數(shù)據(jù)包的頭部校驗(yàn)和;處理ip數(shù)據(jù)包的ttl值;e) 靜態(tài)路由表維護(hù)。在下圖所示的完了過(guò)拓?fù)浣Y(jié)構(gòu)中,當(dāng)所開(kāi)發(fā)的路由器程序
3、部署并運(yùn)行在計(jì)算機(jī)c上時(shí),它將(作為一個(gè)路由器)能夠連通兩個(gè)子網(wǎng),正確地捕獲、轉(zhuǎn)發(fā)來(lái)自計(jì)算機(jī)a和計(jì)算機(jī)b的分組,使得兩個(gè)子網(wǎng)中的主機(jī)能夠互相訪(fǎng)問(wèn)圖5-1 實(shí)驗(yàn)驗(yàn)證環(huán)境配置示意圖4.實(shí)驗(yàn)方式每位同學(xué)獨(dú)立上機(jī)編程實(shí)驗(yàn),實(shí)驗(yàn)指導(dǎo)教師現(xiàn)場(chǎng)指導(dǎo)。5.參考內(nèi)容(1) winpcap簡(jiǎn)介winpcap (windows packet capture)是windows平臺(tái)下一個(gè)免費(fèi)、公共的網(wǎng)絡(luò)訪(fǎng)問(wèn)系統(tǒng)。開(kāi)發(fā)winpcap項(xiàng)目的目的在于為win32應(yīng)用程序提供訪(fǎng)問(wèn)網(wǎng)絡(luò)底層的能力。它用于windows系統(tǒng)下的直接的網(wǎng)絡(luò)編程。關(guān)于winpcap的介紹請(qǐng)參閱winpcap開(kāi)發(fā)包可以在http:/www.winpcap
4、.org/上下載,winpcap的技術(shù)文檔可以從/docs/default.htm下載。附錄中給出了主要函數(shù)的說(shuō)明文檔。(2) winpcap主要函數(shù)及功能介紹winpcap部分主要函數(shù)及其功能介紹如下:(1).int pcap_findalldevs_ex(char * source, struct pcap_rmtauth * auth, pcap_if_t * alldevs, char * errbuf)函數(shù)功能:create a list of network devices that can be opened with pcap
5、_open().參數(shù)說(shuō)明:source:a char* buffer that keeps the 'source localtion', according to the new winpcap syntax. this source will be examined looking for adapters (local or remote) or pcap files,the strings that must be prepended to the 'source' in order to define if we want local/remote a
6、dapters or files is defined in the new source specification syntax .auth:a pointer to a pcap_rmtauth structure. this pointer keeps the information required to authenticate the rpcap connection to the remote host. this parameter is not meaningful in case of a query to the local host: in that case it
7、can be null.alldevs:a 'struct pcap_if_t' pointer, which will be properly allocated inside this function. when the function returns, it is set to point to the first element of the interface list; each element of the list is of type 'struct pcap_if_t'.errbuf: a pointer to a user-alloca
8、ted buffer (of size pcap_errbuf_size) that will contain the error message (in case there is one).返回值:'0' if everything is fine, '-1' if some errors occurred. the list of the devices is returned in the 'alldevs' variable. when the function returns correctly, 'alldevs'
9、cannot be null. in other words, this function returns '-1' also in case the system does not have any interface to list.(2).void pcap_freealldevs_ex(pcap_if_t * alldevsp)函數(shù)功能:free an interface list returned by pcap_findalldevs().(3).pcap_t* pcap_open(const char * source, int snaplen, int flag
10、s, int read_timeout, struct pcap_rmtauth * auth, char * errbuf)函數(shù)功能:open a generic source in order to capture / send (winpcap only) traffic.參數(shù)說(shuō)明:source:zero-terminated string containing the source name to open. the source name has to include the format prefix according to the new source specificatio
11、n syntax and it cannot be null.on on linux systems with 2.2 or later kernels, a device argument of "any" can be used to capture packets from all interfaces. in order to makes the source syntax easier, please remember that:the adapters returned by the pcap_findalldevs_ex() can be used immed
12、iately by the pcap_open()in case the user wants to pass its own source string to the pcap_open(), the pcap_createsrcstr() helps in creating the correct source identifier.snaplen:length of the packet that has to be retained. for each packet received by the filter, only the first 'snaplen' byt
13、es are stored in the buffer and passed to the user application. for instance, snaplen equal to 100 means that only the first 100 bytes of each packet are stored.flags:keeps several flags that can be needed for capturing packets. the allowed flags are defined in the pcap_open() flags .read_timeout:re
14、ad timeout in milliseconds. the read timeout is used to arrange that the read not necessarily return immediately when a packet is seen, but that it waits for some amount of time to allow more packets to arrive and to read multiple packets from the os kernel in one operation. not all platforms suppor
15、t a read timeout; on platforms that don't, the read timeout is ignored.auth:a pointer to a 'struct pcap_rmtauth' that keeps the information required to authenticate the user on a remote machine. in case this is not a remote capture, this pointer can be set to null.errbuf:a pointer to a u
16、ser-allocated buffer which will contain the error in case this function fails. the pcap_open() and findalldevs() are the only two functions which have this parameter, since they do not have (yet) a pointer to a pcap_t structure, which reserves space for the error string. since these functions do not
17、 have (yet) a pcap_t pointer (the pcap_t pointer is null in case of errors), they need an explicit 'errbuf' variable. 'errbuf' may also be set to warning text when pcap_open_live() succeds; to detect this case the caller should store a zero-length string in 'errbuf' before ca
18、lling pcap_open_live() and display the warning to the user if 'errbuf' is no longer a zero-length string.返回值: a pointer to a 'pcap_t' which can be used as a parameter to the following calls (pcap_compile() and so on) and that specifies an opened winpcap session. in case of probl
19、ems, it returns null and the 'errbuf' variable keeps the error message.(4). int pcap_next_ex(pcap_t * p, struct pcap_pkthdr * pkt_header, const u_char * pkt_data)函數(shù)功能:read a packet from an interface or from an offline capture.this function is used to retrieve the next available packet, bypas
20、sing the callback method traditionally provided by libpcap. pcap_next_ex fills the pkt_header and pkt_data parameters (see pcap_handler() with the pointers to the header and to the data of the next captured packet.返回值:the return value can be:1 if the packet has been read without problems0 if the tim
21、eout set with pcap_open_live() has elapsed. in this case pkt_header and pkt_data don't point to a valid packet-1 if an error occurred-2 if eof was reached reading from an offline capture(5). int pcap_compile(pcap_t * p, struct bpf_program * fp, char * str, int optimize, bpf_u_int32 netmask)函數(shù)功能:
22、compile a packet filter, converting an high level filtering expression (see filtering expression syntax) in a program that can be interpreted by the kernel-level filtering engine.(6). int pcap_setfilter(pcap_t * p, struct bpf_program * fp)函數(shù)功能:associate a filter to a capture. 此函數(shù)是要和函數(shù)pcap_compile()配
23、合使用。(7). int pcap_sendpacket(pcap_t * p, u_char * buf, int size)函數(shù)功能: send a raw packet.6.實(shí)驗(yàn)步驟6.1 winpcap開(kāi)發(fā)包安裝與配置下載、安裝winpcap開(kāi)發(fā)包,配置visualstudio 2010開(kāi)發(fā)環(huán)境。具體步驟請(qǐng)同學(xué)們參閱網(wǎng)上資料自行完成。6.2 用戶(hù)界面設(shè)計(jì)(1).首先打開(kāi)vs2010,新建工程,選擇mfc application,輸入工程名,點(diǎn)擊ok,圖5-2點(diǎn)擊next,選擇dialog based,點(diǎn)擊next跳到最后一個(gè)頁(yè)面選擇.dlg,點(diǎn)擊finish。圖5-3圖5-4到此為止工
24、程新建完畢,運(yùn)行會(huì)出現(xiàn)以下頁(yè)面,下面就為這個(gè)對(duì)話(huà)框拖拽控件。圖5-5首先將對(duì)話(huà)框上面的三個(gè)控件刪除,并拖拽相應(yīng)的控件得到如下效果:圖5-6圖5-7其中對(duì)話(huà)框可在resource view打開(kāi),控件在toolbox中可以找到,圖5-8其中啟動(dòng)、退出、添加路由、刪除路由為button控件,兩個(gè)空白區(qū)為list box,日志、路由表、子網(wǎng)掩碼、目的地址、下一跳步為static text,三個(gè)輸入ip的控件為ip address control,將控件拖拽到相應(yīng)的位置并且在控件的屬性框中修改控件的caption以及id。啟動(dòng)onstart_button退出onstop_button日志idc_stat
25、ic第一個(gè)空白區(qū)logger_list路由表idc_static第二個(gè)空白區(qū)router_list子網(wǎng)掩碼idc_static子網(wǎng)掩碼對(duì)應(yīng)的ip輸入?yún)^(qū)idc_netmask目的地址idc_static目的地址對(duì)應(yīng)的ip輸入?yún)^(qū)idc_ipaddress下一跳步idc_static下一跳步對(duì)應(yīng)的ip輸入?yún)^(qū)idc_nexthop添加路由add_router_button刪除路由delete_router_button6.3 代碼實(shí)現(xiàn)(1). 事件響應(yīng)函數(shù)及主流程控件添加完成后為button添加相應(yīng)的單擊事件并修改單擊事件名稱(chēng),對(duì)應(yīng)關(guān)系如下:?jiǎn)?dòng)onstartclickedbutton()退出onbn
26、clickedbutton()添加路由onaddrouterbutton()刪除路由ondeleterouterbutton()vc程序首先執(zhí)行程序初始化函數(shù)oninitdialog(),在此函數(shù)中我們獲取了mfc窗體指針。當(dāng)我們點(diǎn)擊“啟動(dòng)”按鈕時(shí),程序會(huì)執(zhí)行onstartclickedbutton()函數(shù),此函數(shù)流程圖如下圖所示:圖5-9當(dāng)我們點(diǎn)擊結(jié)束按鈕時(shí)程序會(huì)執(zhí)行onbnclickedbutton(),程序自動(dòng)退出。當(dāng)程序退出時(shí)會(huì)觸發(fā)on_wm_destroy()消息,從而會(huì)執(zhí)行ondestroy()函數(shù),并且程序在執(zhí)行過(guò)程中每隔一段時(shí)間會(huì)執(zhí)行ontimer()函數(shù)。(2). 主要數(shù)據(jù)結(jié)
27、構(gòu)和函數(shù)聲明首先將程序所用變量以及函數(shù)復(fù)制到vcrouterdlg.cpp文件中:#definemax_if5 / 最大接口數(shù)目#pragma pack(1)typedef struct frameheader_t / 幀首部 uchardesmac6; / 目的地址 ucharsrcmac6; / 源地址 ushortframetype; / 幀類(lèi)型 frameheader_t;typedef struct arpframe_t / arp幀frameheader_tframeheader; / 幀首部 wordhardwaretype; / 硬件類(lèi)型wordprotocoltype; /
28、協(xié)議類(lèi)型bytehlen; / 硬件地址長(zhǎng)度byteplen; / 協(xié)議地址長(zhǎng)度wordoperation; / 操作值ucharsendha6; / 源mac地址ulongsendip; / 源ip地址ucharrecvha6; / 目的mac地址ulongrecvip; / 目的ip地址 arpframe_t;typedef struct ipheader_t / ip首部bytever_hlen; / 版本+頭部長(zhǎng)度bytetos; / 服務(wù)類(lèi)型wordtotallen; / 總長(zhǎng)度wordid; / 標(biāo)識(shí)wordflag_segment; / 標(biāo)志+片偏移bytettl; / 生存時(shí)間
29、byteprotocol; / 協(xié)議wordchecksum; / 頭部校驗(yàn)和ulongsrcip; / 源ip地址ulongdstip; / 目的ip地址 ipheader_t;typedef struct icmpheader_t / icmp首部byte type; / 類(lèi)型byte code; / 代碼word checksum; / 校驗(yàn)和word id; / 標(biāo)識(shí)word sequence; / 序列號(hào) icmpheader_t;typedef struct ipframe_t / ip幀frameheader_tframeheader; / 幀首部ipheader_tiphead
30、er; / ip首部 ipframe_t;typedef struct ip_t / 網(wǎng)絡(luò)地址ulongipaddr; / ip地址ulongipmask; / 子網(wǎng)掩碼 ip_t;typedef struct ifinfo_t / 接口信息cstringdevicename; / 設(shè)備名cstringdescription; / 設(shè)備描述ucharmacaddr6; / mac地址carray <ip_t,ip_t&>ip; / ip地址列表pcap_t*adhandle; / pcap句柄 ifinfo_t;typedef struct sendpacket_t / 發(fā)
31、送數(shù)據(jù)包結(jié)構(gòu)intlen; / 長(zhǎng)度bytepktdata2000;/ 數(shù)據(jù)緩存ulongtargetip; / 目的ip地址uint_ptrn_mtimer; / 定時(shí)器uintifno; / 接口序號(hào) sendpacket_t;typedef struct routetable_t / 路由表結(jié)構(gòu)ulongmask; / 子網(wǎng)掩碼ulongdstip; / 目的地址ulongnexthop; / 下一跳步uintifno; / 接口序號(hào) routetable_t;typedef struct ip_mac_t / ip-mac地址映射結(jié)構(gòu)ulongipaddr; / ip地址ucharma
32、caddr6; / mac地址 ip_mac_t;/ 全局變量/*/ifinfo_tifinfomax_if; / 接口信息數(shù)組intifcount; / 接口個(gè)數(shù)uint_ptr timercount; / 定時(shí)器個(gè)數(shù)clist <sendpacket_t, sendpacket_t&> sp; / 發(fā)送數(shù)據(jù)包緩存隊(duì)列clist <ip_mac_t, ip_mac_t&> ip_mac; / ip-mac地址映射列表clist <routetable_t, routetable_t&> routetable; / 路由表cmyrou
33、terdlg *pdlg ; / 對(duì)話(huà)框指針cmutex mmutex(0,0,0); / 互斥/*/ 全局函數(shù)/*/ ip地址轉(zhuǎn)換cstring ipntoa(ulong nipaddr);/ mac地址轉(zhuǎn)換cstring macntoa(uchar *nmacaddr);/ mac地址比較bool cmpmac(uchar *mac1, uchar *mac2);/ mac地址復(fù)制void cpymac(uchar *mac1, uchar *mac2);/ mac地址設(shè)置void setmac(uchar *mac, uchar ch);/ ip地址查詢(xún)bool iplookup(ulo
34、ng ipaddr, uchar *p);/ 數(shù)據(jù)包捕獲線(xiàn)程uint capture(pvoid pparam);/ 獲取本地接口mac地址線(xiàn)程uint capturelocalarp(pvoid pparam);/ 發(fā)送arp請(qǐng)求void arprequest(pcap_t *adhandle, uchar *srcmac, ulong srcip, ulong targetip);/ 查詢(xún)路由表dword routelookup(uint &ifno, dword desip, clist <routetable_t, routetable_t&> *route
35、table);/ 處理arp數(shù)據(jù)包void arppacketproc(struct pcap_pkthdr *header, const u_char *pkt_data);/ 處理ip數(shù)據(jù)包void ippacketproc(ifinfo_t *pifinfo, struct pcap_pkthdr *header, const u_char *pkt_data);/ 處理icmp數(shù)據(jù)包void icmppacketproc(ifinfo_t *pifinfo, byte type, byte code, const u_char *pkt_data);/ 檢查ip數(shù)據(jù)包頭部校驗(yàn)和是否正確
36、int ischecksumright(char * buffer);/ 計(jì)算校驗(yàn)和unsigned short checksumcompute(unsigned short *buffer, int size);(3). 函數(shù)代碼實(shí)現(xiàn)/ 獲取本地接口mac地址線(xiàn)程uint capturelocalarp(pvoid pparam)intres;struct pcap_pkthdr*header;const u_char*pkt_data;ifinfo_t*pifinfo;arpframe_t*arpframe;cstringdisplaystr;pifinfo = (ifinfo_t *)p
37、param;while (true)sleep(50);res = pcap_next_ex( pifinfo->adhandle , &header, &pkt_data);/ 超時(shí) if (res = 0) continue; if (res > 0)arpframe = (arpframe_t *) (pkt_data);/ 得到本接口的mac地址if (arpframe->frameheader.frametype = htons(0x0806) && (arpframe->operation = htons(0x0002) &a
38、mp;& (arpframe->sendip = pifinfo->ip0.ipaddr) cpymac(pifinfo->macaddr, arpframe->sendha);return 0;void setmac(uchar *mac, uchar ch)for (int i=0; i<6; i+) maci = ch;return;/ 發(fā)送arp請(qǐng)求void arprequest(pcap_t *adhandle, uchar *srcmac, ulong srcip, ulong targetip)arpframe_tarpframe;inti;
39、for (i=0; i<6; i+)arpframe.frameheader.desmaci = 255;arpframe.frameheader.srcmaci = srcmaci;arpframe.sendhai = srcmaci;arpframe.recvhai = 0;arpframe.frameheader.frametype = htons(0x0806);arpframe.hardwaretype = htons(0x0001);arpframe.protocoltype = htons(0x0800);arpframe.hlen = 6;arpframe.plen =
40、4;arpframe.operation = htons(0x0001);arpframe.sendip = srcip;arpframe.recvip = targetip; pcap_sendpacket(adhandle, (u_char *) &arpframe, sizeof(arpframe_t);void cpymac(uchar *mac1, uchar *mac2)for (int i=0; i<6; i+) mac1i=mac2i;/ 比較兩個(gè)mac地址是否相同bool cmpmac(uchar *mac1, uchar *mac2)for (int i=0;
41、 i<6; i+)if (mac1i=mac2i) continue;else return false;return true;/ 把ip地址轉(zhuǎn)換成點(diǎn)分十進(jìn)制形式cstring ipntoa(ulong nipaddr)charstrbuf50;u_char*p;cstringstr;p = (u_char *) &nipaddr;sprintf_s(strbuf,"%03d.%03d.%03d.%03d", p0, p1, p2, p3);str = strbuf;return str;/ 把mac地址轉(zhuǎn)換成“%02x:%02x:%02x:%02x:%02
42、x:%02x”的格式cstring macntoa(uchar *nmacaddr)charstrbuf50;cstringstr;sprintf_s(strbuf,"%02x:%02x:%02x:%02x:%02x:%02x", nmacaddr0, nmacaddr1, nmacaddr2, nmacaddr3, nmacaddr4, nmacaddr5);str = strbuf;return str;/ 數(shù)據(jù)包捕獲線(xiàn)程uint capture(pvoid pparam)intres;ifinfo_t*pifinfo;struct pcap_pkthdr*header
43、;const u_char*pkt_data;pifinfo = (ifinfo_t *)pparam;/ 開(kāi)始正式接收并處理幀while (true)res = pcap_next_ex( pifinfo->adhandle, &header, &pkt_data); if (res = 1)frameheader_t*fh;fh = (frameheader_t *) pkt_data;switch (ntohs(fh->frametype)case 0x0806:arpframe_t *arpf;arpf = (arpframe_t *)pkt_data;/t
44、race1("收到arp包 源ip為:%dn", arpf->sendip);/ arp包,轉(zhuǎn)到arp包處理函數(shù)arppacketproc(header, pkt_data);break;case 0x0800:ipframe_t *ipf;ipf = (ipframe_t*) pkt_data;/trace1("收到ip包 源ip為:%dn",ipf->ipheader.srcip );/ ip包,轉(zhuǎn)到ip包處理函數(shù)ippacketproc(pifinfo, header, pkt_data);break;default: break;el
45、se if (res = 0)/ 超時(shí)continue;elseafxmessagebox("pcap_next_ex函數(shù)出錯(cuò)!");return 0;/ 處理arp數(shù)據(jù)包void arppacketproc(struct pcap_pkthdr *header, const u_char *pkt_data)boolflag;arpframe_tarpf;ipframe_t*ipf;sendpacket_tspacket;positionpos, currentpos;ip_mac_tip_mac;ucharmacaddr6;arpf = *(arpframe_t *)p
46、kt_data;if (arpf.operation = ntohs(0x0002)pdlg->logger.insertstring(-1, "收到arp響應(yīng)包");pdlg->logger.insertstring(-1, (" arp "+(ipntoa(arpf.sendip)+" - "+macntoa(arpf.sendha);/ ipmac地址映射表中已經(jīng)存在該對(duì)應(yīng)關(guān)系if (iplookup(arpf.sendip, macaddr) pdlg->logger.insertstring(-1, &qu
47、ot; 該對(duì)應(yīng)關(guān)系已經(jīng)存在于ipmac地址映射表中");return;elseip_mac.ipaddr = arpf.sendip;memcpy(ip_mac.macaddr, arpf.sendha, 6);/ 將ip-mac映射關(guān)系存入表中ip_mac.addhead(ip_mac);/ 日志輸出信息pdlg->logger.insertstring(-1, " 將該對(duì)應(yīng)關(guān)系存入ipmac地址映射表中");mmutex.lock(infinite);do/ 查看是否能轉(zhuǎn)發(fā)緩存中的ip數(shù)據(jù)報(bào)flag = false;/ 沒(méi)有需要處理的內(nèi)容if (sp.i
48、sempty() break;/ 遍歷轉(zhuǎn)發(fā)緩存區(qū)pos = sp.getheadposition();for (int i=0; i < sp.getcount(); i+)currentpos = pos;spacket = sp.getnext(pos);if (spacket.targetip = arpf.sendip)ipf = (ipframe_t *) spacket.pktdata;cpymac(ipf->frameheader.desmac, arpf.sendha);for(int t=0; t<6; t+)ipf->frameheader.srcm
49、act = ifinfospacket.ifno.macaddrt;/ 發(fā)送ip數(shù)據(jù)包pcap_sendpacket(ifinfospacket.ifno.adhandle, (u_char *) spacket.pktdata, spacket.len);sp.removeat(currentpos);/ 日志輸出信息pdlg->logger.insertstring(-1, " 轉(zhuǎn)發(fā)緩存區(qū)中目的地址是該mac地址的ip數(shù)據(jù)包");pdlg->logger.insertstring(-1, (" 發(fā)送ip數(shù)據(jù)包:"+ipntoa(ipf-&
50、gt;ipheader.srcip) + "->" + ipntoa(ipf->ipheader.dstip) + " " + macntoa(ipf->frameheader.srcmac )+"->"+macntoa(ipf->frameheader.desmac);flag = true;break; while(flag);mmutex.unlock();/ 查詢(xún)ip-mac映射表bool iplookup(ulong ipaddr, uchar *p)ip_mac_tip_mac;positio
51、npos;if (ip_mac.isempty() return false;pos = ip_mac.getheadposition(); for (int i = 0; i<ip_mac.getcount(); i+) ip_mac = ip_mac.getnext(pos);if (ipaddr = ip_mac.ipaddr)for (int j = 0; j < 6; j+)pj = ip_mac.macaddrj;return true;return false;/ 處理ip數(shù)據(jù)包void ippacketproc(ifinfo_t *pifinfo, struct pcap_pkthdr *header, const u_char *pkt_data)ipframe_t*ipf;sendpacket_tspacket;ipf = (ipframe_t *) pkt_data;pdlg->logger.insertstr
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度個(gè)人養(yǎng)老金投資管理合同4篇
- 2025版專(zhuān)業(yè)舞蹈鞋訂購(gòu)與租賃合同3篇
- 2025版木質(zhì)墻板供貨與安裝服務(wù)合同4篇
- 2025年度城市軌道交通建設(shè)項(xiàng)目工程總承包合同4篇
- 2025版土地儲(chǔ)備土地使用權(quán)流轉(zhuǎn)合同3篇
- 五金行業(yè)電子商務(wù)應(yīng)用考核試卷
- 安徽省黃山市高三第一次質(zhì)量檢測(cè)語(yǔ)文試卷(含答案)
- 2025版升級(jí)版土方工程勞務(wù)承包合同范本2篇
- 2025版危險(xiǎn)化學(xué)品運(yùn)輸安全責(zé)任合同3篇
- 二零二五版海運(yùn)出口運(yùn)輸代理合同貨物跟蹤查詢(xún)協(xié)議3篇
- 無(wú)人化農(nóng)場(chǎng)項(xiàng)目可行性研究報(bào)告
- 《如何存款最合算》課件
- 社區(qū)團(tuán)支部工作計(jì)劃
- 拖欠工程款上訪(fǎng)信范文
- 2024屆上海市金山區(qū)高三下學(xué)期二模英語(yǔ)試題(原卷版)
- 《wifi協(xié)議文庫(kù)》課件
- 2025年新高考語(yǔ)文復(fù)習(xí) 文言文速讀技巧 考情分析及備考策略
- 2024年海口市選調(diào)生考試(行政職業(yè)能力測(cè)驗(yàn))綜合能力測(cè)試題及答案1套
- 一年級(jí)下冊(cè)數(shù)學(xué)口算題卡打印
- 2024年中科院心理咨詢(xún)師新教材各單元考試題庫(kù)大全-下(多選題部分)
- 真人cs基于信號(hào)發(fā)射的激光武器設(shè)計(jì)
評(píng)論
0/150
提交評(píng)論