亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? group__wpcap__tut8.html

?? Winpcap是一個強大的網絡開發庫
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>WinPcap: Sending Packets</title><link href="style.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.6 --><div class="navigation" id="top">  <div class="tabs">    <ul>      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>      <li><a href="modules.html"><span>Modules</span></a></li>      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>      <li><a href="files.html"><span>Files</span></a></li>    </ul>  </div></div><div class="contents"><h1>Sending Packets</h1><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>Although the name <em>WinPcap</em> indicates clearly that the purpose of the library is packet capture, other useful features for raw networking are provided. Among them, the user can find a complete set of functions to send packets.<p>Note that the original libpcap library at the moment doesn't provide any way to send packets, therefore all the functions shown here are WinPcap extensions and will not work under Unix.<p><b>Sending a single packet with <a class="el" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket()</a></b><p>The simplest way to send a packet is shown in the following code snippet. After opening an adapter, <a class="el" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket()</a> is called to send a hand-crafted packet. <a class="el" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket()</a> takes as arguments a buffer containing the data to send, the length of the buffer and the adapter that will send it. Notice that the buffer is sent to the net as is, without any manipulation. This means that the application has to create the correct protocol headers in order to send something meaningful.<p><div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;stdlib.h&gt;</span><span class="preprocessor">#include &lt;stdio.h&gt;</span><span class="preprocessor">#include &lt;pcap.h&gt;</span><span class="keywordtype">void</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv){<a class="code" href="group__wpcap__def.html#g4711d025f83503ce692efa5e45ec60a7" title="Descriptor of an open capture instance. This structure is opaque to the user, that...">pcap_t</a> *fp;<span class="keywordtype">char</span> errbuf[<a class="code" href="group__wpcap__def.html#gcd448353957d92c98fccc29e1fc8d927" title="Size to use when allocating the buffer that contains the libpcap errors.">PCAP_ERRBUF_SIZE</a>];u_char packet[100];<span class="keywordtype">int</span> i;    <span class="comment">/* Check the validity of the command line */</span>    <span class="keywordflow">if</span> (argc != 2)    {        printf(<span class="stringliteral">"usage: %s interface (e.g. 'rpcap://eth0')"</span>, argv[0]);        <span class="keywordflow">return</span>;    }        <span class="comment">/* Open the output device */</span>    <span class="keywordflow">if</span> ( (fp= <a class="code" href="group__wpcapfunc.html#g2b64c7b6490090d1d37088794f1f1791" title="Open a generic source in order to capture / send (WinPcap only) traffic.">pcap_open</a>(argv[1],            <span class="comment">// name of the device</span>                        100,                <span class="comment">// portion of the packet to capture (only the first 100 bytes)</span>                        <a class="code" href="group__remote__open__flags.html#g9134ce51a9a6a7d497c3dee5affdc3b9" title="Defines if the adapter has to go in promiscuous mode.">PCAP_OPENFLAG_PROMISCUOUS</a>,  <span class="comment">// promiscuous mode</span>                        1000,               <span class="comment">// read timeout</span>                        NULL,               <span class="comment">// authentication on the remote machine</span>                        errbuf              <span class="comment">// error buffer</span>                        ) ) == NULL)    {        fprintf(stderr,<span class="stringliteral">"\nUnable to open the adapter. %s is not supported by WinPcap\n"</span>, argv[1]);        <span class="keywordflow">return</span>;    }    <span class="comment">/* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */</span>    packet[0]=1;    packet[1]=1;    packet[2]=1;    packet[3]=1;    packet[4]=1;    packet[5]=1;        <span class="comment">/* set mac source to 2:2:2:2:2:2 */</span>    packet[6]=2;    packet[7]=2;    packet[8]=2;    packet[9]=2;    packet[10]=2;    packet[11]=2;        <span class="comment">/* Fill the rest of the packet */</span>    <span class="keywordflow">for</span>(i=12;i&lt;100;i++)    {        packet[i]=(u_char)i;    }    <span class="comment">/* Send down the packet */</span>    <span class="keywordflow">if</span> (<a class="code" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket</a>(fp, packet, 100 <span class="comment">/* size */</span>) != 0)    {        fprintf(stderr,<span class="stringliteral">"\nError sending the packet: %s\n"</span>, <a class="code" href="group__wpcapfunc.html#g81305cb154e4497e95bbb9b708631a3a" title="return the error text pertaining to the last pcap library error.">pcap_geterr</a>(fp));        <span class="keywordflow">return</span>;    }    <span class="keywordflow">return</span>;}</pre></div><p><b>Send queues</b><p>While <a class="el" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket()</a> offers a simple and immediate way to send a single packet, <b> send queues </b> provides an advanced, powerful and optimized mechanism to send a collection of packets. A send queue is a container for a variable number of packets that will be sent to the network. It has a size, that represents the maximum amount of bytes it can store.<p>A send queue is created calling the <a class="el" href="group__wpcapfunc.html#gb940e69631b7cc7f2232a69ea02b86d9" title="Allocate a send queue.">pcap_sendqueue_alloc()</a> function, specifying the size of the new send queue.<p>Once the send queue is created, <a class="el" href="group__wpcapfunc.html#g4c57ea320d71dbfe55c5665af9db1297" title="Add a packet to a send queue.">pcap_sendqueue_queue()</a> can be used to add a packet to the send queue. This function takes a <a class="el" href="structpcap__pkthdr.html" title="Header of a packet in the dump file.">pcap_pkthdr</a> with the timestamp and the length and a buffer with the data of the packet. These parameters are the same as those received by <a class="el" href="group__wpcapfunc.html#g439439c2eae61161dc1efb1e03a81133" title="Read a packet from an interface or from an offline capture.">pcap_next_ex()</a> and <a class="el" href="group__wpcapfunc.html#gbcba231c099919ecd9300d7160b19878" title="Prototype of the callback function that receives the packets.">pcap_handler()</a>, therefore queuing a packet that was just captured or read from a file is a matter of passing these parameters to <a class="el" href="group__wpcapfunc.html#g4c57ea320d71dbfe55c5665af9db1297" title="Add a packet to a send queue.">pcap_sendqueue_queue()</a>.<p>To transmit a send queue, WinPcap provides the <a class="el" href="group__wpcapfunc.html#ga4d55eb047a1cccc0e28397ce04ee097" title="Send a queue of raw packets to the network.">pcap_sendqueue_transmit()</a> function. Note the third parameter: if nonzero, the send will be <em>synchronized</em>, i.e. the relative timestamps of the packets will be respected. This operation requires a remarkable amount of CPU, because the synchronization takes place in the kernel driver using "busy wait" loops. Although this operation is quite CPU intensive, it often results in very high precision packet transmissions (often around few microseconds or less).<p>Note that transmitting a send queue with <a class="el" href="group__wpcapfunc.html#ga4d55eb047a1cccc0e28397ce04ee097" title="Send a queue of raw packets to the network.">pcap_sendqueue_transmit()</a> is much more efficient than performing a series of <a class="el" href="group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2" title="Send a raw packet.">pcap_sendpacket()</a>, because the send queue is buffered at kernel level drastically decreasing the number of context switches.<p>When a queue is no longer needed, it can be deleted with <a class="el" href="group__wpcapfunc.html#g72624f7a9932cc2124abf661001e0aa4" title="Destroy a send queue.">pcap_sendqueue_destroy()</a> that frees all the buffers associated with the send queue.<p>The next program shows how to use send queues. It opens a capture file with <a class="el" href="group__wpcapfunc.html#g91078168a13de8848df2b7b83d1f5b69" title="Open a savefile in the tcpdump/libpcap format to read packets.">pcap_open_offline()</a>, then it moves the packets from the file to a properly allocated send queue. At his point it transmits the queue, synchronizing it if requested by the user.<p>Note that the link-layer of the dumpfile is compared with the one of the interface that will send the packets using <a class="el" href="group__wpcapfunc.html#g64c019f851f7da6892d51cca15f12ace" title="Return the link layer of an adapter.">pcap_datalink()</a>, and a warning is printed if they are different -- it is important that the capture-file link-layer be the same as the adapter's link layer for otherwise the tranmission is pointless.<p><div class="fragment"><pre class="fragment"><span class="comment">/*</span><span class="comment"> * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)</span><span class="comment"> * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)</span><span class="comment"> * All rights reserved.</span><span class="comment"> *</span><span class="comment"> * Redistribution and use in source and binary forms, with or without</span><span class="comment"> * modification, are permitted provided that the following conditions</span><span class="comment"> * are met:</span><span class="comment"> *</span><span class="comment"> * 1. Redistributions of source code must retain the above copyright</span><span class="comment"> * notice, this list of conditions and the following disclaimer.</span><span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span><span class="comment"> * notice, this list of conditions and the following disclaimer in the</span><span class="comment"> * documentation and/or other materials provided with the distribution.</span><span class="comment"> * 3. Neither the name of the Politecnico di Torino, CACE Technologies </span><span class="comment"> * nor the names of its contributors may be used to endorse or promote </span><span class="comment"> * products derived from this software without specific prior written </span><span class="comment"> * permission.</span><span class="comment"> *</span><span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span><span class="comment"> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span><span class="comment"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span><span class="comment"> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span><span class="comment"> * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span><span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span><span class="comment"> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span><span class="comment"> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span><span class="comment"> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span><span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span><span class="comment"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span><span class="comment"> *</span><span class="comment"> */</span><span class="preprocessor">#include &lt;stdlib.h&gt;</span><span class="preprocessor">#include &lt;stdio.h&gt;</span><span class="preprocessor">#include &lt;pcap.h&gt;</span><span class="keywordtype">void</span> usage();<span class="keywordtype">void</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv){    <a class="code" href="group__wpcap__def.html#g4711d025f83503ce692efa5e45ec60a7" title="Descriptor of an open capture instance. This structure is opaque to the user, that...">pcap_t</a> *indesc,*outdesc;    <span class="keywordtype">char</span> errbuf[<a class="code" href="group__wpcap__def.html#gcd448353957d92c98fccc29e1fc8d927" title="Size to use when allocating the buffer that contains the libpcap errors.">PCAP_ERRBUF_SIZE</a>];    <span class="keywordtype">char</span> source[<a class="code" href="group__remote__struct.html#gcacb155b596f7511f714de129ae32c97" title="Defines the maximum buffer size in which address, port, interface names are kept...">PCAP_BUF_SIZE</a>];    FILE *capfile;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产91精品露脸国语对白| 香蕉乱码成人久久天堂爱免费| 欧美日韩一区二区在线视频| 国产一区视频在线看| 五月婷婷激情综合| 亚洲夂夂婷婷色拍ww47| 亚洲男女一区二区三区| 国产精品国产三级国产a| 国产精品天天看| 国产精品久久精品日日| 国产精品欧美久久久久无广告| 久久综合九色综合97婷婷女人 | 91精品国产欧美日韩| 色婷婷综合久久久久中文一区二区| 99精品欧美一区二区三区综合在线| 成人在线视频一区| 日韩精品国产精品| 国产一区二区美女诱惑| 国产成人亚洲精品狼色在线| 国产成人综合视频| av成人免费在线| 在线观看av不卡| 欧美不卡一区二区三区四区| 精品国产一区二区精华| 国产日产精品一区| 夜夜精品浪潮av一区二区三区| 一区二区三国产精华液| 亚洲不卡一区二区三区| 久久精品国产澳门| 不卡的av网站| 欧美一区日韩一区| 精品久久久久久亚洲综合网| 欧美激情一区二区在线| 亚洲午夜羞羞片| 国产中文字幕精品| 北岛玲一区二区三区四区| 欧美色图免费看| 精品免费国产二区三区| 亚洲黄色在线视频| 免费成人在线观看视频| 成人av小说网| 日韩一区二区三区四区五区六区| 久久综合久久综合久久综合| 一区二区日韩av| 国产精品正在播放| 欧美三级三级三级爽爽爽| 欧美www视频| 亚洲一区二区三区四区不卡| 激情小说欧美图片| 欧美裸体一区二区三区| 日本一区二区三区四区| 日韩中文字幕区一区有砖一区| 国产在线国偷精品产拍免费yy| 91色九色蝌蚪| 久久夜色精品国产欧美乱极品| 亚洲最新视频在线播放| 国产精品一区二区久激情瑜伽| 精品视频999| 最近日韩中文字幕| 国产黄色精品网站| 日韩精品一区二区三区视频在线观看 | av亚洲精华国产精华| 欧美成人r级一区二区三区| 一区二区三区日韩欧美| 成人毛片在线观看| 国产亚洲精品中文字幕| 久久精品二区亚洲w码| 在线观看一区日韩| 一区二区三区在线看| 国产高清不卡一区二区| 精品sm在线观看| 精品无人区卡一卡二卡三乱码免费卡| 欧美日韩久久久一区| 亚洲另类色综合网站| av不卡一区二区三区| 国产亚洲va综合人人澡精品| 久久99久久精品| 精品少妇一区二区三区视频免付费 | 欧美激情一区在线观看| 国产一区二区免费在线| 精品国产成人在线影院| 奇米四色…亚洲| 日韩欧美国产1| 久久精品国产久精国产| 精品成人私密视频| 国产一区二区三区在线观看免费视频| 日韩欧美国产高清| 国产一区二区视频在线| 国产亚洲欧美日韩俺去了| 国产成人综合网站| 日韩理论片一区二区| 91年精品国产| 亚洲午夜在线视频| 欧美电视剧在线看免费| 国产呦精品一区二区三区网站| 久久精品视频在线免费观看| 国产一区二区三区香蕉| 国产人伦精品一区二区| www.久久久久久久久| 亚洲男人电影天堂| 欧美一区二视频| 国产精品99久久不卡二区| 中文字幕不卡在线观看| 在线国产电影不卡| 精品一区在线看| 国产精品美女视频| 欧美熟乱第一页| 麻豆国产精品官网| 中文字幕中文字幕在线一区 | 欧美精品免费视频| 国产剧情av麻豆香蕉精品| 国产精品久久久久毛片软件| 欧美午夜精品久久久久久超碰| 日韩成人精品在线| 国产日韩精品视频一区| 欧美亚洲国产一区二区三区| 久久99精品国产.久久久久久 | 亚洲高清久久久| 久久久久久久久久久久久久久99| 91免费国产在线| 麻豆精品一区二区综合av| 日韩美女视频一区| 日韩精品一区二区三区三区免费 | 亚洲一卡二卡三卡四卡| 欧美成人精品高清在线播放| 国产99精品视频| 麻豆中文一区二区| 亚洲日本在线观看| 久久久久国产精品人| 欧美日韩国产成人在线免费| 国v精品久久久网| 奇米影视一区二区三区| 一区二区三区在线观看视频| 久久久久久久久免费| 91精品国产综合久久久久久漫画 | 成人免费观看视频| 精品中文字幕一区二区小辣椒| 亚洲品质自拍视频| 亚洲国产精品av| 欧美精品一区二区三区久久久| 欧美日韩一区二区不卡| 成人国产在线观看| 国产自产视频一区二区三区| 日精品一区二区| 亚洲妇女屁股眼交7| 一区二区三区 在线观看视频| 国产日产欧美一区二区三区| 精品少妇一区二区三区免费观看 | 欧美精品乱码久久久久久| 99久久精品免费观看| 高清在线观看日韩| 国产.欧美.日韩| 成人精品免费网站| 成人毛片在线观看| 99精品国产91久久久久久 | 日韩理论片在线| 中文字幕在线不卡一区| 国产精品入口麻豆九色| 国产目拍亚洲精品99久久精品| 国产喂奶挤奶一区二区三区| 精品国产电影一区二区| 欧美刺激脚交jootjob| 日韩美女主播在线视频一区二区三区| 911精品国产一区二区在线| 欧美日韩国产电影| 51精品国自产在线| 欧美mv日韩mv国产网站| 日韩欧美一区二区久久婷婷| 欧美一区二区三区喷汁尤物| 欧美视频一区二区| 色婷婷激情综合| 日本不卡一区二区| 精品综合免费视频观看| 日本亚洲免费观看| 蜜臀久久99精品久久久画质超高清 | 欧美喷水一区二区| 欧美日韩国产系列| 欧美色视频一区| 欧美精品亚洲二区| 欧美日韩三级在线| 日本不卡一区二区| 精品在线播放免费| 偷拍一区二区三区| 麻豆精品在线看| 欧美丰满嫩嫩电影| 亚洲色图制服诱惑| www.亚洲在线| 久久精品亚洲精品国产欧美| 亚洲国产精品t66y| 国产成人av在线影院| 日韩精品自拍偷拍| 三级久久三级久久久| 91视频免费看| 中文字幕字幕中文在线中不卡视频| 国产成人综合在线观看| 亚洲mv在线观看| 久久精品国产久精国产| 国产麻豆精品视频| 欧美午夜精品久久久久久孕妇| 中文字幕+乱码+中文字幕一区|