iPXE
|
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/open.h>
#include <ipxe/process.h>
#include <ipxe/iobuf.h>
#include <ipxe/xfer.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_download.h>
Go to the source code of this file.
Data Structures | |
struct | efi_download_file |
A single in-progress file. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
static void | efi_download_close (struct efi_download_file *file, int rc) |
Transfer finished or was aborted. More... | |
static int | efi_download_deliver_iob (struct efi_download_file *file, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Process received data. More... | |
static EFI_STATUS EFIAPI | efi_download_start (IPXE_DOWNLOAD_PROTOCOL *This __unused, CHAR8 *Url, IPXE_DOWNLOAD_DATA_CALLBACK DataCallback, IPXE_DOWNLOAD_FINISH_CALLBACK FinishCallback, VOID *Context, IPXE_DOWNLOAD_FILE *File) |
Start downloading a file, and register callback functions to handle the download. More... | |
static EFI_STATUS EFIAPI | efi_download_abort (IPXE_DOWNLOAD_PROTOCOL *This __unused, IPXE_DOWNLOAD_FILE File, EFI_STATUS Status) |
Forcibly abort downloading a file that is currently in progress. More... | |
static EFI_STATUS EFIAPI | efi_download_poll (IPXE_DOWNLOAD_PROTOCOL *This __unused) |
Poll for more data from iPXE. More... | |
int | efi_download_install (EFI_HANDLE handle) |
Install iPXE download protocol. More... | |
void | efi_download_uninstall (EFI_HANDLE handle) |
Uninstall iPXE download protocol. More... | |
Variables | |
static EFI_GUID | ipxe_download_protocol_guid = IPXE_DOWNLOAD_PROTOCOL_GUID |
iPXE download protocol GUID More... | |
static struct interface_operation | efi_xfer_operations [] |
Data transfer interface operations. More... | |
static struct interface_descriptor | efi_download_file_xfer_desc |
EFI download data transfer interface descriptor. More... | |
static IPXE_DOWNLOAD_PROTOCOL | ipxe_download_protocol_interface |
Publicly exposed iPXE download protocol. More... | |
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
|
static |
Transfer finished or was aborted.
file | Data transfer file |
rc | Reason for close |
Definition at line 62 of file efi_download.c.
References efi_download_file::context, efi_snp_release(), EFIRC, efi_download_file::finish_callback, intf_shutdown(), rc, and efi_download_file::xfer.
Referenced by efi_download_abort().
|
static |
Process received data.
file | Data transfer file |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 79 of file efi_download.c.
References efi_download_file::context, io_buffer::data, efi_download_file::data_callback, EEFI, free_iob(), iob_len(), len, meta(), efi_download_file::pos, rc, and XFER_FL_ABS_OFFSET.
|
static |
Start downloading a file, and register callback functions to handle the download.
This | iPXE Download Protocol instance |
Url | URL to download from |
DataCallback | Callback that will be invoked when data arrives |
FinishCallback | Callback that will be invoked when the download ends |
Context | Context passed to the Data and Finish callbacks |
File | Token that can be used to abort the download |
Status | EFI status code |
Definition at line 132 of file efi_download.c.
References efi_download_file::context, efi_download_file::data_callback, efi_download_file_xfer_desc, EFI_OUT_OF_RESOURCES, efi_snp_claim(), efi_snp_release(), EFI_SUCCESS, EFIRC, efi_download_file::finish_callback, free, intf_init(), LOCATION_URI_STRING, malloc(), NULL, efi_download_file::pos, rc, efi_download_file::xfer, and xfer_open().
|
static |
Forcibly abort downloading a file that is currently in progress.
It is not safe to call this function after the Finish callback has executed.
This | iPXE Download Protocol instance |
File | Token obtained from Start |
Status | Reason for aborting the download |
Status | EFI status code |
Definition at line 176 of file efi_download.c.
References EEFI, efi_download_close(), EFI_SUCCESS, and Status.
|
static |
Poll for more data from iPXE.
This function will invoke the registered callbacks if data is available or if downloads complete.
This | iPXE Download Protocol instance |
Status | EFI status code |
Definition at line 193 of file efi_download.c.
References EFI_SUCCESS, and step().
int efi_download_install | ( | EFI_HANDLE | handle | ) |
Install iPXE download protocol.
handle | EFI handle |
rc | Return status code |
Definition at line 211 of file efi_download.c.
References EFI_SYSTEM_TABLE::BootServices, DBG, EEFI, efi_systab, handle, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, ipxe_download_protocol_guid, ipxe_download_protocol_interface, NULL, rc, and strerror().
Referenced by efi_image_exec().
void efi_download_uninstall | ( | EFI_HANDLE | handle | ) |
Uninstall iPXE download protocol.
handle | EFI handle |
Definition at line 236 of file efi_download.c.
References EFI_SYSTEM_TABLE::BootServices, efi_systab, handle, ipxe_download_protocol_guid, ipxe_download_protocol_interface, NULL, and EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces.
Referenced by efi_image_exec().
|
static |
iPXE download protocol GUID
Definition at line 34 of file efi_download.c.
Referenced by efi_download_install(), and efi_download_uninstall().
|
static |
Data transfer interface operations.
Definition at line 110 of file efi_download.c.
|
static |
EFI download data transfer interface descriptor.
Definition at line 116 of file efi_download.c.
Referenced by efi_download_start().
|
static |
Publicly exposed iPXE download protocol.
Definition at line 199 of file efi_download.c.
Referenced by efi_download_install(), and efi_download_uninstall().