Commit de51c319 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Properly setting index header field.

parent 64fc087f
......@@ -66,7 +66,6 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno) {
uint8_t k = block_ptr->coding_params.k;
uint8_t n = block_ptr->coding_params.n;
uint8_t r = block_ptr->coding_params.r;
uint8_t index = 0;
uint32_t length = block_ptr->largest_data_length;
PrrtCoder* coder = NULL;
......@@ -79,6 +78,7 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno) {
src[j] = malloc(sizeof(gf) * length);
memset(src[j], 0, sizeof(gf) * length);
PrrtPacket* pkt = cur->value;
pkt->index = (uint8_t) j;
memcpy(src[j], pkt->payload + PRRT_PACKET_DATA_HEADER_SIZE, pkt->payload_len - PRRT_PACKET_DATA_HEADER_SIZE);
j++;
}
......@@ -91,7 +91,8 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno) {
fec[j] = malloc(sizeof(gf) * length);
memset(fec[j], 0, sizeof(gf) * length);
PrrtCoder_encode(coder, src, fec[j], j+k, length); // gf **src, gf *fec, int index, int sz
PrrtPacket* red_packet_ptr = PrrtPacket_create_redundancy_packet(0, (void*) fec[j], length, *seqno, index, base_seqno, block_ptr->coding_params);
PrrtPacket* red_packet_ptr = PrrtPacket_create_redundancy_packet(0, (void*) fec[j], length, *seqno,
(uint8_t) (k + j), base_seqno, block_ptr->coding_params);
*seqno = *seqno+1 % SEQNO_SPACE;
PrrtBlock_insert_redundancy_packet(block_ptr, red_packet_ptr);
}
......
......@@ -346,12 +346,12 @@ int PrrtPacket_destroy(PrrtPacket *packet_ptr) {
}
int PrrtPacket_create_data_packet(PrrtPacket *packet_ptr, uint8_t priority, const void *data_ptr,
uint32_t data_len, int seqno) {
uint32_t data_len, uint16_t seqno) {
uint32_t payload_length = (uint32_t) (data_len + sizeof(PrrtPacketDataPayload));
packet_ptr->type_priority = PACKET_TYPE_DATA << 4;
packet_ptr->type_priority |= priority & 0x0F;
packet_ptr->index = 17; // TODO: replace with sensible value
packet_ptr->index = 0;
packet_ptr->seqno = seqno;
void *content_buf = malloc(sizeof(PrrtPacketDataPayload) + data_len);
......
......@@ -64,7 +64,7 @@ int PrrtPacket_print(PrrtPacket *packet_ptr);
int PrrtPacket_create_data_packet(PrrtPacket *packet_ptr, uint8_t priority, const void *data_ptr,
uint32_t data_len, int seqno);
uint32_t data_len, uint16_t seqno);
PrrtPacket *PrrtPacket_create_feedback_packet(uint8_t priority, uint8_t index, uint16_t seqno, uint32_t round_trip_time,
uint32_t forward_trip_time, uint32_t packet_loss_rate, uint16_t gap,
......
......@@ -85,7 +85,7 @@ int PrrtSocket_send(PrrtSocket *sock_ptr, const void *data, const size_t data_le
PrrtPacket *packet = malloc(sizeof(PrrtPacket));
check_mem(packet);
PrrtPacket_create_data_packet(packet, 5, data, data_len, sock_ptr->sequenceNumberSource++);
PrrtPacket_create_data_packet(packet, 5, data, (uint32_t) data_len, sock_ptr->sequenceNumberSource++);
List_push(sock_ptr->outQueue, packet);
pthread_cond_signal(&sock_ptr->outQueueFilledCv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment