diff --git a/infrastructure-centred/libowlps-client/libowlps-client.c b/infrastructure-centred/libowlps-client/libowlps-client.c index a3e1566..919e678 100644 --- a/infrastructure-centred/libowlps-client/libowlps-client.c +++ b/infrastructure-centred/libowlps-client/libowlps-client.c @@ -12,10 +12,10 @@ * 'iface' if specified (if you want the interface to be selected, * automatically, this parameter should be NULL or an empty string). */ -int owlps_create_socket_to_aggregator(char *dest_ip, - uint_fast16_t dest_port, - struct sockaddr_in *server, - char *iface) +int owlclient_create_socket_to_aggregator(char *dest_ip, + uint_fast16_t dest_port, + struct sockaddr_in *server, + char *iface) { struct sockaddr_in client ; @@ -28,9 +28,9 @@ int owlps_create_socket_to_aggregator(char *dest_ip, exit(ERR_CREATING_SOCKET) ; } - // If we specified an interface name + // If we specified an interface name if (iface != NULL && iface[0] != '\0') - owlps_use_iface(sockfd, iface) ; + owlclient_use_iface(sockfd, iface) ; return sockfd ; } @@ -38,7 +38,7 @@ int owlps_create_socket_to_aggregator(char *dest_ip, /* Selects 'iface' as sending interface for the socket 'sockfd'. */ -void owlps_use_iface(int sockfd, char *iface) +void owlclient_use_iface(int sockfd, char *iface) { if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, iface, strlen(iface) + 1) == -1) @@ -52,9 +52,9 @@ void owlps_use_iface(int sockfd, char *iface) -void owlps_send_request(int sockfd, struct sockaddr_in *server, - void *packet, uint_fast16_t packet_size, - uint_fast16_t nb_pkt, uint_fast32_t delay) +void owlclient_send_request(int sockfd, struct sockaddr_in *server, + void *packet, uint_fast16_t packet_size, + uint_fast16_t nb_pkt, uint_fast32_t delay) { uint_fast16_t i ; @@ -63,13 +63,13 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server, #endif // DEBUG // Transmit first packet: - owlps_send_packet(sockfd, server, packet, packet_size) ; + owlclient_send_packet(sockfd, server, packet, packet_size) ; // Transmit remaining packets (if any): for (i = 0 ; i < nb_pkt - 1 ; ++i) { usleep(delay) ; // Wait during the wanted delay - owlps_send_packet(sockfd, server, packet, packet_size) ; + owlclient_send_packet(sockfd, server, packet, packet_size) ; } #ifdef DEBUG @@ -79,8 +79,8 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server, -void owlps_send_packet(int sockfd, struct sockaddr_in *server, - void *packet, uint_fast16_t packet_size) +void owlclient_send_packet(int sockfd, struct sockaddr_in *server, + void *packet, uint_fast16_t packet_size) { ssize_t nsent = sendto(sockfd, packet, packet_size, 0, (struct sockaddr *) server, diff --git a/infrastructure-centred/libowlps-client/owlps-client.h b/infrastructure-centred/libowlps-client/owlps-client.h index 7d0941d..f19a178 100644 --- a/infrastructure-centred/libowlps-client/owlps-client.h +++ b/infrastructure-centred/libowlps-client/owlps-client.h @@ -14,16 +14,16 @@ /* Function headers */ -int owlps_create_socket_to_aggregator(char *dest_ip, - uint_fast16_t dest_port, - struct sockaddr_in *server, - char *iface) ; -void owlps_use_iface(int sockfd, char *iface) ; -void owlps_send_request(int sockfd, struct sockaddr_in *server, - void *packet, uint_fast16_t packet_size, - uint_fast16_t nb_pkt, uint_fast32_t delay) ; -void owlps_send_packet(int sockfd, struct sockaddr_in *server, - void *packet, uint_fast16_t packet_size) ; +int owlclient_create_socket_to_aggregator(char *dest_ip, + uint_fast16_t dest_port, + struct sockaddr_in *server, + char *iface) ; +void owlclient_use_iface(int sockfd, char *iface) ; +void owlclient_send_request(int sockfd, struct sockaddr_in *server, + void *packet, uint_fast16_t packet_size, + uint_fast16_t nb_pkt, uint_fast32_t delay) ; +void owlclient_send_packet(int sockfd, struct sockaddr_in *server, + void *packet, uint_fast16_t packet_size) ; #endif // _LIBOWLPS_CLIENT_ diff --git a/infrastructure-centred/owlps-client/owlps-client.c b/infrastructure-centred/owlps-client/owlps-client.c index 39c5a49..17ec590 100644 --- a/infrastructure-centred/owlps-client/owlps-client.c +++ b/infrastructure-centred/owlps-client/owlps-client.c @@ -275,8 +275,9 @@ void print_configuration() void create_socket() { sockfd = - owlps_create_socket_to_aggregator(options.dest_ip, options.dest_port, - &server, options.iface) ; + owlclient_create_socket_to_aggregator(options.dest_ip, + options.dest_port, + &server, options.iface) ; } @@ -330,8 +331,8 @@ void make_packet() void send_request() { - owlps_send_request(sockfd, &server, packet, packet_size, - options.nb_pkt, options.delay) ; + owlclient_send_request(sockfd, &server, packet, packet_size, + options.nb_pkt, options.delay) ; } diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index 9905440..f27feb8 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -492,9 +492,9 @@ int capture() /* Open UDP socket to the aggregator */ aggregation_sockfd = - owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), - GET_AGGREGATION_PORT(), - &aggregation_server, NULL) ; + owlclient_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: @@ -922,15 +922,16 @@ void autocalibrate_hello() fprintf(stderr, "Autocalibration Hello thread launched.\n") ; send_sockfd = - owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), - GET_AUTOCALIBRATION_PORT(), - &serv, NULL) ; + owlclient_create_socket_to_aggregator(GET_AGGREGATION_IP(), + GET_AUTOCALIBRATION_PORT(), + &serv, NULL) ; memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, 6) ; while (run) { - owlps_send_packet(send_sockfd, &serv, &message, sizeof(message)) ; + owlclient_send_packet(send_sockfd, &serv, + &message, sizeof(message)) ; sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ; } @@ -952,10 +953,10 @@ void autocalibrate() // Socket to send autocalibration positioning requests autocalibration_send_sockfd = - owlps_create_socket_to_aggregator(GET_AUTOCALIBRATION_IP(), - GET_AUTOCALIBRATION_REQUEST_PORT(), - &autocalibration_send_server, - GET_WIFI_IFACE()) ; + owlclient_create_socket_to_aggregator(GET_AUTOCALIBRATION_IP(), + GET_AUTOCALIBRATION_REQUEST_PORT(), + &autocalibration_send_server, + GET_WIFI_IFACE()) ; // Socket to receive orders from the aggregator listen_sockfd = @@ -1001,11 +1002,11 @@ void send_autocalibration_request() uint8_t *packet ; uint_fast16_t packet_size = make_packet(&packet) ; - owlps_send_request(autocalibration_send_sockfd, - &autocalibration_send_server, - packet, packet_size, - GET_AUTOCALIBRATION_NBPKT(), - GET_AUTOCALIBRATION_DELAY()) ; + owlclient_send_request(autocalibration_send_sockfd, + &autocalibration_send_server, + packet, packet_size, + GET_AUTOCALIBRATION_NBPKT(), + GET_AUTOCALIBRATION_DELAY()) ; free(packet) ; }