#include "packet_io.h" #include "session_manager.h" #include "plugin_manager.h" #include "http.h" struct packet_io_loop_arg { struct packet_io_device *dev; int thread_id; }; void packet_io_loop(struct packet_io_loop_arg *arg) { struct packet *rx_pkt; struct session_event *event; while(1) { int fetch_num = packet_io_rx(arg->dev, arg->thread_id, &rx_pkt, 1); if(fetch_num > 0) { event = session_manager_commit(rx_pkt); while(event) { plugin_manager_dispatch(event); event = session_manager_fetch_event(); } //clean session_manager event queue packet_io_tx(arg->dev, arg->thread_id, &rx_pkt, 1); } else { //dispatch to time event //dispatch to trigger polling event } } return; } struct packet_io_device *packet_io_init(int worker_thread_num, const char *instance_name, const char *device_name) { struct packet_io_instance * instance = packet_io_create(PACKET_IO_PCAP, instance_name); struct packet_io_device *dev = packet_io_open_device(instance, device_name, worker_thread_num, worker_thread_num); return dev; } int main(int argc, char ** argv) { //config_manager_init session_manager_session_event_register(http_decoder, SESSION_TYPE_HTTP); //packet_io_init //create_worker_thread //main_loop return 0; }