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

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

parents 211457c7 6a02a94d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#define MAX_PAYLOAD_SIZE 512 #define MAX_PAYLOAD_SIZE 512
/* Taille maximale de Window */ /* Taille maximale de Window */
#define MAX_WINDOW_SIZE 31 #define MAX_WINDOW_SIZE 31
/* Taille maximale de seqnum */
#define MAX_SEQNUM_SIZE 255
#define member_size(type, member) sizeof((((type *) NULL)->member)) #define member_size(type, member) sizeof((((type *) NULL)->member))
......
...@@ -49,7 +49,7 @@ int main(int argc, char **argv) { ...@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
DEBUG_DUMP("Some bytes", 11); // You can use it with any pointer type DEBUG_DUMP("Some bytes", 11); // You can use it with any pointer type
// This is not an error per-se. // This is not an error per-se.
ERROR("Sender has following arguments: \tfilename is %s,\n\t stats_filename is %s,\n\t fec_enabled is %d,\n\t receiver_ip is %s,\n\t receiver_port is %u", ERROR("Sender has following arguments: \n\tfilename is %s,\n\t stats_filename is %s,\n\t fec_enabled is %d,\n\t receiver_ip is %s,\n\t receiver_port is %u\n",
filename, stats_filename, fec_enabled, receiver_ip, receiver_port); filename, stats_filename, fec_enabled, receiver_ip, receiver_port);
DEBUG("You can only see me if %s", "you built me using `make debug`"); DEBUG("You can only see me if %s", "you built me using `make debug`");
...@@ -87,17 +87,21 @@ int main(int argc, char **argv) { ...@@ -87,17 +87,21 @@ int main(int argc, char **argv) {
// *** Step: Time for sending *** // *** Step: Time for sending ***
// pkt_t buffer[MAX_WINDOW_SIZE]; // pkt_t buffer[MAX_WINDOW_SIZE]; not used for now
// int buffer_space = MAX_WINDOW_SIZE; int buffer_space = MAX_WINDOW_SIZE;
// int seqnum = 0; int seqnum = 0;
pkt_t *pkt = pkt_new(); pkt_t *pkt = pkt_new();
ssize_t nbr_byte_read = read(fd, pkt->payload, MAX_PAYLOAD_SIZE); ssize_t nbr_byte_read = read(fd, pkt->payload, MAX_PAYLOAD_SIZE);
while (nbr_byte_read > 0) while (nbr_byte_read > 0)
{ {
// *** Step: Prepare the paquet to be send *** // *** Step: Prepare the packet to be send ***
pkt_set_type(pkt, PTYPE_DATA); pkt_set_type(pkt, PTYPE_DATA);
pkt_set_tr(pkt, 0);
pkt_set_window(pkt, buffer_space);
pkt_set_length(pkt, nbr_byte_read); pkt_set_length(pkt, nbr_byte_read);
pkt_set_seqnum(pkt, (seqnum++) % MAX_SEQNUM_SIZE);
pkt_set_timestamp(pkt, 0); // We're free to use as we want
// We set the TR to 0 in order to calculcate the CRC on the header // We set the TR to 0 in order to calculcate the CRC on the header
char modified_header[8]; char modified_header[8];
......
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