iPXE
|
Peer Content Caching and Retrieval (PeerDist) protocol multiplexer. More...
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <ipxe/uri.h>
#include <ipxe/xferbuf.h>
#include <ipxe/job.h>
#include <ipxe/peerblk.h>
#include <ipxe/peermux.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | peermux_free (struct refcnt *refcnt) |
Free PeerDist download multiplexer. More... | |
static void | peermux_close (struct peerdist_multiplexer *peermux, int rc) |
Close PeerDist download multiplexer. More... | |
static int | peermux_progress (struct peerdist_multiplexer *peermux, struct job_progress *progress) |
Report progress of PeerDist download. More... | |
static int | peermux_info_deliver (struct peerdist_multiplexer *peermux, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Receive content information. More... | |
static void | peermux_info_close (struct peerdist_multiplexer *peermux, int rc) |
Close content information interface. More... | |
static void | peermux_step (struct peerdist_multiplexer *peermux) |
Initiate multiplexed block download. More... | |
static int | peermux_block_deliver (struct peerdist_multiplexed_block *peermblk, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Receive data from multiplexed block download. More... | |
static struct xfer_buffer * | peermux_block_buffer (struct peerdist_multiplexed_block *peermblk) |
Get multiplexed block download underlying data transfer buffer. More... | |
static void | peermux_block_stat (struct peerdist_multiplexed_block *peermblk, struct peerdisc_peer *peer, struct list_head *peers) |
Record peer discovery statistics. More... | |
static void | peermux_block_close (struct peerdist_multiplexed_block *peermblk, int rc) |
Close multiplexed block download. More... | |
int | peermux_filter (struct interface *xfer, struct interface *info, struct uri *uri) |
Add PeerDist content-encoding filter. More... | |
Variables | |
static struct interface_operation | peermux_xfer_operations [] |
Data transfer interface operations. More... | |
static struct interface_descriptor | peermux_xfer_desc |
Data transfer interface descriptor. More... | |
static struct interface_operation | peermux_info_operations [] |
Content information interface operations. More... | |
static struct interface_descriptor | peermux_info_desc |
Content information interface descriptor. More... | |
static struct interface_operation | peermux_block_operations [] |
Block download data transfer interface operations. More... | |
static struct interface_descriptor | peermux_block_desc |
Block download data transfer interface descriptor. More... | |
static struct process_descriptor | peermux_process_desc |
Block download initiation process descriptor. More... | |
Peer Content Caching and Retrieval (PeerDist) protocol multiplexer.
Definition in file peermux.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Free PeerDist download multiplexer.
refcnt | Reference count |
Definition at line 46 of file peermux.c.
References peerdist_multiplexer::buffer, container_of, free, peerdist_multiplexer::uri, uri_put(), and xferbuf_free().
Referenced by peermux_filter().
|
static |
Close PeerDist download multiplexer.
peermux | PeerDist download multiplexer |
rc | Reason for close |
Definition at line 61 of file peermux.c.
References peerdist_multiplexer::block, peerdist_multiplexer::info, intf_nullify(), intf_shutdown(), PEERMUX_MAX_BLOCKS, peerdist_multiplexer::process, process_del(), rc, peerdist_multiplexed_block::xfer, and peerdist_multiplexer::xfer.
Referenced by peermux_block_close(), peermux_info_close(), peermux_info_deliver(), and peermux_step().
|
static |
Report progress of PeerDist download.
peermux | PeerDist download multiplexer |
progress | Progress report to fill in |
ongoing_rc | Ongoing job status code (if known) |
Definition at line 86 of file peermux.c.
References peerdist_statistics::local, job_progress::message, peerdist_statistics::peers, snprintf(), peerdist_multiplexer::stats, and peerdist_statistics::total.
|
static |
Receive content information.
peermux | PeerDist download multiplexer |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 109 of file peermux.c.
References peerdist_multiplexer::buffer, meta(), peermux_close(), rc, and xferbuf_deliver().
|
static |
Close content information interface.
peermux | PeerDist download multiplexer |
rc | Reason for close |
Definition at line 131 of file peermux.c.
References peerdist_multiplexer::buffer, peerdist_multiplexer::cache, DBGC, peerdist_multiplexer::info, info, peerdist_info_cache::info, intf_shutdown(), len, xfer_buffer::len, peermux_close(), peerdist_multiplexer::process, process_add(), rc, strerror(), peerdist_multiplexer::xfer, and xfer_seek().
|
static |
Initiate multiplexed block download.
peermux | PeerDist download multiplexer |
Definition at line 178 of file peermux.c.
References block, peerdist_info_cache::block, peerdist_multiplexer::busy, peerdist_multiplexer::cache, DBGC, peerdist_multiplexer::idle, info, peerdist_info_cache::info, peerdist_multiplexed_block::list, list_add_tail, list_del, list_empty, list_first_entry, peerblk_open(), peerdist_multiplexed_block::peermux, peermux_close(), peerdist_multiplexer::process, process_del(), rc, peerdist_info_cache::segment, segment, strerror(), peerdist_multiplexer::uri, and peerdist_multiplexed_block::xfer.
|
static |
Receive data from multiplexed block download.
peermblk | PeerDist multiplexed block download |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 269 of file peermux.c.
References assert(), iob_disown, meta(), peerdist_multiplexed_block::peermux, peerdist_multiplexer::xfer, xfer_deliver(), and XFER_FL_ABS_OFFSET.
|
static |
Get multiplexed block download underlying data transfer buffer.
peermblk | PeerDist multiplexed download block |
xferbuf | Data transfer buffer, or NULL on error |
Definition at line 292 of file peermux.c.
References peerdist_multiplexed_block::peermux, peerdist_multiplexer::xfer, and xfer_buffer().
|
static |
Record peer discovery statistics.
peermblk | PeerDist multiplexed block download |
peer | Selected peer (or NULL) |
peers | List of available peers |
Definition at line 308 of file peermux.c.
References count, DBGC2, peerdisc_peer::list, list_for_each_entry, peerdist_statistics::local, peerdist_multiplexed_block::peermux, peerdist_statistics::peers, peerdist_multiplexer::stats, tmp, and peerdist_statistics::total.
|
static |
Close multiplexed block download.
peermblk | PeerDist multiplexed block download |
rc | Reason for close |
Definition at line 336 of file peermux.c.
References peerdist_multiplexer::idle, intf_restart(), peerdist_multiplexed_block::list, list_add_tail, list_del, peerdist_multiplexed_block::peermux, peermux_close(), peerdist_multiplexer::process, process_add(), rc, and peerdist_multiplexed_block::xfer.
Add PeerDist content-encoding filter.
xfer | Data transfer interface |
info | Content information interface |
uri | Original URI |
rc | Return status code |
Definition at line 411 of file peermux.c.
References peerdist_multiplexer::block, peerdist_multiplexer::buffer, peerdist_multiplexer::busy, peerdist_multiplexer::cache, peerdist_raw::data, ENOMEM, peerdist_multiplexer::idle, peerdist_multiplexer::info, info, peerdist_info_cache::info, INIT_LIST_HEAD, intf_init(), intf_plug_plug(), peerdist_multiplexed_block::list, list_add_tail, peerdist_multiplexed_block::peermux, peermux_block_desc, peermux_free(), peermux_info_desc, PEERMUX_MAX_BLOCKS, peermux_process_desc, peermux_xfer_desc, peerdist_multiplexer::process, process_init_stopped(), peerdist_info::raw, ref_init, ref_put, peerdist_multiplexer::refcnt, peerdist_multiplexer::uri, uri_get(), peerdist_multiplexed_block::xfer, peerdist_multiplexer::xfer, xferbuf_umalloc_init(), and zalloc().
Referenced by http_peerdist_init().
|
static |
Data transfer interface operations.
|
static |
Data transfer interface descriptor.
Definition at line 365 of file peermux.c.
Referenced by peermux_filter().
|
static |
Content information interface operations.
|
static |
Content information interface descriptor.
Definition at line 378 of file peermux.c.
Referenced by peermux_filter().
|
static |
Block download data transfer interface operations.
|
static |
Block download data transfer interface descriptor.
Definition at line 395 of file peermux.c.
Referenced by peermux_filter().
|
static |
Block download initiation process descriptor.
Definition at line 400 of file peermux.c.
Referenced by peermux_filter().