🏗️」 wip: wtf is happening

This commit is contained in:
2025-08-17 21:14:31 +02:00
parent 4c13d78559
commit de4d18ccb7
4 changed files with 94 additions and 40 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include "netinet/in.h"
#include "netinet/ip_icmp.h"
#include <help.h>
#include <opt_parse.h>
@ -26,6 +27,13 @@ typedef struct {
uint16_t interval;
} options_t;
typedef struct {
struct icmphdr hdr;
char *msg;
} icmp_pckt_t;
#define MAX_WAIT_TIME 5
// TODO: implement the verbose mode !!!
#define DEFAULT_VERBOSE false
@ -38,6 +46,7 @@ typedef struct {
int send_ping(int socket, struct sockaddr_in *dest, options_t opt);
int init_socket(options_t opt);
void init_packet(char *buf, int seq, uint32_t size);
int send_icmp(int socket, char *buf, struct sockaddr_in *addr, uint32_t size);
int receive_icmp(int socket, char *buf, uint32_t size,
struct sockaddr_in *addr);