I installed mysql and set up a database "Bandwidthstats" and set up a table "statistics" I also created a user group16 with a password to connect to it. When i do a describe on the table "statistics" i get the following columns: Time, SourceIP, DestIP, Protocol, Port, and Packetlength. Currently I have a C program (tcpdfilter) that it piped through tcpdump to collect some network statistics.
I have played around with trying to set up the ODBC connection but is this needed if i plan on running the database and sniffer on the same host? I am just trying to find the easiest way to connect to the database through the c program. Meaning that the c program currently creates strings such as IPsource, IPdest, portnumber... etc. I would like to either have mysql calls in the function that prints these fields or pass these fields to another function like CtoSQL() to input the data from there. Is this possible? Can i just say CtoSQL(IPsource, IPdest). I am not very familiar with C and how all that stuff works. I found some examples about this but they haven't been that helpful to me so far. Also i was thinking about creating a separate c program to do this, rather than using the one that i found, but i am new makefiles and the like and i can get the c program i found working.
All i want to do is take the stated fields from tcpdfilter.c and somehow push them to my mysql database...Can anyone give me some advise?