<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>.hmmessage P {
PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
FONT-FAMILY: Tahoma; FONT-SIZE: 10pt
}
</style><style id="owaParaStyle">P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body class="hmmessage" ocsi="0" fPStyle="1">
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 10pt">
<p>This has nothing to do with winpcap. You're doing your mysql wrong. The result you have is NOT a string yet.</p>
<p> </p>
<p>You need to read a bit more about how to get the result from your query.</p>
<p> </p>
<p>I think this has a pretty clear example.</p>
<p><a href="http://www.tol.it/doc/MySQL/chapter4.html" target="_blank">http://www.tol.it/doc/MySQL/chapter4.html</a></p>
<div>
<p> </p>
<div style="FONT-FAMILY: Tahoma; FONT-SIZE: 13px">
<p>Michael D. Black</p>
<p>Senior Scientist</p>
<p>Advanced Analytics Directorate</p>
<p>Advanced GEOINT Solutions Operating Unit</p>
<p>Northrop Grumman Information Systems</p>
</div>
</div>
<hr tabindex="-1">
<div style="DIRECTION: ltr" id="divRpF797246"><font color="#000000" size="2" face="Tahoma"><b>From:</b> winpcap-users-bounces@winpcap.org [winpcap-users-bounces@winpcap.org] on behalf of WeiJie Royce [penril_3@hotmail.com]<br>
<b>Sent:</b> Friday, January 13, 2012 3:28 AM<br>
<b>To:</b> winpcap-users@winpcap.org<br>
<b>Subject:</b> EXT :[Winpcap-users] argument of type "MYSQL_RES *" is incompatible with parameter of type const char<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi guys,
<div><br>
</div>
<div>i'm working on a project that requires WinPcap to cature data traffic flowing from all the virtual machines. I'm almost done with the program and it has filtering. The only thing i face now is that i'm having this error. </div>
<div><br>
</div>
<div>argument of type "MYSQL_RES *" is incompatible with parameter of type const char</div>
<div><br>
</div>
<div>my objective is to extract data out from the database. I did it and stored it into filter_exp but it doesn't work. The codes highlighted in red has an error that i've mentioned on top. Let's see how i declare filter_exp. how do i make it in a way when
i receive the result from the database. it will just insert whatever value into filter_exp. any conversion needed?</div>
<div><span style="FONT-SIZE: 10pt"><br>
</span></div>
<div><span style="FONT-SIZE: 10pt"><br>
</span></div>
<div><span style="FONT-SIZE: 10pt">--------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div><span style="FONT-SIZE: 10pt">This part has no errors.</span></div>
<div><span style="FONT-SIZE: 10pt">-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></div>
<div><span style="FONT-SIZE: 10pt">MYSQL_RES *filter_exp;</span></div>
<div><span style="FONT-SIZE: 10pt"><br>
</span></div>
<div>
<div>MYSQL *conn; // pointer to MySQL structure</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>conn = mysql_init(NULL); // connection handle</div>
<div> </div>
<div> </div>
<div><br>
</div>
<div> // Connect to MySQL database</div>
<div> &nb sp;// host address = localhost, username = root, database = project</div>
<div> mysql_real_connect(conn, "localhost", "root", "", "project", 0, NULL, 0); </div>
<div><br>
</div>
<div><br>
</div>
<div> mysql_query(conn, "SELECT Filter FROM setting"); /* Send a query to the database. */</div>
<div> filter_exp = mysql_store_result(conn); /* Receive the result and store it in filter_exp */</div>
<div> mysql_free_result(filter_exp);<span style="WHITE-SPACE: pre" class="Apple-tab-span">
</span>// free the resources</div>
<div> </div>
<div><br>
</div>
<div> sprintf(cmd6, "DELETE FROM start");</div>
<div> mysql_real_query(conn, cmd6 , strlen(cmd6));</div>
<br>
<br>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- &nb sp; --<b><br>
</b><strong> <b><br>
</b><br>
</strong><br>
<div> /* </div>
<div> * Compiling + setting the filter</div>
<div> *</div>
<div> */</div>
<div><br>
</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>if (lDevice->addresses != NULL)</div>
<div> ; /* Retrieve the mask of the first address of the interface */</div>
<div> net=((struct sockaddr_in *)(lDevice->addresses->netmask))->sin_addr.S_un.S_addr;</div>
<div> else</div>
<div> /* If the interface is without an address we suppose to be in a C class network */</div>
<div> net=0xffffff;</div>
<div><br>
</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>if (pcap_compile(lIFCHandle, &lFCode,
<font color="#ff0000"><b>filter_exp</b></font> , 0, net) == -1) {</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>return(2);</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>}</div>
<div><span class="Apple-tab-span"></span>if (pcap_setfilter(lIFCHandle, &lFCode) == -1) {</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>return(2);</div>
<div><span style="WHITE-SPACE: pre" class="Apple-tab-span"></span>}</div>
</div>
</div>
</div>
</div>
</body>
</html>