[lib-client] Change the prefix for "owl_"
Use the prefix "owl_" instead of "owlclient_".
This commit is contained in:
parent
32d8a04ad5
commit
ff17c92bfa
|
@ -16,10 +16,10 @@
|
|||
* 'iface' if specified (if you want the interface to be selected,
|
||||
* automatically, this parameter should be NULL or an empty string).
|
||||
*/
|
||||
int owlclient_create_trx_socket(const char *const dest_ip,
|
||||
const uint_fast16_t dest_port,
|
||||
struct sockaddr_in *const server,
|
||||
const char *const iface)
|
||||
int owl_create_trx_socket(const char *const dest_ip,
|
||||
const uint_fast16_t dest_port,
|
||||
struct sockaddr_in *const server,
|
||||
const char *const iface)
|
||||
{
|
||||
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 (iface != NULL && iface[0] != '\0')
|
||||
owlclient_use_iface(sockfd, iface) ;
|
||||
owl_use_iface(sockfd, iface) ;
|
||||
|
||||
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'. */
|
||||
void owlclient_use_iface(const int sockfd, const char *const iface)
|
||||
void owl_use_iface(const int sockfd, const char *const iface)
|
||||
{
|
||||
#ifdef __GLIBC__
|
||||
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.
|
||||
* delay: delay between two transmissions, in milliseconds.
|
||||
*/
|
||||
void owlclient_send_request(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size,
|
||||
const uint_fast16_t nb_pkt,
|
||||
const uint_fast32_t delay)
|
||||
void owl_send_request(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size,
|
||||
const uint_fast16_t nb_pkt,
|
||||
const uint_fast32_t delay)
|
||||
{
|
||||
uint_fast16_t i ;
|
||||
|
||||
|
@ -83,13 +83,13 @@ void owlclient_send_request(const int sockfd,
|
|||
#endif // DEBUG
|
||||
|
||||
// Transmit first packet:
|
||||
owlclient_send_packet(sockfd, server, packet, packet_size) ;
|
||||
owl_send_packet(sockfd, server, packet, packet_size) ;
|
||||
|
||||
// Transmit remaining packets (if any):
|
||||
for (i = 0 ; i < nb_pkt - 1 ; ++i)
|
||||
{
|
||||
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
|
||||
|
@ -99,10 +99,10 @@ void owlclient_send_request(const int sockfd,
|
|||
|
||||
|
||||
|
||||
void owlclient_send_packet(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size)
|
||||
void owl_send_packet(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size)
|
||||
{
|
||||
ssize_t nsent = sendto(sockfd, packet, packet_size, 0,
|
||||
(struct sockaddr *) server,
|
||||
|
|
|
@ -14,21 +14,21 @@
|
|||
|
||||
|
||||
/* Function headers */
|
||||
int owlclient_create_trx_socket(const char *const dest_ip,
|
||||
const uint_fast16_t dest_port,
|
||||
struct sockaddr_in *const server,
|
||||
const char *const iface) ;
|
||||
void owlclient_use_iface(const int sockfd, const char *const iface) ;
|
||||
void owlclient_send_request(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size,
|
||||
const uint_fast16_t nb_pkt,
|
||||
const uint_fast32_t delay) ;
|
||||
void owlclient_send_packet(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size) ;
|
||||
int owl_create_trx_socket(const char *const dest_ip,
|
||||
const uint_fast16_t dest_port,
|
||||
struct sockaddr_in *const server,
|
||||
const char *const iface) ;
|
||||
void owl_use_iface(const int sockfd, const char *const iface) ;
|
||||
void owl_send_request(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size,
|
||||
const uint_fast16_t nb_pkt,
|
||||
const uint_fast32_t delay) ;
|
||||
void owl_send_packet(const int sockfd,
|
||||
const struct sockaddr_in *const server,
|
||||
const void *const packet,
|
||||
const uint_fast16_t packet_size) ;
|
||||
|
||||
|
||||
#endif // _LIBOWLPS_CLIENT_
|
||||
|
|
|
@ -373,8 +373,8 @@ void print_configuration()
|
|||
void create_socket()
|
||||
{
|
||||
sockfd =
|
||||
owlclient_create_trx_socket(options.dest_ip, options.dest_port,
|
||||
&server, options.iface) ;
|
||||
owl_create_trx_socket(options.dest_ip, options.dest_port,
|
||||
&server, options.iface) ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,8 +443,8 @@ void make_packet()
|
|||
|
||||
void send_request()
|
||||
{
|
||||
owlclient_send_request(sockfd, &server, packet, packet_size,
|
||||
options.nb_pkt, options.delay) ;
|
||||
owl_send_request(sockfd, &server, packet, packet_size,
|
||||
options.nb_pkt, options.delay) ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -749,9 +749,8 @@ int capture()
|
|||
|
||||
/* Open UDP socket to the aggregator */
|
||||
aggregation_sockfd =
|
||||
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
||||
GET_AGGREGATION_PORT(),
|
||||
&aggregation_server, NULL) ;
|
||||
owl_create_trx_socket(GET_AGGREGATION_IP(), GET_AGGREGATION_PORT(),
|
||||
&aggregation_server, NULL) ;
|
||||
|
||||
while (owl_run)
|
||||
// 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") ;
|
||||
|
||||
send_sockfd =
|
||||
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
||||
GET_AUTOCALIBRATION_PORT(),
|
||||
&serv, NULL) ;
|
||||
owl_create_trx_socket(GET_AGGREGATION_IP(),
|
||||
GET_AUTOCALIBRATION_PORT(), &serv, NULL) ;
|
||||
pthread_cleanup_push(&owl_close_fd, &send_sockfd) ;
|
||||
|
||||
memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ;
|
||||
|
||||
while (owl_run)
|
||||
{
|
||||
owlclient_send_packet(send_sockfd, &serv,
|
||||
&message, sizeof(message)) ;
|
||||
owl_send_packet(send_sockfd, &serv,
|
||||
&message, sizeof(message)) ;
|
||||
sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
|
||||
}
|
||||
|
||||
|
@ -1250,10 +1248,10 @@ void* autocalibrate(void *NULL_value)
|
|||
|
||||
// Socket to send autocalibration positioning requests
|
||||
autocalibration_send_sockfd =
|
||||
owlclient_create_trx_socket(GET_AUTOCALIBRATION_IP(),
|
||||
GET_AUTOCALIBRATION_REQUEST_PORT(),
|
||||
&autocalibration_send_server,
|
||||
GET_WIFI_IFACE()) ;
|
||||
owl_create_trx_socket(GET_AUTOCALIBRATION_IP(),
|
||||
GET_AUTOCALIBRATION_REQUEST_PORT(),
|
||||
&autocalibration_send_server,
|
||||
GET_WIFI_IFACE()) ;
|
||||
|
||||
// Socket to receive orders from the aggregator
|
||||
listen_sockfd =
|
||||
|
@ -1303,11 +1301,11 @@ void send_autocalibration_request()
|
|||
uint8_t *packet ;
|
||||
uint_fast16_t packet_size = make_packet(&packet) ;
|
||||
|
||||
owlclient_send_request(autocalibration_send_sockfd,
|
||||
&autocalibration_send_server,
|
||||
packet, packet_size,
|
||||
GET_AUTOCALIBRATION_NBPKT(),
|
||||
GET_AUTOCALIBRATION_DELAY()) ;
|
||||
owl_send_request(autocalibration_send_sockfd,
|
||||
&autocalibration_send_server,
|
||||
packet, packet_size,
|
||||
GET_AUTOCALIBRATION_NBPKT(),
|
||||
GET_AUTOCALIBRATION_DELAY()) ;
|
||||
|
||||
free(packet) ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue