struct timeval last_ping_sent;
bool host_up;
struct sockaddr_in dest;
- unsigned int sent_packets;
- unsigned int recvd_packets;
/* TODO: Why are we using both a linked list AND an array for this data? */
/* Linked list */
if (i < 0 || i != cc) {
if (i<0) fprintf(stderr, "WARN: Failed sending ICMP packet to %s.\n", p->name);
}
- p->sent_packets++;
}
}
p = p->next;
}
if (icmp->icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == (getpid() & 0xFFFF) && icmp->icmp_seq == p->socket) {
- p->recvd_packets++;
memcpy(&p->last_ping_received, &tv, sizeof(tv));
exit(EXIT_FAILURE);
}
- hosts[i]->sent_packets = 0;
- hosts[i]->recvd_packets = 0;
hosts[i]->socket = -1;
hosts[i]->next = NULL;
if (i>0) hosts[i-1]->next = hosts[i];