[lib-client] Change the prefix for "owl_"

Use the prefix "owl_" instead of "owlclient_".
This commit is contained in:
Matteo Cypriani 2011-08-22 22:23:17 +02:00
parent 32d8a04ad5
commit ff17c92bfa
4 changed files with 52 additions and 54 deletions

View File

@ -16,10 +16,10 @@
* '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 owlclient_create_trx_socket(const char *const dest_ip, int owl_create_trx_socket(const char *const dest_ip,
const uint_fast16_t dest_port, const uint_fast16_t dest_port,
struct sockaddr_in *const server, struct sockaddr_in *const server,
const char *const iface) const char *const iface)
{ {
struct sockaddr_in client ; struct sockaddr_in client ;
@ -34,7 +34,7 @@ int owlclient_create_trx_socket(const char *const 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')
owlclient_use_iface(sockfd, iface) ; owl_use_iface(sockfd, iface) ;
return sockfd ; return sockfd ;
} }
@ -42,7 +42,7 @@ int owlclient_create_trx_socket(const char *const dest_ip,
/* Selects 'iface' as sending interface for the socket 'sockfd'. */ /* Selects 'iface' as sending interface for the socket 'sockfd'. */
void owlclient_use_iface(const int sockfd, const char *const iface) void owl_use_iface(const int sockfd, const char *const iface)
{ {
#ifdef __GLIBC__ #ifdef __GLIBC__
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, iface, if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, iface,
@ -66,12 +66,12 @@ void owlclient_use_iface(const int sockfd, const char *const iface)
* nb_pkt: number of packets to transmit. * nb_pkt: number of packets to transmit.
* delay: delay between two transmissions, in milliseconds. * delay: delay between two transmissions, in milliseconds.
*/ */
void owlclient_send_request(const int sockfd, void owl_send_request(const int sockfd,
const struct sockaddr_in *const server, const struct sockaddr_in *const server,
const void *const packet, const void *const packet,
const uint_fast16_t packet_size, const uint_fast16_t packet_size,
const uint_fast16_t nb_pkt, const uint_fast16_t nb_pkt,
const uint_fast32_t delay) const uint_fast32_t delay)
{ {
uint_fast16_t i ; uint_fast16_t i ;
@ -83,13 +83,13 @@ void owlclient_send_request(const int sockfd,
#endif // DEBUG #endif // DEBUG
// Transmit first packet: // Transmit first packet:
owlclient_send_packet(sockfd, server, packet, packet_size) ; owl_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 * 1000) ; // Wait during the wanted delay usleep(delay * 1000) ; // Wait during the wanted delay
owlclient_send_packet(sockfd, server, packet, packet_size) ; owl_send_packet(sockfd, server, packet, packet_size) ;
} }
#ifdef DEBUG #ifdef DEBUG
@ -99,10 +99,10 @@ void owlclient_send_request(const int sockfd,
void owlclient_send_packet(const int sockfd, void owl_send_packet(const int sockfd,
const struct sockaddr_in *const server, const struct sockaddr_in *const server,
const void *const packet, const void *const packet,
const uint_fast16_t packet_size) const uint_fast16_t packet_size)
{ {
ssize_t nsent = sendto(sockfd, packet, packet_size, 0, ssize_t nsent = sendto(sockfd, packet, packet_size, 0,
(struct sockaddr *) server, (struct sockaddr *) server,

View File

@ -14,21 +14,21 @@
/* Function headers */ /* Function headers */
int owlclient_create_trx_socket(const char *const dest_ip, int owl_create_trx_socket(const char *const dest_ip,
const uint_fast16_t dest_port, const uint_fast16_t dest_port,
struct sockaddr_in *const server, struct sockaddr_in *const server,
const char *const iface) ; const char *const iface) ;
void owlclient_use_iface(const int sockfd, const char *const iface) ; void owl_use_iface(const int sockfd, const char *const iface) ;
void owlclient_send_request(const int sockfd, void owl_send_request(const int sockfd,
const struct sockaddr_in *const server, const struct sockaddr_in *const server,
const void *const packet, const void *const packet,
const uint_fast16_t packet_size, const uint_fast16_t packet_size,
const uint_fast16_t nb_pkt, const uint_fast16_t nb_pkt,
const uint_fast32_t delay) ; const uint_fast32_t delay) ;
void owlclient_send_packet(const int sockfd, void owl_send_packet(const int sockfd,
const struct sockaddr_in *const server, const struct sockaddr_in *const server,
const void *const packet, const void *const packet,
const uint_fast16_t packet_size) ; const uint_fast16_t packet_size) ;
#endif // _LIBOWLPS_CLIENT_ #endif // _LIBOWLPS_CLIENT_

View File

@ -373,8 +373,8 @@ void print_configuration()
void create_socket() void create_socket()
{ {
sockfd = sockfd =
owlclient_create_trx_socket(options.dest_ip, options.dest_port, owl_create_trx_socket(options.dest_ip, options.dest_port,
&server, options.iface) ; &server, options.iface) ;
} }
@ -443,8 +443,8 @@ void make_packet()
void send_request() void send_request()
{ {
owlclient_send_request(sockfd, &server, packet, packet_size, owl_send_request(sockfd, &server, packet, packet_size,
options.nb_pkt, options.delay) ; options.nb_pkt, options.delay) ;
} }

View File

@ -749,9 +749,8 @@ int capture()
/* Open UDP socket to the aggregator */ /* Open UDP socket to the aggregator */
aggregation_sockfd = aggregation_sockfd =
owlclient_create_trx_socket(GET_AGGREGATION_IP(), owl_create_trx_socket(GET_AGGREGATION_IP(), GET_AGGREGATION_PORT(),
GET_AGGREGATION_PORT(), &aggregation_server, NULL) ;
&aggregation_server, NULL) ;
while (owl_run) while (owl_run)
// Capture one packet at time, and call read_packet() on it: // Capture one packet at time, and call read_packet() on it:
@ -1215,17 +1214,16 @@ void* autocalibrate_hello(void *NULL_value)
fprintf(stderr, "Autocalibration Hello thread launched.\n") ; fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
send_sockfd = send_sockfd =
owlclient_create_trx_socket(GET_AGGREGATION_IP(), owl_create_trx_socket(GET_AGGREGATION_IP(),
GET_AUTOCALIBRATION_PORT(), GET_AUTOCALIBRATION_PORT(), &serv, NULL) ;
&serv, NULL) ;
pthread_cleanup_push(&owl_close_fd, &send_sockfd) ; pthread_cleanup_push(&owl_close_fd, &send_sockfd) ;
memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ; memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ;
while (owl_run) while (owl_run)
{ {
owlclient_send_packet(send_sockfd, &serv, owl_send_packet(send_sockfd, &serv,
&message, sizeof(message)) ; &message, sizeof(message)) ;
sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ; sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
} }
@ -1250,10 +1248,10 @@ void* autocalibrate(void *NULL_value)
// Socket to send autocalibration positioning requests // Socket to send autocalibration positioning requests
autocalibration_send_sockfd = autocalibration_send_sockfd =
owlclient_create_trx_socket(GET_AUTOCALIBRATION_IP(), owl_create_trx_socket(GET_AUTOCALIBRATION_IP(),
GET_AUTOCALIBRATION_REQUEST_PORT(), GET_AUTOCALIBRATION_REQUEST_PORT(),
&autocalibration_send_server, &autocalibration_send_server,
GET_WIFI_IFACE()) ; GET_WIFI_IFACE()) ;
// Socket to receive orders from the aggregator // Socket to receive orders from the aggregator
listen_sockfd = listen_sockfd =
@ -1303,11 +1301,11 @@ 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) ;
owlclient_send_request(autocalibration_send_sockfd, owl_send_request(autocalibration_send_sockfd,
&autocalibration_send_server, &autocalibration_send_server,
packet, packet_size, packet, packet_size,
GET_AUTOCALIBRATION_NBPKT(), GET_AUTOCALIBRATION_NBPKT(),
GET_AUTOCALIBRATION_DELAY()) ; GET_AUTOCALIBRATION_DELAY()) ;
free(packet) ; free(packet) ;
} }