<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Marta, </FONT></DIV>
<DIV><FONT size=2>those are linker errors, not compilation ones.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I think you may have forgotten to add wpcap.lib into your
project settings.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Under VC2003, they are under Project->Properties,
"Linker->Input" tree item, "Additional dependencies" item.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </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> Tuesday, May 02, 2006 9:19 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Winpcap-users] Compilation
Error - Send queues</DIV>
<DIV><BR></DIV>
<DIV>Thanks Gianluca,</DIV>
<DIV> This morning I made the change you suggested, but then I got all
the following errors (and assumed this wasn't right):</DIV>
<DIV> </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> </DIV>
<DIV>I might be totally wrong, but it sounds like I am missing out some
#include directives...</DIV>
<DIV> </DIV>
<DIV>Thanks in advance,</DIV>
<DIV>Marta<BR><BR><B><I>Gianluca Varenni
<gianluca.varenni@cacetech.com></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> </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> </DIV>
<DIV><FONT size=2>Here is the patch to solve your problem (marked with
<------)</FONT></DIV>
<DIV><FONT size=2></FONT> </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; <------</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 <= 2
|| argc >= 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>Have a nice day</DIV>
<DIV>GV</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </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> 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 (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> </DIV>
<DIV>VS6.0:</DIV>
<DIV>error C2664: 'pcap_next_ex' : cannot convert parameter 3 from
'unsigned char ** ' to 'const unsigned char **
'<BR> Conversion loses
qualifiers</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>.NET2003:</DIV>
<DIV>error C2664: 'pcap_next_ex' : cannot convert parameter 3 from 'u_char
**__w64 ' to 'const u_char ** '</DIV>
<DIV><FONT size=2></FONT> </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> </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 overlooked. Any help
with be greatly appreciated,</DIV>
<DIV>Marta</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>P.S: Just in case, here it is my code</DIV>
<DIV><FONT size=2></FONT> </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> <stdlib.h></DIV></FONT><FONT
color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> <stdio.h></DIV></FONT><FONT
color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> <pcap.h></DIV></FONT><FONT
color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2>
<Win32-Extensions.h></DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> <remote-ext.h></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 <=
2 || argc >= 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
&& 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, &pktheader, &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)) < squeue->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> </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></DIV></DIV></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>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>