[Winpcap-users] argument of type "MYSQL_RES *" is incompatible with parameter of type const char

WeiJie Royce penril_3 at hotmail.com
Fri Jan 13 01:28:42 PST 2012


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);	 } 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winpcap.org/pipermail/winpcap-users/attachments/20120113/9f32cb33/attachment-0001.html>


More information about the Winpcap-users mailing list