Revision 7f5321cb chunk_signaling.h

View differences:

chunk_signaling.h
7 7
#ifndef CHUNK_SIGNALING_H
8 8
#define CHUNK_SIGNALING_H
9 9

  
10
#include "chunkidset.h"
11

  
12
//Type of signaling message
13
//Request a ChunkIDSet
14
#define MSG_SIG_REQ 0
15
//Diliver a ChunkIDSet (reply to a request)
16
#define MSG_SIG_DEL 1
17
//Offer a ChunkIDSet
18
#define MSG_SIG_OFF 2
19
//Accept a ChunkIDSet (reply to an offer)
20
#define MSG_SIG_ACC 3
21
//Receive the BufferMap
22
#define MSG_SIG_BMOFF 4
23
//Request the BufferMap
24
#define MSG_SIG_BMREQ 5
25

  
26

  
27
struct sig_nal {
28
    uint8_t type;//type of signal.
29
    uint8_t max_deliver;//Max number of chunks to deliver.
30
    uint16_t cb_size;
31
    uint16_t trans_id;//future use...
32
    uint8_t third_peer;//for buffer map exchange from other peers, just the first byte!
33
} __attribute__((packed));
34

  
35

  
36 10
int sigParseData(const struct nodeID *from_id, uint8_t *buff, int buff_len);
37 11

  
38
//int sendBufferMap(const struct nodeID *to_id, const struct nodeID *owner_id, ChunkIDSet *bmap, int cb_size, int trans_id);
39

  
40
//int sendMyBufferMap(const struct nodeID *to_id, ChunkIDSet *bmap, int cb_size, int trans_id);
41

  
42
//int offerChunks(const struct nodeID *to_id, struct chunkID_set *cset, int max_deliver, int trans_id);
43

  
44
//int acceptChunks(const struct nodeID *to_id, struct chunkID_set *cset, int max_deliver, int trans_id);
45

  
46
/**
47
  * Init the chunk signaling stuff...
48
  *
49
  *
50
  * @param myID address of this peer
51
  * @return >= 0 on success, <0 on error
52
  */
53
int sigInit(struct nodeID *myID);
54

  
55 12
#endif

Also available in: Unified diff