misc: refactor

This commit is contained in:
2025-04-10 18:33:43 +02:00
parent 0811342010
commit ca02562a96
2 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@@ -2,4 +2,5 @@
.cache .cache
generate_json.py generate_json.py
ft_ping ft_ping
*.o

View File

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