diff --git a/src/log.c b/src/log.c index 25874a85e483f67b32d15a94547d30ba7ee6684a..e73784e105bf809c2fad0489348988d3e51dd2cd 100644 --- a/src/log.c +++ b/src/log.c @@ -4,6 +4,7 @@ #include "log.h" + /* Prints `len` bytes starting from `bytes` to stderr */ void dump(const uint8_t *bytes, size_t len) { for (size_t i = 0; i < len;) { diff --git a/src/receiver_utils.c b/src/receiver_utils.c index c140b08fa5d152d68b19e8a4c6dfb4b8272d8f73..7a0f85d848b418bf60dc47bdfa7584afbf4fa591 100644 --- a/src/receiver_utils.c +++ b/src/receiver_utils.c @@ -1,5 +1,6 @@ #include "receiver_utils.h" + /** * @brief The function is going to check if we need to send an ACK or NACK on the @pfd, * and will send at most one packet [either an ACK or NACK or nothing]. diff --git a/src/receiver_utils.h b/src/receiver_utils.h index ea7f499fa7ad1d4882316475da2bf44c9c49b540..1f77b62006483afcfa2f59ea326724f3ae2a1a43 100644 --- a/src/receiver_utils.h +++ b/src/receiver_utils.h @@ -21,7 +21,7 @@ #include <unistd.h> #include "log.h" -#include "our_utils.h" +#include "utils.h" #include "packet_interface.h" diff --git a/src/sender_utils.h b/src/sender_utils.h index 51faccb84f46f62d0c22b2c99d487946c4ea04e4..4013d8b54294ce0d4898ee2eb5763cec5445c765 100644 --- a/src/sender_utils.h +++ b/src/sender_utils.h @@ -13,7 +13,7 @@ #include <unistd.h> #include "log.h" -#include "our_utils.h" +#include "utils.h" #include "packet_interface.h" diff --git a/src/our_utils.c b/src/utils.c similarity index 95% rename from src/our_utils.c rename to src/utils.c index 545d398dfb4c070b5d0994bf57a6ea06476b6675..435fe402c2030ea21878c5dabceba6823af36347 100644 --- a/src/our_utils.c +++ b/src/utils.c @@ -1,19 +1,5 @@ -#include <arpa/inet.h> -#include <errno.h> -#include <fcntl.h> -#include <netdb.h> -#include <netinet/in.h> -#include <poll.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <unistd.h> - -#include "log.h" -#include "our_utils.h" +#include "utils.h" + const char * real_address(const char *address, struct sockaddr_in6 *rval) { diff --git a/src/our_utils.h b/src/utils.h similarity index 94% rename from src/our_utils.h rename to src/utils.h index 9e51517ca90aef6165310000462f895741d79805..4d07cc142cc7f67fb7b42b10931d56dbdcccf150 100644 --- a/src/our_utils.h +++ b/src/utils.h @@ -1,24 +1,23 @@ -/** - * @file our_utils.h - * @brief This header contains utils that were coded for the packet sending on inginious - * @date 2022-03-17 - */ -#ifndef __OUR_UTILS_H_ -#define __OUR_UTILS_H_ +#ifndef __UTILS_H_ +#define __UTILS_H_ #include <arpa/inet.h> #include <errno.h> +#include <fcntl.h> #include <netdb.h> #include <netinet/in.h> +#include <poll.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/time.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> +#include "log.h" + + typedef struct __attribute__((__packed__)) { unsigned long long int data_sent;