diff --git a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c index bb5c746..d1e4ed8 100644 --- a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c +++ b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c @@ -602,10 +602,10 @@ void got_couple_info(couple_message message) { while (tmp_couple != NULL) { // Research criterion: MAC and transmission time - if(mac_cmp(message.mobile_mac_addr_bytes, - tmp_couple->mobile_mac_addr_bytes) == 1 - && sub_date(message.request_time, - tmp_couple->request_time) == 0) + if (mac_equals(message.mobile_mac_addr_bytes, + tmp_couple->mobile_mac_addr_bytes) == 1 + && sub_date(message.request_time, + tmp_couple->request_time) == 0) break ; // If the couple exists, we stop on it tmp_couple = tmp_couple->next ; } @@ -616,10 +616,10 @@ void got_couple_info(couple_message message) { // Research criterion: MAC addresses equals and reception // times on the APs less than 10 ms // TODO : define an option for the maximal difference time. - if(mac_cmp(message.mobile_mac_addr_bytes, - tmp_couple->mobile_mac_addr_bytes) == 1 - && sub_date(message.start_time, - tmp_couple->request_time) <= 10) + if (mac_equals(message.mobile_mac_addr_bytes, + tmp_couple->mobile_mac_addr_bytes) == 1 + && sub_date(message.start_time, + tmp_couple->request_time) <= 10) break ; // If the couple exists, we stop on it tmp_couple = tmp_couple->next ; } @@ -777,7 +777,7 @@ ap_list* find_ap(unsigned char mac_addr_bytes[6]) found = token_aps ; do { - if (mac_cmp(found->mac_addr_bytes, mac_addr_bytes)) + if (mac_equals(found->mac_addr_bytes, mac_addr_bytes)) return found ; found = found->next ; } diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index f3420a1..63731c4 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -625,7 +625,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, memcpy(couple.mobile_mac_addr_bytes, &data[rtap_bytes+10], 6) ; // Drop the packet if it comes from the AP itself: - if (mac_cmp(my_mac, couple.mobile_mac_addr_bytes)) + if (mac_equals(my_mac, couple.mobile_mac_addr_bytes)) return ; memcpy(couple.ap_mac_addr_bytes, my_mac, 6) ; // Copy AP MAC diff --git a/libowlps/libowlps.c b/libowlps/libowlps.c index c14d6e4..dbd001a 100644 --- a/libowlps/libowlps.c +++ b/libowlps/libowlps.c @@ -132,7 +132,7 @@ unsigned long sub_date(struct timeval sup, struct timeval inf) * Compares two MAC addresses. * Returns TRUE if they are identical, FALSE otherwise. */ -BOOL mac_cmp(unsigned char *mac1, unsigned char *mac2) +BOOL mac_equals(unsigned char *mac1, unsigned char *mac2) { int i ; for(i=0 ; i < 6 ; i++) diff --git a/libowlps/owlps.h b/libowlps/owlps.h index c23bbc4..ad1747f 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -213,12 +213,14 @@ BOOL run ; /* Function headers */ -// Tool functions +// Misc char* mac_bytes_to_string(unsigned char *mac_binary) ; +BOOL mac_equals(unsigned char *mac1, unsigned char *mac2) ; char frequency_to_channel(unsigned short channel) ; + +// Time unsigned long long timeval_to_ms(struct timeval date) ; unsigned long sub_date(struct timeval sup, struct timeval inf) ; -BOOL mac_cmp(unsigned char *mac1, unsigned char *mac2) ; // Network int create_udp_sending_socket(char *server_address, int server_port, diff --git a/mobile-centred/librtapscanmob/librtapscanmob.c b/mobile-centred/librtapscanmob/librtapscanmob.c index 49b40e2..50837dd 100644 --- a/mobile-centred/librtapscanmob/librtapscanmob.c +++ b/mobile-centred/librtapscanmob/librtapscanmob.c @@ -247,7 +247,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *p { while(tmp_mac != NULL) { - if(mac_cmp(mac_addr_bytes, tmp_mac->mac_addr_bytes) == 1) + if (mac_equals(mac_addr_bytes, + tmp_mac->mac_addr_bytes) == 1) break ; tmp_mac = tmp_mac->next ; }