[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,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,

View File

@ -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_

View File

@ -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) ;
}

View File

@ -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) ;
}