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

Andreas Schmidt's avatar
Andreas Schmidt committed
4
5
6
#include <src/prrt/coding_params.h>
#include <src/prrt/packet.h>
#include <src/util/list.h>
Andreas Schmidt's avatar
Andreas Schmidt committed
7
8

typedef struct {
9
10
    uint32_t data_count;
    uint32_t redundancy_count;
Andreas Schmidt's avatar
Andreas Schmidt committed
11
    PrrtCodingParams coding_params;
12
    uint32_t largest_data_length;
13
    uint16_t base_seqno;
Andreas Schmidt's avatar
Andreas Schmidt committed
14
15
    List* data_blocks;
    List* redundancy_blocks;
16
    uint8_t is_coded;
Andreas Schmidt's avatar
Andreas Schmidt committed
17
18
19
20
21
22
} PrrtBlock;


/**
 * Allocate space for a block.
 */
23
int PrrtBlock_alloc(PrrtBlock **mblock, const PrrtCodingParams *cpar, uint16_t base_seqno);
Andreas Schmidt's avatar
Andreas Schmidt committed
24
25
26
27
28
29

/**
 * Frees the PrrtBlock data structure.
 */
void PrrtBlock_free(PrrtBlock **mblock);

30
int PrrtBlock_insert_data_packet(PrrtBlock *block_ptr, const PrrtPacket *packet_ptr);
31
int PrrtBlock_insert_redundancy_packet(PrrtBlock *block_ptr, const PrrtPacket *packet_ptr);
32

33
34
int PrrtBlock_encode_ready(const PrrtBlock *block_ptr);
int PrrtBlock_decode_ready(const PrrtBlock *block_ptr);
35
36
37

PrrtPacket *PrrtBlock_get_first_data(PrrtBlock *block_ptr);

38
39
void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno);
void PrrtBlock_decode(PrrtBlock *block_ptr);
40

41
PrrtPacket *PrrtBlock_get_first_red_data(PrrtBlock *block_ptr);
42
43

#endif //PRRT_BLOCK_H