锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品无码一区二区三区免费,波多野结衣久久精品,香蕉久久影院http://www.shnenglu.com/saga/category/1425.html瀛︿範(fàn)錛岄捇鐮旓紝鎬濊冿紝鍒涙柊錛? 鎴戞墠鍒氫笂璺紝鏈夊ソ澶氱殑鏈熷緟錛?/description>zh-cnTue, 20 May 2008 09:18:35 GMTTue, 20 May 2008 09:18:35 GMT60[鍘熷垱]鐢╓inpcap鍑芥暟杞彂鍖呴渶瑕佺暀蹇?jī)鐨勪竴鐐?/title><link>http://www.shnenglu.com/saga/archive/2006/04/16/5654.html</link><dc:creator>saga.constantine</dc:creator><author>saga.constantine</author><pubDate>Sun, 16 Apr 2006 09:13:00 GMT</pubDate><guid>http://www.shnenglu.com/saga/archive/2006/04/16/5654.html</guid><wfw:comment>http://www.shnenglu.com/saga/comments/5654.html</wfw:comment><comments>http://www.shnenglu.com/saga/archive/2006/04/16/5654.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.shnenglu.com/saga/comments/commentRss/5654.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/saga/services/trackbacks/5654.html</trackback:ping><description><![CDATA[聽聽聽聽聽聽聽 <img height="20" src="http://www.shnenglu.com/Emoticons/QQ/31.gif" width="20" border="0" />鏈榪戣嚜宸卞洜涓哄疄闄呴渶瑕?鐢╳inpcap寮鍙戜竴涓▼搴忛噷闈㈡湁闇瑕佽漿鍙戝寘.鑷繁灝卞啓浜?jiǎn)涓涓?鍙戠幇杞彂鏃跺歡>500ms.涔熺‘瀹炴妸鑷繁鍚撳埌浜?渚挎妸杞彂鐨勯偅孌典唬鐮佸紑濮嬬簿鍑?澶ц嚧濡備笅 <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 102.24%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 427px; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">((j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">pcap_next_ex(slecadopt,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">pkt_header,(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽u_char</span><span style="COLOR: #000000">**</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">pkt_data))</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_76_685_Open_Image" onclick="this.style.display='none'; Codehighlighter1_76_685_Open_Text.style.display='none'; Codehighlighter1_76_685_Closed_Image.style.display='inline'; Codehighlighter1_76_685_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_76_685_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_76_685_Closed_Text.style.display='none'; Codehighlighter1_76_685_Open_Image.style.display='inline'; Codehighlighter1_76_685_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_76_685_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_76_685_Open_Text"><span style="COLOR: #000000">{聽聽聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_100_122_Open_Image" onclick="this.style.display='none'; Codehighlighter1_100_122_Open_Text.style.display='none'; Codehighlighter1_100_122_Closed_Image.style.display='inline'; Codehighlighter1_100_122_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_100_122_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_100_122_Closed_Text.style.display='none'; Codehighlighter1_100_122_Open_Image.style.display='inline'; Codehighlighter1_100_122_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽</span><span id="Codehighlighter1_100_122_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_100_122_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽</span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(unsigned聽</span><span style="COLOR: #0000ff">short</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)(pkt_data</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">12</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">htons(ETH_IP)</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(memcmp(pkt_data</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">,myip</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">mac,</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">))</span><span style="COLOR: #000000">&&*</span><span style="COLOR: #000000">(unsigned聽</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)(pkt_data</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">myip</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">ip</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(memcmp(pkt_data,bcast,</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)))<br /><img id="Codehighlighter1_303_683_Open_Image" onclick="this.style.display='none'; Codehighlighter1_303_683_Open_Text.style.display='none'; Codehighlighter1_303_683_Closed_Image.style.display='inline'; Codehighlighter1_303_683_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_303_683_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_303_683_Closed_Text.style.display='none'; Codehighlighter1_303_683_Open_Image.style.display='inline'; Codehighlighter1_303_683_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽</span><span id="Codehighlighter1_303_683_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_303_683_Open_Text"><span style="COLOR: #000000">{聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(z</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Pipmachead;z</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">NULL;z</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">z</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">next)<br /><img id="Codehighlighter1_346_676_Open_Image" onclick="this.style.display='none'; Codehighlighter1_346_676_Open_Text.style.display='none'; Codehighlighter1_346_676_Closed_Image.style.display='inline'; Codehighlighter1_346_676_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_346_676_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_346_676_Closed_Text.style.display='none'; Codehighlighter1_346_676_Open_Image.style.display='inline'; Codehighlighter1_346_676_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽</span><span id="Codehighlighter1_346_676_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_346_676_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(unsigned聽</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)(pkt_data</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">z</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">ip)<br /><img id="Codehighlighter1_410_655_Open_Image" onclick="this.style.display='none'; Codehighlighter1_410_655_Open_Text.style.display='none'; Codehighlighter1_410_655_Closed_Image.style.display='inline'; Codehighlighter1_410_655_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_410_655_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_410_655_Closed_Text.style.display='none'; Codehighlighter1_410_655_Open_Image.style.display='inline'; Codehighlighter1_410_655_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span id="Codehighlighter1_410_655_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/images/dot.gif" /></span><span id="Codehighlighter1_410_655_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽memcpy(cmac</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">mac,z</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">mac,</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 memcpy(cmac</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">mac</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">,myip</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">mac,</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽memcpy(sendbuf,pkt_data,pkt_header</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">caplen);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 memcpy(sendbuf,cmac,</span><span style="COLOR: #000000">12</span><span style="COLOR: #000000">);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 pcap_sendpacket(slecadopt,sendbuf,pkt_header</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">caplen);聽聽聽聽聽聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽聽}</span></span><span style="COLOR: #000000">聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div>聽聽聽聽聽聽聽 榪囩▼寰堢畝鍗?pcap_next_ex()鏀跺寘,鍦ㄥ仛鍒ゆ柇澶勭悊,鐒跺悗鐢╬cap_sendpacket()鍙戝寘.<img height="20" src="http://www.shnenglu.com/Emoticons/QQ/icon18.gif" width="25" border="0" />鎬庝箞鎯抽兘涓嶄細(xì)鏈夐偅涔堝ぇ鐨勬椂寤?寰堜笉瑙e氨鎼滅儲(chǔ)浜?jiǎn)涓嬪叧浜巔cap_sendpacket()鍙戝寘鏁堣兘鐨勭綉欏?鍏朵腑鏈変竴涓?a >http://community.csdn.net/Expert/TopicView3.asp?id=4153633</a>鏉ラ噷闈㈡湁浜鴻 <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">鎴戠敤winpcap鍋氫釜涓涓垵姝ョ殑璇曢獙錛屾垜寰楁満鍣ㄦ槸濂?聽</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">銆?/span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">錛屽唴瀛?12錛屾垜涓涓嚎紼嬫帴鍖咃紝涓涓嚎紼嬫敹鍖咃紝鐢ㄥ姩鎬佽繛琛ㄥ仛緙撳瓨錛屼竴縐掗挓杞彂1錛?涓寘娌℃湁澶氬ぇ闂錛岃鏄啀澶氫簡(jiǎn)錛屽氨浼?xì)鍙堜涪鍖呭Q岃漿鍙戜笂鍗冧竾鍖呰涓㈠嚑鐧句釜銆?/span></div>榪樻湁浜鴻 <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">winpcap鐨剆endpacket瓚呯駭鎱紝鑰屼笖寤惰繜寰堝ぇ銆?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />鎴戣瘯鍥懼疄鐜頒竴涓猙ridge錛屽嵆涓涓鍙h繘鍏ョ殑鍖呬笉緇忎慨鏀逛粠涓涓鍙e嚭錛屽弽涔嬩害鐒躲傜粨鏋減ing鐨勭粨鏋滄樉紺哄歡榪熶負(fù)鏁扮櫨姣綰у埆錛屼釜鍒椂鍊欑敋鑷沖埌浜?縐掋傝繍琛屽叾瀹冨簲鐢ㄦ洿鏄笉鍙繊鍙椼?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />鎴戞兂浣跨敤sendQuene錛岀粨鏋渟endQuene鐨勫叿浣撶敤娉曞彧瑙佽繃棰勫厛鍑嗗濂芥墍鏈夌殑鍖呯劧鍚庢暣浣撳彂閫佺殑錛屾病瑙佽繃闅忕潃鍖呮潵闅忕潃鍙戦佺殑渚嬪瓙銆傛垨璁稿浜庢垜鐨刡ridge錛寃inpcap鏄竴涓敊璇殑閫夋嫨錛熷張鎴栬呭ぇ瀹舵湁浠涔堟柊椴滅殑鎬濊礬錛熸効鎰忓惉澶у璇磋銆?/span></div>聽聽聽聽 聽聽 浣挎垜涔熷紑濮嬫鐤憄cap_sendpacket()浜?闅鵑亾鐪熷疄pcap_sendpacket()鏁堢巼搴?浣嗘槸鎴戣繕鏄笉鐩鎬俊.鍫傚爞winpcap鎬庝箞鍙兘鎬庝箞鎱?浣挎垜鍙戠幇鐮寸喚鐨勪嬌璐村瓙閲屾渶鍚庝竴鐨勪漢鐨勮娉? <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">鎴戜篃鍐欎簡(jiǎn)涓被浼肩殑紼嬪簭錛屽歡鏃剁ǔ瀹氬湪20ms宸﹀彸錛屽甫瀹藉彲浠ヨ揪鍒?0M<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />鎴戝彂鐜頒竴涓湁瓚g殑浜嬫儏錛屽嵆鎴戝湪榪愯brigde鐨勬湇鍔″櫒涓婏紝榪愯涓涓猣luke鐨勬姄鍖呭伐鍏鳳紝灞呯劧鍙戠幇榪愯鍚庯紝閫氳繃bridge鍚庣殑鏃跺歡灞呯劧鍙湁1ms宸﹀彸浜?jiǎn)锛屽仠姝㈡姄鍖呭伐鍏峰悗锛屽欢鏃跺張鍥炲?0ms宸﹀彸錛岃瘯浜?jiǎn)澶殝啤鎯呭喌閮戒竴鏍?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />鎵撳紑緗戝崱鐨勫彞鏌勬槸鎸変笅闈㈢殑鍙傛暟鎵ц鐨?br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />pcap_open(d</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">name,聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽name聽of聽the聽device聽</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">65536</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽portion聽of聽the聽packet聽to聽capture.</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">PCAP_OPENFLAG_PROMISCUOUS,聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽promiscuous聽mode聽</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽read聽timeout聽</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">NULL,聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽remote聽authentication聽</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">errbuf聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽error聽buffer聽</span><span style="COLOR: #008000"><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">);聽<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />瀵規(guī)暟鎹姤鐨勬崟鑾鋒槸鐢╬cap_loop鍑芥暟錛屾垜璇曡繃灝唒cap_open鐨剅ead聽timeout鍙傛暟璁劇疆涓?/span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,鍗寵鍙栫珛鍗寵繑鍥烇紝浣嗚繖鏍峰緋葷粺璧勬簮鍗犵敤澶ぇ錛宑pu鍒╃敤鐜囧鍔犲埌100錛咃紝姝ゆ椂bridge鐨勫歡鏃跺氨寰堜笉紼沖畾浜?jiǎn)锛屼?ms鍒?s閮芥湁銆?/span></div>聽聽聽聽聽聽 浠栧湪閲岄潰鐗規(guī)剰鎻愬埌浜?jiǎn)pcap_open()鐨剅ead timeout鍙傛暟,鎴戝洖鎯寵搗鎴戠殑璁劇殑1000ms,涔熷氨鏄竴縐?瀚岀枒寰堝ぇ.(娉?鎴戠敤鐨勬槸pcap_open_live())<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">pcap_open_live(d</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">name,聽</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">,聽error)</span></div>鐒跺悗灝卞幓鏌inpcap鐨勫畼鏂硅祫鏂?a >http://www.winpcap.org/docs/docs31/html/group__wpcapfunc.html</a><br />閲岄潰璇寸殑寰堟竻妤? <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">to_ms聽specifies聽the聽read聽timeout聽in聽milliseconds.聽The聽read聽timeout聽is聽used聽to聽arrange聽that聽the聽read聽not聽necessarily聽</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">聽immediately聽when聽a聽packet聽is聽seen,聽but聽that聽it聽wait聽</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">聽some聽amount聽of聽time聽to聽allow聽more聽packets聽to聽arrive聽and聽to聽read聽multiple聽packets聽from聽the聽OS聽kernel聽in聽one聽operation.聽</span></div><p>聽聽聽聽 褰撳凡緇忓彂鐜板寘涔嬪悗榪樹細(xì)絳夊涓浜涚殑鍖呬竴璧瘋繑鍥?絳夊緟鏃墮棿灝辨槸read timeout.鏄庣櫧浜?鎴戞妸read timeout璁句負(fù)1浠ュ悗鏃跺歡闄嶅埌浜?lt;10ms.<br /><br />聽聽聽聽聽鍏朵腑榪橀渶瑕佹彁閱掔殑鏄敤Ethereal絳変竴浜涙姄鍖呭伐鍏風(fēng)湅鍒版敹鍖呭埌杞彂鏃跺歡寰堝ぇ鏃跺氨浠ヤ負(fù)鏄痯cap_next_ex()鍜宲cap_sendpacket()鍑芥暟涔嬮棿鐨勫鐞嗛犳垚浜?jiǎn)鏃跺?榪欓噷瀹規(guī)槗緇欐垜浠駭鐢熶竴涓亣鐩?浠ヤ負(fù)緗戝崱鏀跺埌鍖呯殑鏃跺埢灝辨槸杞彂紼嬪簭灝辮寮濮嬪鐞?瀹為檯涓妏cap_next_ex()榪樺湪絳夊緟鏇村鐨勫寘涓璧瘋繑鍥?<br />聽聽聽聽聽鎵浠?font style="BACKGROUND-COLOR: #ffffff" color="#ff1493">浜嬪彂鐨勫師鍥犵浜嬪彂鐜板満姣旇緝榪?/font>.鍦╬cap_open()閭?紼嬪簭灝卞氨鏄庝箞鍗冧笣涓囩紩鐨勫叧鑱旂潃.<br />聽聽聽聽 澶у涓瀹氳澶氭鐤戣嚜宸?鍒幓鎬姜宸ュ叿.winpcap寰堟棤杈滅殑.鍢誨樆!!<img height="20" src="http://www.shnenglu.com/Emoticons/QQ/14.gif" width="20" border="0" />鑲氬瓙楗夸簡(jiǎn)鍘誨悆楗?img height="20" src="http://www.shnenglu.com/Emoticons/QQ/32.gif" width="20" border="0" />!!</p><p>聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽-----saga.constantine</p><img src ="http://www.shnenglu.com/saga/aggbug/5654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/saga/" target="_blank">saga.constantine</a> 2006-04-16 17:13 <a href="http://www.shnenglu.com/saga/archive/2006/04/16/5654.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[鍘熷垱]鐢╳inpcap鑾峰彇鏈湴mac鐨勪竴孌典唬鐮?http://www.shnenglu.com/saga/archive/2006/04/13/5468.htmlsaga.constantinesaga.constantineThu, 13 Apr 2006 07:02:00 GMThttp://www.shnenglu.com/saga/archive/2006/04/13/5468.htmlhttp://www.shnenglu.com/saga/comments/5468.htmlhttp://www.shnenglu.com/saga/archive/2006/04/13/5468.html#Feedback3http://www.shnenglu.com/saga/comments/commentRss/5468.htmlhttp://www.shnenglu.com/saga/services/trackbacks/5468.html 鏈榪戠敤winpcap緙栫▼鍙戠幇winpcap涓嶈兘鐩存帴鐨勬彁鍙栨湰鍦扮綉鍗$殑mac鍦板潃.
聽聽聽聽 浜庢槸閫氳繃鍚戣嚜宸卞彂arp璇鋒眰鏉ヨ幏寰楁湰鍦扮殑mac.鑷繁鍐欎簡(jiǎn)孌典唬鐮?濡備笅:

