Esempio n. 1
0
int main(int argc, const char * argv[]){

	//	system("pwd");
	//	system("ls -al");


	struct mac_list p;

	mac_list_init();
	mac_list_add("XX.XX.XX.A1");
	mac_list_add("XX.XX.XX.A2");
	mac_list_add("XX.XX.XX.A3");
	mac_list_add("XX.XX.XX.A4");


	printf("count %d\n", mac_list_count());

	return 0;
}
Esempio n. 2
0
//check
struct mac_list *mac_list_check(char item[18], int flag){


	if(list_top == MAC_LIST_TAIL){

#ifdef mac_check
		if(flag == 0){

		mac_list_add(item, 0);
		return list_top;
		
		}else{
		mac_list_add(item,1);
		return list_top;
		}

#else

		mac_list_add(item);
		return list_top;

#endif
	}else{
		struct mac_list *p;
		p = list_top;
		while(p!= MAC_LIST_TAIL){

			if(strcmp(p->mac_add, item) == 0){

				return p;
			}
			p = mac_list_next(p);
		}

#ifdef mac_check
		if(flag == 0){

		mac_list_add(item, 0);
		return p;
		
		}else{
		mac_list_add(item, 1);
		return p;
		}
#else
		mac_list_add(item);
		return p;

#endif

	}

}
Esempio n. 3
0
/* we have received an inbound message containing an eth_beacon from another
 * box, as indicated by the protocol field in the message.
 * refresh the mac address entry in our list of received eth_beacons,
 * so that it won't time out over the next 10 seconds.  (if the box stays
 * alive and connected to us, we should see more eth_beacons from it
 * within 10 seconds, affirming that it is still alive.)
 */
void eth_util_process_message(unsigned char *message)
{
    mac_list_add(&beacons, &message[sizeof(struct ethhdr)],
                 &message[sizeof(struct ethhdr) + 6], 0, NULL, true);
}