block.h 914 Bytes
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;
Andreas Schmidt's avatar
Andreas Schmidt committed
13
14
    List* data_blocks;
    List* redundancy_blocks;
15
    uint8_t is_coded;
Andreas Schmidt's avatar
Andreas Schmidt committed
16
17
18
19
20
21
} PrrtBlock;


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

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

29
int PrrtBlock_insert_data_packet(PrrtBlock *block_ptr, const PrrtPacket *packet_ptr);
30

31
int PrrtBlock_ready(const PrrtBlock *block_ptr);
32
33
34

PrrtPacket *PrrtBlock_get_first_data(PrrtBlock *block_ptr);

35
void PrrtBlock_code(PrrtBlock *block_ptr, uint16_t *seqno);
36

37
PrrtPacket *PrrtBlock_get_first_red_data(PrrtBlock *block_ptr);
38
39

#endif //PRRT_BLOCK_H