Let's do an extra check if the mod_handle is actually valid

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Let's initialize these variables to 0

Just following recommendations of valgrind while trying to track down
a memory leak.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
How did this ever work?....

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Initialize more stuff to 0, just to make sure all goes well

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Started on reworking the database

As it turns out smnl used in my case quite some memory. Turns out
this is because of me using the ipv4 module to keep track of bandwidth
usage. This fires so much queries at the database that it can't keep
up, resulting in the query queue of smnl just filling up. Therefor I'm
going to rework some things with the database. To begin libevent monitors
PQsocket() now, so no more need for that timer. Not on master yet as it
no longer handles database reconnection because of this. Regarding the
ipv4 module issue with a lot of data, I'll likely implement some sort of
hashmap which keeps track of stuff locally and just inserts it in the
database every so often, this will require some changes to the module API
however.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
I should probably change this to our new enable_autocommit function

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Keeping track of bandwidth per hosts locally now, inserting it every 10 seconds

We now have a simple binary search tree in which we store the
hosts and keep track of the bandwidth. We now loop through this
every 10 seconds and launch the actual queries, just after this
we of course clear it so the local 'cache' of it is reset. Currently
hardcoded to 10 seconds, will probably make this a config option in
a future commit.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Made the dispatch interval a config option

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
This checks seems kind of pointless

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Let's do some sanity checks on this config option

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Some general code cleanup

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Fixed a fairly odd crash

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Implemented a binary search tree like approach for the arp module as well

Same issue as in the ipv4 module but less heavy impact, still too heavy
in my case.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Let's send the entire packet and the struct pcap_pkthdr to this callback as well

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
Merge branch 'master' into dns
Make the dns (WIP) work with the new api and rework the build progress for modules

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>