1 #ifndef _IPXE_PEERMUX_H
2 #define _IPXE_PEERMUX_H
6 * Peer Content Caching and Retrieval (PeerDist) protocol multiplexer
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 #include <ipxe/list.h>
14 #include <ipxe/refcnt.h>
15 #include <ipxe/interface.h>
16 #include <ipxe/process.h>
18 #include <ipxe/xferbuf.h>
19 #include <ipxe/pccrc.h>
21 /** Maximum number of concurrent block downloads */
22 #define PEERMUX_MAX_BLOCKS 32
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;
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;
44 /** A PeerDist download multiplexer */
45 struct peerdist_multiplexer {
46 /** Reference count */
48 /** Data transfer interface */
49 struct interface xfer;
50 /** Content information interface */
51 struct interface info;
55 /** Content information data transfer buffer */
56 struct xfer_buffer buffer;
57 /** Content information cache */
58 struct peerdist_info_cache cache;
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];
70 extern int peermux_filter ( struct interface *xfer, struct interface *info,
73 #endif /* _IPXE_PEERMUX_H */