#include "sCommModel.h" #include #include #include //change made in 80211s branch //doing stuff int main(void){ CommModel *model = CommModel::init(); struct in_addr addr; printf("starting...\n"); while(1) { sleep(1); //poll for info here printf("main thread:\tcalling get_all_nodes\n"); std::vector allNodes = model->get_all_nodes(); printf("main thread:\tget_all_nodes call completed\n"); for(int i = 0; i < allNodes.size(); i++) { addr.s_addr = allNodes[i]->ip_addr; printf("%s neighbors:\n", inet_ntoa(addr)); printf("main thread:\tcalling get_neighbors\n"); std::vector allNeighbors = model->get_neighbors(allNodes[i]); printf("main thread:\tget_neighbors call completed\n"); for(int j = 0; j < allNeighbors.size(); j++) { addr.s_addr = ntohl(allNeighbors[j]->ip_addr); mac_t *mac = &(allNeighbors[j]->mac_addr); printf("Neighbor:\t%s\t\t%02x:%02x:%02x:%02x:%02x:%02x\tinactive_time:%u\tthroughput:%d\tweight:%d\tsignal:%d\n", inet_ntoa(addr), mac->addr[0], mac->addr[1], mac->addr[2], mac->addr[3], mac->addr[4], mac->addr[5], model->get_inactive_time(allNodes[i], allNeighbors[j]), model->get_throughput(allNodes[i], allNeighbors[j]), model->get_weight(allNodes[i], allNeighbors[j]) , model->get_signal_strength(allNodes[i], allNeighbors[j])); free(allNeighbors[j]); } free(allNodes[i]); printf("main thread:\tprinting neighbors for this nodecompleted\n"); } printf("main thread:\tprinting all nodes compeleted\n"); } return 0; }