diff --git a/infrastructure-centred/owlps-listener/Makefile b/infrastructure-centred/owlps-listener/Makefile index a03a974..cd7c2d4 100644 --- a/infrastructure-centred/owlps-listener/Makefile +++ b/infrastructure-centred/owlps-listener/Makefile @@ -22,7 +22,8 @@ DEPFLAGS = -MMD XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) PICFLAG = -fPIC OWLPSFLAGS = -D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread -LIBS = -L../../libowlps -lowlps -lpcap -liw -lm +LIBS = -L../../libowlps -lowlps -L../libowlps-client -lowlps-client \ + -lpcap -liw -lm LDFLAGS = $(LIBS) $(OWLPSFLAGS) diff --git a/infrastructure-centred/owlps-listener/owlps-listener.h b/infrastructure-centred/owlps-listener/owlps-listener.h index b39d38d..51e9da5 100644 --- a/infrastructure-centred/owlps-listener/owlps-listener.h +++ b/infrastructure-centred/owlps-listener/owlps-listener.h @@ -15,6 +15,8 @@ #include "../../libowlps/owlps.h" +#include "../libowlps-client/owlps-client.h" + #include #ifdef USE_CONFIG_FILE @@ -52,7 +54,6 @@ enum {MODE_ACTIVE = 'a', MODE_PASSIVE = 'p', MODE_MIXED = 'm'} ; /* Error codes */ -#define ERR_CREATING_SOCKET 1 // Error when creating output socket #define ERR_OPENING_IFACE 2 // Error when opening capture interface #define ERR_BAD_USAGE 3 // Bad program call #define ERR_PARSING_CONFIG_FILE 4 // Error reading the configuration file diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index c3b307b..3a545e2 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -334,7 +334,6 @@ int capture() { pcap_t *handle ; // Packet capture descriptor char errbuf[PCAP_ERRBUF_SIZE] ; // Error message - struct sockaddr_in client ; // Start capture: handle = pcap_open_live(GET_RTAP_IFACE(), BUFSIZ, 1, 1000, errbuf) ; @@ -347,14 +346,9 @@ int capture() /* Open UDP socket to the aggregator */ aggregation_sockfd = - create_udp_sending_socket(GET_AGGREGATION_IP(), - GET_AGGREGATION_PORT(), - &aggregation_server, &client) ; - if (aggregation_sockfd < 0) - { - perror("Error! Cannot create socket to the aggregation server"); - return ERR_CREATING_SOCKET ; - } + owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), + GET_AGGREGATION_PORT(), + &aggregation_server, NULL) ; while(run) // Capture one packet at time, and call read_packet() on it: