From ad411ab1cb9d552084aca1da3bb902a92f7821a4 Mon Sep 17 00:00:00 2001 From: sdemeesterde <samuel.demeester@student.uclouvain.be> Date: Tue, 19 Apr 2022 19:51:07 +0200 Subject: [PATCH] better names ? --- src/log.c | 1 + src/receiver_utils.c | 1 + src/receiver_utils.h | 2 +- src/sender_utils.h | 2 +- src/{our_utils.c => utils.c} | 18 ++---------------- src/{our_utils.h => utils.h} | 15 +++++++-------- 6 files changed, 13 insertions(+), 26 deletions(-) rename src/{our_utils.c => utils.c} (95%) rename src/{our_utils.h => utils.h} (94%) diff --git a/src/log.c b/src/log.c index 25874a8..e73784e 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 c140b08..7a0f85d 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 ea7f499..1f77b62 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 51faccb..4013d8b 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 545d398..435fe40 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 9e51517..4d07cc1 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; -- GitLab