summaryrefslogtreecommitdiff
path: root/netio.h
blob: 1728d4f757ec40cc7f8e2aa14617900ae60bab3e (plain)
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
struct btchunk {		/* rbuf: request buffer */
	LIST_ENTRY(btchunk) link;
	int	ref;		/* how many peers points here */
	int	piece;		/* requested piece numer */
	u_char	*sha1;
	size_t	len;
	char	*data;

	int	nblk;		/* bitfield of blocks ? */
	int	blkdone;	/* increment by read or write
				   since that both operations
				   cannot be simultan it isn't
				   a problem */
};

// LIST_HEAD(btplist, btpiece);

struct btrequest {
	LIST_ENTRY(btrequest) link;
	struct	btpeer *peer;
	struct	btchunk *chunk;
	size_t	offset;
	size_t	length;
	size_t	transmitted;	/* howmany is already read/written */

};

// LIST_HEAD(btrlist, btrequest);