Off-topic, but here goes.
You have to exctract a 'const char *' from 'filter_exp'. A MYSQL_RES is not a
'const char *'. I think you have to extract the string(s) using
'mysql_fetch_row(filter_exp)'.
mysql_free_result(filter_exp); // free the resources
Can you do this before you've finished extracting from 'filter_exp'?
Btw. Your message formatting looks like shit. Hence this reply also looks like
shit.
Use 'quoted-printable' and no HTML please.
--gv
--------------------------------------
From: "WeiJie Royce" <[email protected]>
To: <[email protected]>
Sent: Friday, January 13, 2012 10:28 AM
Subject: [Winpcap-users] argument of type "MYSQL_RES *" is incompatible with
parameter of type const char
Hi guys,
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.
argument of type "MYSQL_RES *" is incompatible with parameter of type const char
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?
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------This
part has no
errors.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------MYSQL_RES
*filter_exp;
MYSQL *conn; // pointer to MySQL structure
conn = mysql_init(NULL); // connection handle
// Connect to MySQL database // host address = localhost, username = root,
database = project mysql_real_connect(conn,
"localhost", "root", "", "project", 0, NULL, 0);
mysql_query(conn, "SELECT Filter FROM setting"); /* Send a query to the
database. */ filter_exp = mysql_store_result(conn); /*
Receive the result and store it in filter_exp */
mysql_free_result(filter_exp); // free the resources
sprintf(cmd6, "DELETE FROM start"); mysql_real_query(conn, cmd6 ,
strlen(cmd6));
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--
/* * Compiling + setting the filter * */
if (lDevice->addresses != NULL) /* Retrieve the mask of the first
address of the interface */ net=((struct
sockaddr_in *)(lDevice->addresses->netmask))->sin_addr.S_un.S_addr; else
/* If the interface is without an address we
suppose to be in a C class network */ net=0xffffff;
if (pcap_compile(lIFCHandle, &lFCode, filter_exp , 0, net) == -1) { fprintf(stderr,
"Couldn't parse filter %s: %s\n", filter_exp,
pcap_geterr(lIFCHandle)); return(2); } if (pcap_setfilter(lIFCHandle, &lFCode) ==
-1) { fprintf(stderr, "Couldn't install filter
%s: %s\n", filter_exp, pcap_geterr(lIFCHandle)); return(2); }
_______________________________________________
Winpcap-users mailing list
[email protected]
https://www.winpcap.org/mailman/listinfo/winpcap-users