int 聽getmmac()
{聽聽聽
聽聽聽聽unsigned聽
char 聽聽聽sendbuf[ 42 ];
聽聽聽聽
int 聽聽聽聽i = 7 ,k;
聽聽聽聽ETHDR聽聽eth;
聽聽聽聽ARPHDR聽arp;
聽聽聽聽
struct 聽pcap_pkthdr聽 * 聽聽pkt_header;
聽聽聽聽u_char聽
* 聽pkt_data;聽

聽聽聽聽
for (k = 0 ;k < 6 ;k ++ )
聽聽聽聽{
聽聽聽聽聽聽聽聽eth.eh_dst[k]
= 0xff ;
聽聽聽聽聽聽聽聽eth.eh_src[k]
= 0x0f ;
聽聽聽聽聽聽聽聽arp.arp_sha[k]
= 0x0f ;
聽聽聽聽聽聽聽聽arp.arp_tha[k]
= 0x00 ;
聽聽聽聽}
聽聽聽聽eth.eh_type
= htons(ETH_ARP);
聽聽聽聽arp.arp_hdr
= htons(ARP_HARDWARE);
聽聽聽聽arp.arp_pro
= htons(ETH_IP);
聽聽聽聽arp.arp_hln
= 6 ;
聽聽聽聽arp.arp_pln
= 4 ;
聽聽聽聽arp.arp_opt
= htons(ARP_REQUEST);
聽聽聽聽arp.arp_tpa
= myip -> ip;
聽聽聽聽arp.arp_spa
= inet_addr( " 127.0.0.2 " );

聽聽聽聽memset(sendbuf,
0 , sizeof (sendbuf));
聽聽聽聽memcpy(sendbuf,
& eth, sizeof (eth));
聽聽聽聽memcpy(sendbuf
+ sizeof (eth), & arp, sizeof (arp));

聽聽聽聽
if (pcap_sendpacket(slecadopt,sendbuf, 42 ) == 0 )
聽聽聽聽{
聽聽聽聽聽聽聽聽printf(
" PacketSend聽succeed\n\n " );
聽聽聽聽}
聽聽聽聽
else
聽聽聽聽{
聽聽聽聽聽聽聽聽printf(
" PacketSendPacket聽in聽getmine聽Error:聽%d\n " ,GetLastError());
聽聽聽聽聽聽聽聽
return 0 ;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
while ((k = pcap_next_ex(slecadopt, & pkt_header,( const 聽u_char ** ) & pkt_data)) >= 0 )
聽聽聽聽{聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽
if ( * (unsigned聽 short * )(pkt_data + 12 ) == htons(ETH_ARP) &&* (unsigned聽 short * )(pkt_data + 20 ) == htons(ARP_REPLY) &&* (unsigned聽 long * )(pkt_data + 38 ) == inet_addr( " 127.0.0.2 " ))
聽聽聽聽聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽
for (i = 0 ;i < 6 ;i ++ )
聽聽聽聽聽聽聽聽聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽myip
-> mac[i] =* (unsigned聽 char * )(pkt_data + 22 + i);
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
break ;
聽聽聽聽聽聽聽聽}
聽聽聽聽}
聽聽聽聽
if (i == 6 )
聽聽聽聽{
聽聽聽聽聽聽聽聽
return 1 ;
聽聽聽聽}
聽聽聽聽
else
聽聽聽聽{
聽聽聽聽聽聽聽聽
return 0 ;
聽聽聽聽}
}

鍐欑殑鏄竴涓嚱鏁?鍏朵腑arp璇鋒眰鐨勫彂閫佹柟鍦板潃濉殑鏄?27.0.0.2.榪欎釜閮芥病浠涔堝叧緋?
褰撶劧鎻愬彇鏈湴鐨刴ac榪樺彲浠ョ敤api鐩存帴鑾峰彇.浣嗘槸涓嶇煡閬撶敤pcap榪樻湁鍒殑濂芥柟娉?楂樻墜鎸囨暀.璋㈣阿

]]>
久久久国产亚洲精品| 国产亚洲美女精品久久久2020| 丁香狠狠色婷婷久久综合| 99久久中文字幕| 久久亚洲AV无码西西人体| 久久久久久久久久久久久久| 久久99国产精品二区不卡| 欧美性大战久久久久久| 中文字幕无码免费久久| 久久成人精品视频| 偷窥少妇久久久久久久久| 97久久精品无码一区二区| 四虎亚洲国产成人久久精品| 久久精品国产99久久无毒不卡 | 亚洲日本va午夜中文字幕久久| 欧美亚洲国产精品久久高清| 久久99免费视频| 中文字幕无码免费久久| 久久人人爽人人爽AV片| 色综合久久久久| 欧洲人妻丰满av无码久久不卡| 久久久久久久久久久免费精品| 久久人人爽人人爽人人AV东京热| 久久久噜噜噜久久| 曰曰摸天天摸人人看久久久| 亚洲AV日韩精品久久久久| 久久精品亚洲欧美日韩久久| 99麻豆久久久国产精品免费| 久久久久亚洲精品无码蜜桃| 久久人人爽人人人人爽AV| 久久精品中文字幕一区| 久久国产乱子伦精品免费午夜| 狠狠狠色丁香婷婷综合久久五月 | 日韩精品久久久久久| 久久A级毛片免费观看| 久久天天躁狠狠躁夜夜躁2014| 99热热久久这里只有精品68| 国产精品激情综合久久| 精品久久国产一区二区三区香蕉 | 久久综合噜噜激激的五月天| 2020久久精品亚洲热综合一本|