Add: more commentary & clean code

This commit is contained in:
vauden
2024-11-19 19:22:38 +01:00
parent 0058189d72
commit 0811342010
4 changed files with 14 additions and 7 deletions

View File

@@ -52,23 +52,30 @@ struct flags
};
// PACKET UTILS
uint16_t make_checksum(uint16_t *data, int len);
/* Returns the checksum of data*/
uint16_t make_checksum(const uint16_t *data, int len);
/* Get the address of hostname from the host data base */
struct in_addr get_addr_by_hostname(char *hostname);
bool parse_packet(struct net_packet packet, uint16_t seq, uint16_t checksum);
// MATH
/* Returns the standard deviation of timestamp_array*/
double get_stddev(const double *timestamp_array);
/* Returns the average value of timestamp_array*/
double get_avg(const double *timestamp_array);
/* Returns the smallest value of timestamp_array*/
double get_min(const double *timestamp_array);
/* Returns the biggest value of timestamp_array*/
double get_max(const double *timestamp_array);
long ft_atoi(const char *nptr);
// VERBOSE
void print_help(void);
bool parse_opt(int argc, char **argv, struct flags *flags);
void print_packet_error(struct net_packet packet);
// STATS
void print_recap(char *ip, const struct packet_stats stats);
/* Add time into the timestamp_array in sockstats*/
void fill_timestamp_array(struct packet_stats *sockstats, double time);
/* Returns the current time*/
double get_timestamp();