TianoCore EDK2 master
|
#include "Tftp.h"
Go to the source code of this file.
Macros | |
#define | IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32 |
#define | TFTP_PROGRESS_SLIDER_STEPS ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3) |
#define | TFTP_PROGRESS_MESSAGE_SIZE ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) + 12) |
#define | MTFTP_DEFAULT_BLKSIZE 512 |
#define | MTFTP_MIN_BLKSIZE 8 |
#define | MTFTP_MAX_BLKSIZE 65464 |
#define | MTFTP_DEFAULT_WINDOWSIZE 1 |
#define | MTFTP_MIN_WINDOWSIZE 1 |
#define | MTFTP_MAX_WINDOWSIZE 64 |
Functions | |
STATIC BOOLEAN | StringToUint16 (IN CONST CHAR16 *ValueStr, OUT UINT16 *Value) |
STATIC EFI_STATUS | GetNicName (IN EFI_HANDLE ControllerHandle, IN UINTN NicNumber, OUT CHAR16 *NicName) |
STATIC EFI_STATUS | CreateServiceChildAndOpenProtocol (IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, OUT EFI_HANDLE *ChildHandle, OUT VOID **Interface) |
STATIC VOID | CloseProtocolAndDestroyServiceChild (IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, IN EFI_HANDLE ChildHandle) |
STATIC EFI_STATUS | GetFileSize (IN EFI_MTFTP4_PROTOCOL *Mtftp4, IN CONST CHAR8 *FilePath, OUT UINTN *FileSize) |
STATIC EFI_STATUS | DownloadFile (IN EFI_MTFTP4_PROTOCOL *Mtftp4, IN CONST CHAR16 *FilePath, IN CONST CHAR8 *AsciiFilePath, IN UINTN FileSize, IN UINT16 BlockSize, IN UINT16 WindowSize) |
STATIC EFI_STATUS EFIAPI | CheckPacket (IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token, IN UINT16 PacketLen, IN EFI_MTFTP4_PACKET *Packet) |
SHELL_STATUS | RunTftp (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
EFI_HII_HANDLE | InitializeHiiPackage (EFI_HANDLE ImageHandle) |
Variables | |
EFI_HII_HANDLE | mTftpHiiHandle |
STATIC CONST CHAR16 | mTftpProgressFrame [] = L"[ ]" |
STATIC CONST CHAR16 | mTftpProgressDelete [] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" |
SHELL_FILE_HANDLE | mFileHandle |
CONST CHAR16 * | mLocalFilePath |
EFI_MTFTP4_CONFIG_DATA | DefaultMtftp4ConfigData |
STATIC CONST SHELL_PARAM_ITEM | ParamList [] |
The implementation for the 'tftp' Shell command.
Copyright (c) 2015, ARM Ltd. All rights reserved.
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Tftp.c.
#define MTFTP_DEFAULT_BLKSIZE 512 |
#define MTFTP_DEFAULT_WINDOWSIZE 1 |
#define MTFTP_MIN_BLKSIZE 8 |
#define MTFTP_MIN_WINDOWSIZE 1 |
#define TFTP_PROGRESS_MESSAGE_SIZE ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) + 12) |
#define TFTP_PROGRESS_SLIDER_STEPS ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3) |
STATIC EFI_STATUS EFIAPI CheckPacket | ( | IN EFI_MTFTP4_PROTOCOL * | This, |
IN EFI_MTFTP4_TOKEN * | Token, | ||
IN UINT16 | PacketLen, | ||
IN EFI_MTFTP4_PACKET * | Packet | ||
) |
Update the progress of a file download This procedure is called each time a new TFTP packet is received.
[in] | This | MTFTP4 protocol interface |
[in] | Token | Parameters for the download of the file |
[in] | PacketLen | Length of the packet |
[in] | Packet | Address of the packet |
EFI_SUCCESS | All packets are accepted. |
STATIC VOID CloseProtocolAndDestroyServiceChild | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_GUID * | ServiceBindingProtocolGuid, | ||
IN EFI_GUID * | ProtocolGuid, | ||
IN EFI_HANDLE | ChildHandle | ||
) |
Close the protocol identified by its GUID on the child handle of the service identified by its service binding protocol GUID, then destroy the child handle.
STATIC EFI_STATUS CreateServiceChildAndOpenProtocol | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_GUID * | ServiceBindingProtocolGuid, | ||
IN EFI_GUID * | ProtocolGuid, | ||
OUT EFI_HANDLE * | ChildHandle, | ||
OUT VOID ** | Interface | ||
) |
Create a child for the service identified by its service binding protocol GUID and get from the child the interface of the protocol identified by its GUID.
[in] | ControllerHandle | Controller handle. |
[in] | ServiceBindingProtocolGuid | Service binding protocol GUID of the service to be created. |
[in] | ProtocolGuid | GUID of the protocol to be open. |
[out] | ChildHandle | Address where the handler of the created child is returned. NULL is returned in case of error. |
[out] | Interface | Address where a pointer to the protocol interface is returned in case of success. |
STATIC EFI_STATUS DownloadFile | ( | IN EFI_MTFTP4_PROTOCOL * | Mtftp4, |
IN CONST CHAR16 * | FilePath, | ||
IN CONST CHAR8 * | AsciiFilePath, | ||
IN UINTN | FileSize, | ||
IN UINT16 | BlockSize, | ||
IN UINT16 | WindowSize | ||
) |
Worker function that download the data of a file from a TFTP server given the path of the file and its size.
[in] | Mtftp4 | MTFTP4 protocol interface |
[in] | FilePath | Path of the file, Unicode encoded |
[in] | AsciiFilePath | Path of the file, ASCII encoded |
[in] | FileSize | Size of the file in number of bytes |
[in] | BlockSize | Value of the TFTP blksize option |
[in] | WindowSize | Value of the TFTP window size option |
EFI_SUCCESS | The file was downloaded. |
EFI_OUT_OF_RESOURCES | A memory allocation failed. |
Others | The downloading of the file from the server failed (see EFI_MTFTP4_PROTOCOL.ReadFile() status codes). |
STATIC EFI_STATUS GetFileSize | ( | IN EFI_MTFTP4_PROTOCOL * | Mtftp4, |
IN CONST CHAR8 * | FilePath, | ||
OUT UINTN * | FileSize | ||
) |
Worker function that gets the size in numbers of bytes of a file from a TFTP server before to download the file.
[in] | Mtftp4 | MTFTP4 protocol interface |
[in] | FilePath | Path of the file, ASCII encoded |
[out] | FileSize | Address where to store the file size in number of bytes. |
EFI_SUCCESS | The size of the file was returned. |
EFI_UNSUPPORTED | The server does not support the "tsize" option. |
Others | Error when retrieving the information from the server (see EFI_MTFTP4_PROTOCOL.GetInfo() status codes) or error when parsing the response of the server. |
STATIC EFI_STATUS GetNicName | ( | IN EFI_HANDLE | ControllerHandle, |
IN UINTN | NicNumber, | ||
OUT CHAR16 * | NicName | ||
) |
Get the name of the NIC.
[in] | ControllerHandle | The network physical device handle. |
[in] | NicNumber | The network physical device number. |
[out] | NicName | Address where to store the NIC name. The memory area has to be at least IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH double byte wide. |
EFI_HII_HANDLE InitializeHiiPackage | ( | EFI_HANDLE | ImageHandle | ) |
SHELL_STATUS RunTftp | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Function for 'tftp' command.
[in] | ImageHandle | Handle to the Image (NULL if Internal). |
[in] | SystemTable | Pointer to the System Table (NULL if Internal). |
EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData |
EFI_HII_HANDLE mTftpHiiHandle |
STATIC CONST SHELL_PARAM_ITEM ParamList[] |