From 03bb5c1c6ddf0f6ea9ef3381769cc41969fc2a5d Mon Sep 17 00:00:00 2001 From: Robert Gustafsson Date: Thu, 28 Sep 2017 13:41:45 +0200 Subject: Add basic fifoqueue to buffer events --- pasad.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'pasad.c') diff --git a/pasad.c b/pasad.c index f75a336..537a804 100644 --- a/pasad.c +++ b/pasad.c @@ -1,6 +1,7 @@ #ifdef BROCCOLI #include #endif +#include "includes/fifoqueue.h" char *host_default = "127.0.0.1"; char *port_default = "47760"; @@ -14,25 +15,24 @@ bro_pasad_response(BroConn *conn, void *data, uint64* registers, uint64* uid) data = NULL; } - int -main(int argc, char **argv) + void +bro_event_listener() { - BroConn *bc; - char hostname[512]; - int fd = -1; + int fd = -1; + BroConn *bc = NULL; bro_init(NULL); - - bro_debug_calltrace = 0; - bro_debug_messages = 0; + char hostname[512]; snprintf(hostname, 512, "%s:%s", host_default, port_default); - if (! (bc = bro_conn_new_str(hostname, BRO_CFLAG_RECONNECT | BRO_CFLAG_ALWAYS_QUEUE))) { printf("Could not get Bro connection handle.\n"); exit(-1); } + bro_debug_calltrace = 0; + bro_debug_messages = 0; + bro_event_registry_add(bc, "response",(BroEventFunc) bro_pasad_response, NULL); if (! bro_conn_connect(bc)) @@ -42,11 +42,11 @@ main(int argc, char **argv) exit(-1); } - fd = bro_conn_get_fd(bc); + fd =bro_conn_get_fd(bc); fd_set rfds; setbuf(stdout,NULL); - while(1) + while(true) { FD_ZERO(&rfds); FD_SET(fd,&rfds); @@ -59,6 +59,13 @@ main(int argc, char **argv) } bro_conn_delete(bc); +} + + int +main(int argc, char **argv) +{ + Fifo_q * q = init_queue(5); + free(q); return 0; } -- cgit v1.2.1