misc: refactor
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,5 @@
|
|||||||
.cache
|
.cache
|
||||||
generate_json.py
|
generate_json.py
|
||||||
ft_ping
|
ft_ping
|
||||||
|
*.o
|
||||||
|
|
||||||
|
|||||||
@@ -50,11 +50,12 @@ static int ft_recv(const int sock, const uint16_t seq, const double start, const
|
|||||||
}
|
}
|
||||||
fill_timestamp_array(&stats, time);
|
fill_timestamp_array(&stats, time);
|
||||||
stats.n_packet_recv++;
|
stats.n_packet_recv++;
|
||||||
if (!quiet)
|
if (quiet)
|
||||||
printf("%d bytes from %s: icmp_seq=%d ttl=%d time=%5.3fms\n", packet.n_bytes, inet_ntoa(packet.addr.sin_addr), packet.icmp_hdr->seq, (uint8_t)packet.data[8], time);
|
return (1);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("\e[1;31m[DEBUG]\e[1;00m recv() packet header: type:%d code:%d checksum:%x id:%d icmp_seq:%d\n", packet.icmp_hdr->type, packet.icmp_hdr->code, checksum, packet.icmp_hdr->id, packet.icmp_hdr->seq);
|
printf("\e[1;31m[DEBUG]\e[1;00m recv() packet header: type:%d code:%d checksum:%x id:%d icmp_seq:%d\n", packet.icmp_hdr->type, packet.icmp_hdr->code, checksum, packet.icmp_hdr->id, packet.icmp_hdr->seq);
|
||||||
#endif
|
#endif
|
||||||
|
printf("%d bytes from %s: icmp_seq=%d ttl=%d time=%5.3fms\n", packet.n_bytes, inet_ntoa(packet.addr.sin_addr), packet.icmp_hdr->seq, (uint8_t)packet.data[8], time);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user