-
Notifications
You must be signed in to change notification settings - Fork 0
/
chunkybar.h
71 lines (57 loc) · 1.56 KB
/
chunkybar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef CHUNKYBAR_H
#define CHUNKYBAR_H
typedef struct {
void *first_chunk;
unsigned int max;
} chunkybar_t;
/**
* @param max The amount we are expecting to count to
* @return initialised counter */
void *chunky_new(const unsigned int max);
/**
* @param max The amount we are expecting to count to */
void chunky_set_max(chunkybar_t* me, const unsigned int max);
/**
* Free all memory held */
void chunky_free(void *ra);
/**
* @return number of non-contiginous chunks */
int chunky_get_num_chunks(
const chunkybar_t * prog);
/**
* Mark this chunk as complete */
void chunky_mark_complete(
chunkybar_t * prog,
const unsigned int offset,
const unsigned int len);
/**
* Mark this chunk as incomplete */
void chunky_mark_incomplete(
chunkybar_t * prog,
const unsigned int offset,
const unsigned int len);
/**
* Mark everything as incomplete */
void chunky_mark_all_incomplete(chunkybar_t * me);
/**
* Is everything complete? */
int chunky_is_complete(
const chunkybar_t * prog);
/**
* Get an incomplete chunk */
void chunky_get_incomplete(
const chunkybar_t * prog,
unsigned int *offset,
unsigned int *len,
const unsigned int max);
unsigned int chunky_get_nbytes_completed(
const chunkybar_t * prog);
/**
* @return 1 if we have this chunk, 0 otherwise */
int chunky_have(
const chunkybar_t * prog,
const unsigned int offset,
const unsigned int len);
void chunky_print_contents(
const chunkybar_t * prog);
#endif /* CHUNKYBAR_H */