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
|
#ifndef BTPD_STREAM_H
#define BTPD_STREAM_H
typedef int (*fdcb_t)(const char *, int *, void *);
typedef void (*hashcb_t)(uint32_t, uint8_t *, void *);
struct bt_stream {
struct metainfo *meta;
fdcb_t fd_cb;
void *fd_arg;
unsigned index;
off_t t_off;
off_t f_off;
int fd;
};
int bts_open(struct bt_stream **res, struct metainfo *meta, fdcb_t fd_cb,
void *fd_arg);
int bts_get(struct bt_stream *bts, off_t off, uint8_t *buf, size_t len);
int bts_put(struct bt_stream *bts, off_t off, const uint8_t *buf, size_t len);
int bts_close(struct bt_stream *bts);
int bts_sha(struct bt_stream *bts, off_t start, off_t length, uint8_t *hash);
int bts_hashes(struct metainfo *meta, fdcb_t fd_cb, hashcb_t hash_cb,
void *arg);
#endif
|