[Listener] Use lib-client functions to send Hellos

This commit is contained in:
Matteo Cypriani 2010-10-25 16:08:09 +02:00
parent cc83d36336
commit 2d62705edd
3 changed files with 8 additions and 10 deletions

View File

@ -79,9 +79,9 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server,
void owlps_send_packet(int sockfd, struct sockaddr_in *server,
char *packet, int packet_size)
void *packet, int packet_size)
{
ssize_t nsent = sendto(sockfd, (void *) packet, packet_size, 0,
ssize_t nsent = sendto(sockfd, packet, packet_size, 0,
(struct sockaddr *) server,
(socklen_t) sizeof(*server)) ;
if (nsent != (ssize_t) packet_size)

View File

@ -22,7 +22,7 @@ void owlps_send_request(int sockfd, struct sockaddr_in *server,
char *packet, int packet_size,
short nb_pkt, long delay) ;
void owlps_send_packet(int sockfd, struct sockaddr_in *server,
char *packet, int packet_size) ;
void *packet, int packet_size) ;
#endif // _LIBOWLPS_CLIENT_

View File

@ -853,25 +853,23 @@ void autocalibrate_hello()
{
int send_sockfd ;
struct sockaddr_in serv;
struct sockaddr_in client ;
socklen_t serv_len = sizeof(serv);
autocalibration_hello message ;
#ifdef DEBUG
fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
#endif // DEBUG
send_sockfd = create_udp_sending_socket(GET_AGGREGATION_IP(),
GET_AUTOCALIBRATION_PORT(),
&serv, &client) ;
send_sockfd =
owlps_create_socket_to_aggregator(GET_AGGREGATION_IP(),
GET_AUTOCALIBRATION_PORT(),
&serv, GET_WIFI_IFACE()) ;
memcpy(&message.ap_mac_addr_bytes, my_mac, 6) ;
strncpy(message.ap_ip_addr, my_ip, 16) ;
while (run)
{
sendto(send_sockfd, (void *)&message, sizeof(message), 0,
(struct sockaddr *)&serv, serv_len) ;
owlps_send_packet(send_sockfd, &serv, &message, sizeof(message)) ;
sleep(GET_AUTOCALIBRATION_HELLO_DELAY()) ;
}