Skip to content
Extraits de code Groupes Projets
Valider ced86048 rédigé par Vany Ingenzi's avatar Vany Ingenzi
Parcourir les fichiers

Merge branch 'FEC_implem' of https://forge.uclouvain.be/sdemeesterde/project_trtp into FEC_implem

parents b2d12ec8 066e1a46
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -7,8 +7,8 @@ HEADERS_DIR = -Iheaders
LDFLAGS = -lz
# Adapt these as you want to fit with your project
SENDER_SOURCES = $(wildcard src/sender.c src/log.c src/our_utils.c src/packet_interface.c src/sender_utils.c)
RECEIVER_SOURCES = $(wildcard src/receiver.c src/log.c src/our_utils.c src/packet_interface.c src/receiver_utils.c)
SENDER_SOURCES = $(wildcard src/sender.c src/log.c src/utils.c src/packet_interface.c src/sender_utils.c)
RECEIVER_SOURCES = $(wildcard src/receiver.c src/log.c src/utils.c src/packet_interface.c src/receiver_utils.c)
SENDER_OBJECTS = $(SENDER_SOURCES:.c=.o)
RECEIVER_OBJECTS = $(RECEIVER_SOURCES:.c=.o)
......
......@@ -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;) {
......
#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].
......
......@@ -21,7 +21,7 @@
#include <unistd.h>
#include "log.h"
#include "our_utils.h"
#include "utils.h"
#include "packet_interface.h"
......
......@@ -173,7 +173,7 @@ int main(int argc, char **argv) {
if (state->last_pkt_sent == CLOSING_PKT)
{
gettimeofday(&closing_pkt_sent_time, NULL);
DEBUG("A timer of -> %dms <- has started after sending the last FEC pkt !", SENDER_INACTIVE_TIMEOUT);
DEBUG("A timer of -> %dms <- has started after sending the last PTYPE_DATA pkt !", SENDER_INACTIVE_TIMEOUT);
}
}
else if (pfd->revents & POLLOUT)
......
......@@ -13,7 +13,7 @@
#include <unistd.h>
#include "log.h"
#include "our_utils.h"
#include "utils.h"
#include "packet_interface.h"
......
#include <arpa/inet.h>
#include <zlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "packet_interface.h"
int main(int argc, char const *argv[])
{
if (argc < 2)
return 1;
pkt_t * pkt = pkt_new();
int err = pkt_decode(argv[1], 10, pkt);
printf("Returned %d\n", err);
return 0;
}
#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)
{
......
/**
* @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;
......
......@@ -27,6 +27,17 @@ MODES=(
'without_FEC'
)
ERROR_RATE=20
CUT_RATE=30
DELAY=0
JITTER=0
LOSS_RATE=25
echo -e "The linksimulator paramateres are:
\t\t-ERROR RATE: ${ERROR_RATE}% \t-DELAY: ${DELAY}ms
\t\t-CUT RATE: ${CUT_RATE}% \t-JITTER: ${JITTER}ms
\t\t-LOSS RATE: ${LOSS_RATE}%\n"
for MODE in "${MODES[@]}"; do
mkdir "${TEST_OUTPUT_FILES}/${MODE}/" 2>/dev/null
......@@ -45,11 +56,12 @@ for MODE in "${MODES[@]}"; do
port1=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
port2=$(comm -23 <(seq 65000 65200 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
# We first launch the link simulator
./linksimulator/link_sim -p $port2 -P $port1 -l 25 -d 0 -e 20 -c 30 \
##### Launching the link simulator #####
./linksimulator/link_sim -p $port2 -P $port1 -l $LOSS_RATE -d $DELAY -e $ERROR_RATE -c $CUT_RATE -j $JITTER \
&>${DIR}/adv_${BSN_PRE}_link.log & link_pid=$!
# We launch the receiver and capture its output
##### Launching the receiver and capturinig its output #####
valgrind --leak-check=full --log-file=${DIR}/adv_valgrind_${BSN_PRE}_receiver.log \
./receiver ::1 $port1 -s ${DIR}/${BSN_PRE}_receiver_stats.csv 1> ${DIR}/adv_${BSN_PRE}_received_file.${BSN_EXT} \
2> ${DIR}/adv_${BSN_PRE}_receiver.log & receiver_pid=$!
......@@ -105,16 +117,16 @@ for MODE in "${MODES[@]}"; do
echo "Binary difference between the 2 files: (expected vs actual)"
diff -C 9 <(od -Ax -t x1z ${FILENAME}) <(od -Ax -t x1z ${DIR}/adv_${BSN_PRE}_received_file.${BSN_EXT})
if [ $MODE = "with_FEC" ]; then
echo -e "${RED}The transfer with FEC activated has failed!${NC}"
echo -e "${RED}The transfer (with FEC) has failed!${NC}"
else
echo -e "${RED}The transfer without FEC being activated has failed!${NC}"
echo -e "${RED}The transfer (without FEC) has failed!${NC}"
fi
exit 1
else
if [ $MODE = "with_FEC" ]; then
echo -e "${GREEN}The transfer with FEC activated has succeeded!${NC}"
echo -e "${GREEN}The transfer (with FEC) has succeeded!${NC}"
else
echo -e "${GREEN}The transfer without FEC being activated has succeeded!${NC}"
echo -e "${GREEN}The transfer (without FEC) has succeeded!${NC}"
fi
fi
done
......
#!/bin/bash
BROWN='\033[0;33m'
NC='\033[0m'
# Note that this assumes to be called from the Makefile, you may want to adapt it.
FILESIZE=""
TEST_FILES_DIR=./tests_files/
......@@ -14,35 +17,49 @@ if [ -d ./unwanted_logs/ ]; then
rm -rdf ./unwanted_logs
fi
# We want our tests to always use valgrind
#echo -e "\nStarting simple tests ...\n"
#for FILENAME in "$TEST_FILES_DIR"/*
#do
# FILESIZE=$(stat -c%s "$FILENAME")
# echo -e "Sending $FILENAME \t\t [$FILESIZE bytes], \t\t with Valgrind"
# ./tests/simple_test.sh $FILENAME
simple_test_files=(
'tests_files/greeting.txt'
'tests_files/long_message.txt'
'tests_files/smile.png'
'tests_files/thumbs-up-nod.gif'
)
advanced_test_files=(
'tests_files/greeting.txt'
'tests_files/long_message.txt'
'tests_files/noice.gif'
)
# echo -e "\nStarting simple tests ...\n"
# i=1
# for FILENAME in "${simple_test_files[@]}"; do
# FILESIZE=$(stat -c%s "$FILENAME")
# echo -e "${BROWN}($i/${#simple_test_files[@]}) Sending \"$FILENAME\" \t[$FILESIZE bytes] with Valgrind${NC}"
# ./tests/simple_test.sh $FILENAME
# if [ $? -ne 0 ]; then
# echo "Tests terminated cause of a failed test"
# exit 0
# fi
# if [ $? -ne 0 ]; then
# echo "Tests terminated cause of a failed test"
# exit 0
# fi
# let i++
#done
#echo -e "Finished Simple tests."
# done
echo -e "Finished Simple tests."
if [ -d linksimulator/ ]; then
echo -e "\nStarting advanced tests ...\n"
# Now we ran the advanced tests
for FILENAME in "$TEST_FILES_DIR"/*
do
i=1
for FILENAME in "${advanced_test_files[@]}"; do
FILESIZE=$(stat -c%s "$FILENAME")
echo -e "Sending $FILENAME \t\t [$FILESIZE bytes], \t\t with linksimulator and Valgrind"
echo -e "\n${BROWN}($i/${#advanced_test_files[@]}) Sending the file \"$FILENAME\" \t[$FILESIZE bytes] with linksimulator and Valgrind${NC}"
./tests/advanced_test.sh $FILENAME
if [ $? -ne 0 ]; then
echo "Tests terminated cause of a failed test"
exit 0
fi
fi
let i++
done
echo "Finished Advanced tests."
else
......
......@@ -6,14 +6,14 @@ ahead. So good luck have a nice day of testing and remember : Tough Times Never
PS: Drink a beer when you pass the test. Share your knowledge to others, computer
science isn't a field for selfishness. If you want to switch to Law, Economy, some shit
Hi Vany I love reading from you. As you know I'm working sometime a bit late in the night.
In a few hour you'll be in the famous "Salle Intel" to be really productive as you are.
Hi Vany I'm pleased to read some news from you. As you know I work sometime a bit late in the night.
In a few hour you'll show up in the famous "Salle Intel" to be really productive as you are.
Best regards,
Samuel
Sorry to be lazy but I'll past down what is above
Sorry to be lazy but I'll past down what is above :')
Hello I'm a good friend, I've seen that you are writing a protocol named TRTP.
How is it going ? Hard ? Good for you. See life is full of hard things just like your
......@@ -23,9 +23,7 @@ ahead. So good luck have a nice day of testing and remember : Tough Times Never
PS: Drink a beer when you pass the test. Share your knowledge to others, computer
science isn't a field for selfishness. If you want to switch to Law, Economy, some shit
Hi Vany I love reading from you. As you know I'm working sometime a bit late in the night.
In a few hour you'll be in the famous "Salle Intel" to be really productive as you are.
Hi Vany I'm pleased to read some news from you. As you know I work sometime a bit late in the night.
In a few hour you'll show up in the famous "Salle Intel" to be really productive as you are.
Best regards,
Samuel
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter