These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / peermux.h
1 #ifndef _IPXE_PEERMUX_H
2 #define _IPXE_PEERMUX_H
3
4 /** @file
5  *
6  * Peer Content Caching and Retrieval (PeerDist) protocol multiplexer
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12 #include <stdint.h>
13 #include <ipxe/list.h>
14 #include <ipxe/refcnt.h>
15 #include <ipxe/interface.h>
16 #include <ipxe/process.h>
17 #include <ipxe/uri.h>
18 #include <ipxe/xferbuf.h>
19 #include <ipxe/pccrc.h>
20
21 /** Maximum number of concurrent block downloads */
22 #define PEERMUX_MAX_BLOCKS 32
23
24 /** PeerDist download content information cache */
25 struct peerdist_info_cache {
26         /** Content information */
27         struct peerdist_info info;
28         /** Content information segment */
29         struct peerdist_info_segment segment;
30         /** Content information block */
31         struct peerdist_info_block block;
32 };
33
34 /** A PeerDist multiplexed block download */
35 struct peerdist_multiplexed_block {
36         /** PeerDist download multiplexer */
37         struct peerdist_multiplexer *peermux;
38         /** List of multiplexed blocks */
39         struct list_head list;
40         /** Data transfer interface */
41         struct interface xfer;
42 };
43
44 /** A PeerDist download multiplexer */
45 struct peerdist_multiplexer {
46         /** Reference count */
47         struct refcnt refcnt;
48         /** Data transfer interface */
49         struct interface xfer;
50         /** Content information interface */
51         struct interface info;
52         /** Original URI */
53         struct uri *uri;
54
55         /** Content information data transfer buffer */
56         struct xfer_buffer buffer;
57         /** Content information cache */
58         struct peerdist_info_cache cache;
59
60         /** Block download initiation process */
61         struct process process;
62         /** List of busy block downloads */
63         struct list_head busy;
64         /** List of idle block downloads */
65         struct list_head idle;
66         /** Block downloads */
67         struct peerdist_multiplexed_block block[PEERMUX_MAX_BLOCKS];
68 };
69
70 extern int peermux_filter ( struct interface *xfer, struct interface *info,
71                             struct uri *uri );
72
73 #endif /* _IPXE_PEERMUX_H */