block.h 1.12 KB
Newer Older
1 2 3
#ifndef PRRT_BLOCK_H
#define PRRT_BLOCK_H

Andreas Schmidt's avatar
Andreas Schmidt committed
4
#include "codingParams.h"
5 6
#include "packet.h"
#include "../util/list.h"
Andreas Schmidt's avatar
Andreas Schmidt committed
7

8
typedef struct prrtBlock {
9
    PrrtCodingParams codingParams;
10 11
    prrtPacketLength_t largestDataLength;
    prrtSequenceNumber_t baseSequenceNumber;
12 13
    List*dataPackets;
    List*redundancyPackets;
14
    bool isCoded;
Andreas Schmidt's avatar
Andreas Schmidt committed
15 16 17 18 19 20
} PrrtBlock;


/**
 * Allocate space for a block.
 */
21
PrrtBlock * PrrtBlock_create(const PrrtCodingParams *cpar, prrtSequenceNumber_t baseSequenceNumber);
Andreas Schmidt's avatar
Andreas Schmidt committed
22 23 24 25

/**
 * Frees the PrrtBlock data structure.
 */
Andreas Schmidt's avatar
Andreas Schmidt committed
26
void PrrtBlock_destroy(PrrtBlock *mblock);
Andreas Schmidt's avatar
Andreas Schmidt committed
27

28 29
bool PrrtBlock_insert_data_packet(PrrtBlock *prrtBlock, const PrrtPacket *prrtPacket);
bool PrrtBlock_insert_redundancy_packet(PrrtBlock *prrtBlock, const PrrtPacket *prrtPacket);
30

31 32
bool PrrtBlock_encode_ready(const PrrtBlock *block_ptr);
bool PrrtBlock_decode_ready(const PrrtBlock *block_ptr);
33 34 35

PrrtPacket *PrrtBlock_get_first_data(PrrtBlock *block_ptr);

36
void PrrtBlock_encode(PrrtBlock *block_ptr, prrtSequenceNumber_t *seqno);
37
bool PrrtBlock_decode(PrrtBlock *block_ptr);
38

39
PrrtPacket *PrrtBlock_get_first_red_data(PrrtBlock *block_ptr);
40 41

#endif //PRRT_BLOCK_H