<div>Thanks Gianluca,</div>  <div>&nbsp; This morning I made the change you suggested, but then I got all the following errors (and assumed this wasn't right):</div>  <div>&nbsp;</div>  <div>SendQWin32 error LNK2019: unresolved external symbol "int __cdecl pcap_sendqueue_queue(struct pcap_send_queue *,struct pcap_pkthdr const *,unsigned char const *)" (<A href="mailto:?pcap_sendqueue_queue@@YAHPAUpcap_send_queue@@PBUpcap_pkthdr@@PBE@Z">?pcap_sendqueue_queue@@YAHPAUpcap_send_queue@@PBUpcap_pkthdr@@PBE@Z</A>) referenced in function _main</div>  <div>SendQWin32 error LNK2019: unresolved external symbol "struct pcap_send_queue * __cdecl pcap_sendqueue_alloc(unsigned int)" (<A href="mailto:?pcap_sendqueue_alloc@@YAPAUpcap_send_queue@@I@Z">?pcap_sendqueue_alloc@@YAPAUpcap_send_queue@@I@Z</A>) referenced in function _main</div>  <div>SendQWin32 error LNK2019: unresolved external symbol "unsigned int __cdecl pcap_sendqueue_transmit(struct pcap *,struct pcap_send_queue *,int)" (<A
 href="mailto:?pcap_sendqueue_transmit@@YAIPAUpcap@@PAUpcap_send_queue@@H@Z">?pcap_sendqueue_transmit@@YAIPAUpcap@@PAUpcap_send_queue@@H@Z</A>) referenced in function _main</div>  <div>SendQWin32 error LNK2019: unresolved external symbol "void __cdecl pcap_sendqueue_destroy(struct pcap_send_queue *)" (<A href="mailto:?pcap_sendqueue_destroy@@YAXPAUpcap_send_queue@@@Z">?pcap_sendqueue_destroy@@YAXPAUpcap_send_queue@@@Z</A>) referenced in function _main</div>  <div>&nbsp;</div>  <div>I might be totally wrong, but it sounds like I am missing out some #include directives...</div>  <div>&nbsp;</div>  <div>Thanks in advance,</div>  <div>Marta<BR><BR><B><I>Gianluca Varenni &lt;gianluca.varenni@cacetech.com&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <META content="MSHTML 6.00.2900.2873" name=GENERATOR>  <STYLE></STYLE>    <DIV><FONT size=2>Marta,</FONT></DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV><FONT size=2>it's a known bug in the documentation (due to a "const" qualifier that was added to the prototype of pcap_next_ex(), without reflecting the change to the samples).</FONT></DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV><FONT size=2>Here is the patch to solve your problem (marked with &lt;------)</FONT></DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV><FONT size=2>  <DIV><FONT color=#0000ff size=2>int</FONT><FONT size=2> caplen,</DIV>  <DIV>sync;</DIV>  <DIV>u_int res;</DIV>  <DIV>pcap_send_queue *squeue;</DIV>  <DIV></FONT><FONT color=#0000ff size=2>struct</FONT><FONT size=2> pcap_pkthdr *pktheader;</DIV>  <DIV>const u_char *pktdata;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;------</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Check the validity of the command line */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (argc &lt;= 2 || argc &gt;= 5)</DIV>  <DIV>{</DIV>  <DIV>usage();</DIV>  <DIV></FONT><FONT
 color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV>  <DIV>&nbsp;</DIV>  <DIV>Have a nice day</DIV>  <DIV>GV</DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp;</DIV></FONT></FONT></DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>  <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=martaperez8819@yahoo.ca href="mailto:martaperez8819@yahoo.ca">Marta Perez</A> </DIV>  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>  <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, May 01, 2006 7:03 AM</DIV>  <DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Compilation Error - Send queues</DIV> 
 <DIV><FONT size=2></FONT><BR></DIV>  <DIV>Hello everybody,</DIV>  <DIV>&nbsp;&nbsp; I am having problems with the compilation of the example code found in:</DIV>  <DIV><A href="http://www.winpcap.org/docs/man/html/group__wpcap__tut8.html" target=_blank><FONT color=#003399>http://www.winpcap.org/docs/man/html/group__wpcap__tut8.html</FONT></A></DIV>  <DIV>Precisely, the first example&nbsp; (sendpacket()) is fine; the problem is with send queues' code example. I tried both VS 6.0 and .NET2003. These are the errors I am getting:</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV>VS6.0:</DIV>  <DIV>error C2664: 'pcap_next_ex' : cannot convert parameter 3 from 'unsigned char ** ' to 'const unsigned char ** '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Conversion loses qualifiers</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV>.NET2003:</DIV>  <DIV>error C2664: 'pcap_next_ex' : cannot convert parameter 3 from 'u_char **__w64&nbsp; ' to 'const u_char ** '</DIV>  <DIV><FONT
 size=2></FONT>&nbsp;</DIV>  <DIV>The code is exactly the one in the tutorial because I usually start by getting the example code to work and then modify what needs to be modified.</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV>I am really working in .NET2003, but I also tried VS6.0 just to make sure it was not a small mistake I might have&nbsp;overlooked. Any help with be greatly appreciated,</DIV>  <DIV>Marta</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV>P.S: Just in case, here it is my code</DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2> "stdafx.h"</DIV></FONT><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2> &lt;stdlib.h&gt;</DIV></FONT><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2> &lt;stdio.h&gt;</DIV></FONT><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2> &lt;pcap.h&gt;</DIV></FONT><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2>
 &lt;Win32-Extensions.h&gt;</DIV></FONT><FONT color=#0000ff size=2>  <DIV>#include</FONT><FONT size=2> &lt;remote-ext.h&gt;</DIV></FONT><FONT color=#0000ff size=2>  <DIV>void</FONT><FONT size=2> usage();</DIV></FONT><FONT color=#0000ff size=2>  <DIV>int</FONT><FONT size=2> _tmain(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> argc, _TCHAR* argv[])</DIV>  <DIV>{</DIV>  <DIV>pcap_t *indesc,*outdesc;</DIV>  <DIV></FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> error[PCAP_ERRBUF_SIZE];</DIV>  <DIV>FILE *capfile;</DIV>  <DIV></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> caplen,</DIV>  <DIV>sync;</DIV>  <DIV>u_int res;</DIV>  <DIV>pcap_send_queue *squeue;</DIV>  <DIV></FONT><FONT color=#0000ff size=2>struct</FONT><FONT size=2> pcap_pkthdr *pktheader;</DIV>  <DIV>u_char *pktdata;</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Check the validity of the command line */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT
 size=2> (argc &lt;= 2 || argc &gt;= 5)</DIV>  <DIV>{</DIV>  <DIV>usage();</DIV>  <DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV>  <DIV></DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Retrieve the length of the capture file */</DIV></FONT><FONT size=2>  <DIV>capfile=fopen(argv[1],"rb");</DIV>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(!capfile){</DIV>  <DIV>printf("Capture file not found!\n");</DIV>  <DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV>  <DIV></DIV>  <DIV>fseek(capfile , 0, SEEK_END);</DIV>  <DIV>caplen= ftell(capfile)- </FONT><FONT color=#0000ff size=2>sizeof</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>struct</FONT><FONT size=2> pcap_file_header);</DIV>  <DIV>fclose(capfile);</DIV>  <DIV></DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Chek if the timestamps must be respected */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff
 size=2>if</FONT><FONT size=2>(argc == 4 &amp;&amp; argv[3][0] == 's')</DIV>  <DIV>sync = TRUE;</DIV>  <DIV></FONT><FONT color=#0000ff size=2>else</DIV></FONT><FONT size=2>  <DIV>sync = FALSE;</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Open the capture */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>((indesc = pcap_open_offline(argv[1], error)) == NULL){</DIV>  <DIV>fprintf(stderr,"\nError opening the input file: %s\n", error);</DIV>  <DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0; </DIV>  <DIV>}</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Open the output adapter */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>((outdesc = pcap_open_live(argv[2], 100, 1, 1000, error) ) == NULL)</DIV>  <DIV>{</DIV>  <DIV>fprintf(stderr,"\nError opening adapter: %s\n", error);</DIV>  <DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV> 
 <DIV></FONT><FONT color=#008000 size=2>/* Check the MAC type */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(pcap_datalink(indesc) != pcap_datalink(outdesc)){</DIV>  <DIV>printf("Warning: the datalink of the capture differs from the one of the selected interface.\n");</DIV>  <DIV>printf("Press a key to continue, or CTRL+C to stop.\n");</DIV>  <DIV>getchar();</DIV>  <DIV>}</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Allocate a send queue */</DIV></FONT><FONT size=2>  <DIV>squeue = pcap_sendqueue_alloc(caplen);</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Fill the queue with the packets from the file */</DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#0000ff size=2>while</FONT><FONT size=2>((res = pcap_next_ex( indesc, &amp;pktheader, &amp;pktdata)) == 1){</DIV>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(pcap_sendqueue_queue(squeue, pktheader, pktdata) == -1){</DIV>  <DIV>printf("Warning: packet
 buffer too small, not all the packets will be sent.\n");</DIV>  <DIV></FONT><FONT color=#0000ff size=2>break</FONT><FONT size=2>;</DIV>  <DIV>}</DIV>  <DIV>}</DIV>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(res == -1){</DIV>  <DIV>printf("Corrupted input file.\n");</DIV>  <DIV>pcap_sendqueue_destroy(squeue);</DIV>  <DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV>  <DIV></FONT><FONT color=#008000 size=2>/* Transmit the queue */</DIV></FONT><FONT size=2>  <DIV></DIV>  <DIV></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>((res = pcap_sendqueue_transmit(outdesc, squeue, sync)) &lt; squeue-&gt;len)</DIV>  <DIV>{</DIV>  <DIV>printf("An error occurred sending the packets: %s. Only %d bytes were sent\n", error, res);</DIV>  <DIV>}</DIV>  <DIV></DIV>  <DIV></FONT><FONT color=#008000 size=2>/* free the send queue */</DIV></FONT><FONT size=2>  <DIV>pcap_sendqueue_destroy(squeue);</DIV>  <DIV></FONT><FONT
 color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>  <DIV>}</DIV></FONT><FONT color=#0000ff size=2>  <DIV>void</FONT><FONT size=2> usage()</DIV>  <DIV>{</DIV>  <DIV></DIV>  <DIV>printf("\nSendcap, sends a libpcap/tcpdump capture file to the net. Copyright (C) 2002 Loris Degioanni.\n");</DIV>  <DIV>printf("\nUsage:\n");</DIV>  <DIV>printf("\t sendcap file_name adapter [s]\n");</DIV>  <DIV>printf("\nParameters:\n");</DIV>  <DIV>printf("\nfile_name: the name of the dump file that will be sent to the network\n");</DIV>  <DIV>printf("\nadapter: the device to use. Use \"WinDump -D\" for a list of valid devices\n");</DIV>  <DIV>printf("\ns: if present, forces the packets to be sent synchronously, i.e. respecting the timestamps in the dump file. This option will work only under Windows NTx.\n\n");</DIV>  <DIV>exit(0);</DIV>  <DIV>}</DIV></FONT></DIV>  <DIV>&nbsp;</DIV>  <div>__________________________________________________<BR>Do You Yahoo!?<BR>Tired of spam? Yahoo! Mail has
 the best spam protection around <BR>http://mail.yahoo.com   <div>  <HR>    <div></div>_______________________________________________<BR>Winpcap-users mailing list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE>_______________________________________________<BR>Winpcap-users mailing list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE><BR><p>
                <hr size=1>Share your photos with the people who matter at <a href="http://photos.yahoo.ca"><b>Yahoo! Canada Photos</b></a>