[lib] Rename mac_cmp() -> mac_equals()

This commit is contained in:
Matteo Cypriani 2011-03-10 11:12:58 +01:00
parent af1c04529d
commit 829982766d
5 changed files with 17 additions and 14 deletions

View File

@ -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 ;
}

View File

@ -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

View File

@ -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++)

View File

@ -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,

View File

@ -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 ;
}