Major refactor
This commit is contained in:
21
ft_ping.h
21
ft_ping.h
@@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -13,6 +16,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#define PACKET_SIZE 64
|
||||
|
||||
struct icmp_header
|
||||
{
|
||||
uint8_t type;
|
||||
@@ -21,3 +26,19 @@ struct icmp_header
|
||||
uint16_t id;
|
||||
uint16_t seq;
|
||||
};
|
||||
|
||||
struct packet_stats
|
||||
{
|
||||
uint16_t n_packet_sent;
|
||||
uint16_t n_packet_recv;
|
||||
double timestamp_array[65536];
|
||||
};
|
||||
|
||||
uint16_t calculate_checksum(uint16_t *data, int len);
|
||||
double get_timestamp();
|
||||
struct in_addr get_addr_by_hostname(char *hostname);
|
||||
double get_stddev(double *timestamp_array);
|
||||
void fill_timestamp_array(struct packet_stats *sockstats, double time);
|
||||
double get_avg(double *timestamp_array);
|
||||
double get_min(double *timestamp_array);
|
||||
double get_max(double *timestamp_array);
|
||||
|
||||
Reference in New Issue
Block a user