[lib-client] Change function prefix (owlclient_)

Change the function prefix from "owlps_" to "owlclient_".
This commit is contained in:
Matteo Cypriani 2011-03-11 10:24:33 +01:00
parent 7c80f17b0b
commit 0045ba8a14
4 changed files with 46 additions and 44 deletions

View File

@ -12,7 +12,7 @@
* 'iface' if specified (if you want the interface to be selected, * 'iface' if specified (if you want the interface to be selected,
* automatically, this parameter should be NULL or an empty string). * automatically, this parameter should be NULL or an empty string).
*/ */
int owlps_create_socket_to_aggregator(char *dest_ip, int owlclient_create_socket_to_aggregator(char *dest_ip,
uint_fast16_t dest_port, uint_fast16_t dest_port,
struct sockaddr_in *server, struct sockaddr_in *server,
char *iface) char *iface)
@ -30,7 +30,7 @@ int owlps_create_socket_to_aggregator(char *dest_ip,
// If we specified an interface name // If we specified an interface name
if (iface != NULL && iface[0] != '\0') if (iface != NULL && iface[0] != '\0')
owlps_use_iface(sockfd, iface) ; owlclient_use_iface(sockfd, iface) ;
return sockfd ; return sockfd ;
} }
@ -38,7 +38,7 @@ int owlps_create_socket_to_aggregator(char *dest_ip,
/* Selects 'iface' as sending interface for the socket 'sockfd'. */ /* 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, if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, iface,
strlen(iface) + 1) == -1) strlen(iface) + 1) == -1)
@ -52,7 +52,7 @@ void owlps_use_iface(int sockfd, char *iface)
void owlps_send_request(int sockfd, struct sockaddr_in *server, void owlclient_send_request(int sockfd, struct sockaddr_in *server,
void *packet, uint_fast16_t packet_size, void *packet, uint_fast16_t packet_size,
uint_fast16_t nb_pkt, uint_fast32_t delay) uint_fast16_t nb_pkt, uint_fast32_t delay)
{ {
@ -63,13 +63,13 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server,
#endif // DEBUG #endif // DEBUG
// Transmit first packet: // Transmit first packet:
owlps_send_packet(sockfd, server, packet, packet_size) ; owlclient_send_packet(sockfd, server, packet, packet_size) ;
// Transmit remaining packets (if any): // Transmit remaining packets (if any):
for (i = 0 ; i < nb_pkt - 1 ; ++i) for (i = 0 ; i < nb_pkt - 1 ; ++i)
{ {
usleep(delay) ; // Wait during the wanted delay 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 #ifdef DEBUG
@ -79,7 +79,7 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server,
void owlps_send_packet(int sockfd, struct sockaddr_in *server, void owlclient_send_packet(int sockfd, struct sockaddr_in *server,
void *packet, uint_fast16_t packet_size) void *packet, uint_fast16_t packet_size)
{ {
ssize_t nsent = sendto(sockfd, packet, packet_size, 0, ssize_t nsent = sendto(sockfd, packet, packet_size, 0,

View File

@ -14,15 +14,15 @@
/* Function headers */ /* Function headers */
int owlps_create_socket_to_aggregator(char *dest_ip, int owlclient_create_socket_to_aggregator(char *dest_ip,
uint_fast16_t dest_port, uint_fast16_t dest_port,
struct sockaddr_in *server, struct sockaddr_in *server,
char *iface) ; char *iface) ;
void owlps_use_iface(int sockfd, char *iface) ; void owlclient_use_iface(int sockfd, char *iface) ;
void owlps_send_request(int sockfd, struct sockaddr_in *server, void owlclient_send_request(int sockfd, struct sockaddr_in *server,
void *packet, uint_fast16_t packet_size, void *packet, uint_fast16_t packet_size,
uint_fast16_t nb_pkt, uint_fast32_t delay) ; uint_fast16_t nb_pkt, uint_fast32_t delay) ;
void owlps_send_packet(int sockfd, struct sockaddr_in *server, void owlclient_send_packet(int sockfd, struct sockaddr_in *server,
void *packet, uint_fast16_t packet_size) ; void *packet, uint_fast16_t packet_size) ;

View File

@ -275,7 +275,8 @@ void print_configuration()
void create_socket() void create_socket()
{ {
sockfd = sockfd =
owlps_create_socket_to_aggregator(options.dest_ip, options.dest_port, owlclient_create_socket_to_aggregator(options.dest_ip,
options.dest_port,
&server, options.iface) ; &server, options.iface) ;
} }
@ -330,7 +331,7 @@ void make_packet()
void send_request() void send_request()
{ {
owlps_send_request(sockfd, &server, packet, packet_size, owlclient_send_request(sockfd, &server, packet, packet_size,
options.nb_pkt, options.delay) ; options.nb_pkt, options.delay) ;
} }

View File

@ -492,7 +492,7 @@ int capture()
/* Open UDP socket to the aggregator */ /* Open UDP socket to the aggregator */
aggregation_sockfd = aggregation_sockfd =
owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), owlclient_create_socket_to_aggregator(GET_AGGREGATION_IP(),
GET_AGGREGATION_PORT(), GET_AGGREGATION_PORT(),
&aggregation_server, NULL) ; &aggregation_server, NULL) ;
@ -922,7 +922,7 @@ void autocalibrate_hello()
fprintf(stderr, "Autocalibration Hello thread launched.\n") ; fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
send_sockfd = send_sockfd =
owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(), owlclient_create_socket_to_aggregator(GET_AGGREGATION_IP(),
GET_AUTOCALIBRATION_PORT(), GET_AUTOCALIBRATION_PORT(),
&serv, NULL) ; &serv, NULL) ;
@ -930,7 +930,8 @@ void autocalibrate_hello()
while (run) 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()) ; sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
} }
@ -952,7 +953,7 @@ void autocalibrate()
// Socket to send autocalibration positioning requests // Socket to send autocalibration positioning requests
autocalibration_send_sockfd = autocalibration_send_sockfd =
owlps_create_socket_to_aggregator(GET_AUTOCALIBRATION_IP(), owlclient_create_socket_to_aggregator(GET_AUTOCALIBRATION_IP(),
GET_AUTOCALIBRATION_REQUEST_PORT(), GET_AUTOCALIBRATION_REQUEST_PORT(),
&autocalibration_send_server, &autocalibration_send_server,
GET_WIFI_IFACE()) ; GET_WIFI_IFACE()) ;
@ -1001,7 +1002,7 @@ void send_autocalibration_request()
uint8_t *packet ; uint8_t *packet ;
uint_fast16_t packet_size = make_packet(&packet) ; uint_fast16_t packet_size = make_packet(&packet) ;
owlps_send_request(autocalibration_send_sockfd, owlclient_send_request(autocalibration_send_sockfd,
&autocalibration_send_server, &autocalibration_send_server,
packet, packet_size, packet, packet_size,
GET_AUTOCALIBRATION_NBPKT(), GET_AUTOCALIBRATION_NBPKT(),