From d2b2a0adaece9a1d9efedda3c99c03c386582a84 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 17 Aug 2015 13:16:40 +0100 Subject: [peerdist] Add block download multiplexer Signed-off-by: Michael Brown --- src/include/ipxe/errfile.h | 1 + src/include/ipxe/peermux.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/include/ipxe/peermux.h (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h index 3dae8e177..e21c95938 100644 --- a/src/include/ipxe/errfile.h +++ b/src/include/ipxe/errfile.h @@ -254,6 +254,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define ERRFILE_httpdigest ( ERRFILE_NET | 0x00440000 ) #define ERRFILE_peerdisc ( ERRFILE_NET | 0x00450000 ) #define ERRFILE_peerblk ( ERRFILE_NET | 0x00460000 ) +#define ERRFILE_peermux ( ERRFILE_NET | 0x00470000 ) #define ERRFILE_image ( ERRFILE_IMAGE | 0x00000000 ) #define ERRFILE_elf ( ERRFILE_IMAGE | 0x00010000 ) 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 +#include +#include +#include +#include +#include +#include +#include + +/** 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 */ -- cgit v1.2.3-55-g7522