diff options
author | Michael Brown <mcb30@ipxe.org> | 2015-08-17 13:16:40 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2015-08-17 13:24:39 +0100 |
commit | d2b2a0adaece9a1d9efedda3c99c03c386582a84 (patch) | |
tree | 4767901404c9d1ec7e0ef608fca5e716e29418d2 /src/include/ipxe/peermux.h | |
parent | 4d032d5db8ef7e6713991afbc2388f0be21abd48 (diff) | |
download | ipxe-d2b2a0adaece9a1d9efedda3c99c03c386582a84.tar.gz |
[peerdist] Add block download multiplexer
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/peermux.h')
-rw-r--r-- | src/include/ipxe/peermux.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/include/ipxe/peermux.h b/src/include/ipxe/peermux.h new file mode 100644 index 000000000..44cbdb9d6 --- /dev/null +++ b/src/include/ipxe/peermux.h @@ -0,0 +1,73 @@ +#ifndef _IPXE_PEERMUX_H +#define _IPXE_PEERMUX_H + +/** @file + * + * Peer Content Caching and Retrieval (PeerDist) protocol multiplexer + * + */ + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); + +#include <stdint.h> +#include <ipxe/list.h> +#include <ipxe/refcnt.h> +#include <ipxe/interface.h> +#include <ipxe/process.h> +#include <ipxe/uri.h> +#include <ipxe/xferbuf.h> +#include <ipxe/pccrc.h> + +/** Maximum number of concurrent block downloads */ +#define PEERMUX_MAX_BLOCKS 32 + +/** PeerDist download content information cache */ +struct peerdist_info_cache { + /** Content information */ + struct peerdist_info info; + /** Content information segment */ + struct peerdist_info_segment segment; + /** Content information block */ + struct peerdist_info_block block; +}; + +/** A PeerDist multiplexed block download */ +struct peerdist_multiplexed_block { + /** PeerDist download multiplexer */ + struct peerdist_multiplexer *peermux; + /** List of multiplexed blocks */ + struct list_head list; + /** Data transfer interface */ + struct interface xfer; +}; + +/** A PeerDist download multiplexer */ +struct peerdist_multiplexer { + /** Reference count */ + struct refcnt refcnt; + /** Data transfer interface */ + struct interface xfer; + /** Content information interface */ + struct interface info; + /** Original URI */ + struct uri *uri; + + /** Content information data transfer buffer */ + struct xfer_buffer buffer; + /** Content information cache */ + struct peerdist_info_cache cache; + + /** Block download initiation process */ + struct process process; + /** List of busy block downloads */ + struct list_head busy; + /** List of idle block downloads */ + struct list_head idle; + /** Block downloads */ + struct peerdist_multiplexed_block block[PEERMUX_MAX_BLOCKS]; +}; + +extern int peermux_filter ( struct interface *xfer, struct interface *info, + struct uri *uri ); + +#endif /* _IPXE_PEERMUX_H */ |