From 22ee24655a44d67670eb993df5473adb6da9ba1d Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Mon, 28 Feb 2011 17:00:53 +0100 Subject: [PATCH] [i-c] Remove ap_ip_addr from autocalibration_hello The listener does not send its IP address explicitly in the Hello message anymore. Instead, the aggregator now extract the source address of the Hello packet. --- .../owlps-aggregator/owlps-aggregatord.c | 8 ++++++-- infrastructure-centred/owlps-listener/owlps-listenerd.c | 1 - libowlps/owlps.h | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c index 899c572..2bd2633 100644 --- a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c +++ b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c @@ -693,6 +693,7 @@ void listen_for_aps(void) struct sockaddr_in client; // UDP client structure socklen_t client_len = sizeof(client) ; // Size of clients autocalibration_hello message ; + char ap_ip_addr[16] ; #ifdef DEBUG fprintf(stderr, "Autocalibration Hello thread launched.\n") ; @@ -720,11 +721,14 @@ void listen_for_aps(void) continue ; } + strncpy(ap_ip_addr, inet_ntoa(client.sin_addr), 16) ; + #ifdef DEBUG - fprintf(stderr, "Got a Hello message.\n") ; + fprintf(stderr, "Got a Hello message from « %s »\n", + ap_ip_addr) ; #endif // DEBUG - update_ap(message.ap_mac_addr_bytes, message.ap_ip_addr) ; + update_ap(message.ap_mac_addr_bytes, ap_ip_addr) ; } (void) close(listen_sockfd) ; diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index 1e9b432..f462da6 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -925,7 +925,6 @@ void autocalibrate_hello() &serv, NULL) ; memcpy(&message.ap_mac_addr_bytes, my_mac, 6) ; - strncpy(message.ap_ip_addr, my_ip, 16) ; while (run) { diff --git a/libowlps/owlps.h b/libowlps/owlps.h index 421e225..2ab5094 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -92,7 +92,6 @@ typedef struct _request typedef struct _autocalibration_hello { unsigned char ap_mac_addr_bytes[6]; - char ap_ip_addr[16] ; } autocalibration_hello ; typedef struct _autocalibration_order