<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><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 class="Apple-tab-span" style="white-space:pre"> </span> conn = mysql_init(NULL); // connection handle</div><div> </div><div> </div><div><br></div><div> // Connect to MySQL database</div><div> // 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 class="Apple-tab-span" style="white-space:pre"> </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> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --<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 class="Apple-tab-span" style="white-space:pre"> </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 class="Apple-tab-span" style="white-space:pre"> </span> if (pcap_compile(lIFCHandle, &lFCode, <font color="#ff0000"><b>filter_exp</b></font> , 0, net) == -1) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> return(2);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> if (pcap_setfilter(lIFCHandle, &lFCode) == -1) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> return(2);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div></div> </div></body>
</html>