streamers / chunk_signaling.h @ b865a917
History | View | Annotate | Download (1.36 KB)
1 |
#ifndef CHUNK_SIGNALING_H
|
---|---|
2 |
#define CHUNK_SIGNALING_H
|
3 |
|
4 |
#include "chunkidset.h" |
5 |
|
6 |
//Type of signaling message
|
7 |
//Request a ChunkIDSet
|
8 |
#define MSG_SIG_REQ 0 |
9 |
//Diliver a ChunkIDSet (reply to a request)
|
10 |
#define MSG_SIG_DEL 1 |
11 |
//Offer a ChunkIDSet
|
12 |
#define MSG_SIG_OFF 2 |
13 |
//Accept a ChunkIDSet (reply to an offer)
|
14 |
#define MSG_SIG_ACC 3 |
15 |
//Receive the BufferMap
|
16 |
#define MSG_SIG_BMOFF 4 |
17 |
//Request the BufferMap
|
18 |
#define MSG_SIG_BMREQ 5 |
19 |
|
20 |
|
21 |
struct sig_nal {
|
22 |
uint8_t type;//type of signal.
|
23 |
uint8_t max_deliver;//Max number of chunks to deliver.
|
24 |
uint16_t cb_size; |
25 |
uint16_t trans_id;//future use...
|
26 |
uint8_t third_peer;//for buffer map exchange from other peers, just the first byte!
|
27 |
} __attribute__((packed)); |
28 |
|
29 |
|
30 |
int sigParseData(const struct nodeID *from_id, uint8_t *buff, int buff_len); |
31 |
|
32 |
//int sendBufferMap(const struct nodeID *to_id, const struct nodeID *owner_id, ChunkIDSet *bmap, int cb_size, int trans_id);
|
33 |
|
34 |
//int sendMyBufferMap(const struct nodeID *to_id, ChunkIDSet *bmap, int cb_size, int trans_id);
|
35 |
|
36 |
//int offerChunks(const struct nodeID *to_id, struct chunkID_set *cset, int max_deliver, int trans_id);
|
37 |
|
38 |
//int acceptChunks(const struct nodeID *to_id, struct chunkID_set *cset, int max_deliver, int trans_id);
|
39 |
|
40 |
/**
|
41 |
* Init the chunk signaling stuff...
|
42 |
*
|
43 |
*
|
44 |
* @param myID address of this peer
|
45 |
* @return >= 0 on success, <0 on error
|
46 |
*/
|
47 |
int sigInit(struct nodeID *myID); |
48 |
|
49 |
#endif
|