Functions | |
MTFTP6_BLOCK_RANGE * | Mtftp6AllocateRange (IN UINT16 Start, IN UINT16 End) |
EFI_STATUS | Mtftp6InitBlockRange (IN LIST_ENTRY *Head, IN UINT16 Start, IN UINT16 End) |
INTN | Mtftp6GetNextBlockNum (IN LIST_ENTRY *Head) |
VOID | Mtftp6SetLastBlockNum (IN LIST_ENTRY *Head, IN UINT16 Last) |
EFI_STATUS | Mtftp6RemoveBlockNum (IN LIST_ENTRY *Head, IN UINT16 Num, IN BOOLEAN Completed, OUT UINT64 *TotalBlock) |
EFI_STATUS | Mtftp6GetMapping (IN UDP_IO *UdpIo, IN EFI_UDP6_CONFIG_DATA *UdpCfgData) |
EFI_STATUS EFIAPI | Mtftp6ConfigDummyUdpIo (IN UDP_IO *UdpIo, IN VOID *Context) |
EFI_STATUS | Mtftp6ConfigUdpIo (IN UDP_IO *UdpIo, IN EFI_IPv6_ADDRESS *ServerIp, IN UINT16 ServerPort, IN EFI_IPv6_ADDRESS *LocalIp, IN UINT16 LocalPort) |
EFI_STATUS | Mtftp6SendRequest (IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) |
EFI_STATUS | Mtftp6SendError (IN MTFTP6_INSTANCE *Instance, IN UINT16 ErrCode, IN UINT8 *ErrInfo) |
VOID EFIAPI | Mtftp6OnPacketSent (IN NET_BUF *Packet, IN UDP_END_POINT *UdpEpt, IN EFI_STATUS IoStatus, IN VOID *Context) |
EFI_STATUS | Mtftp6TransmitPacket (IN MTFTP6_INSTANCE *Instance, IN NET_BUF *Packet) |
EFI_STATUS EFIAPI | Mtftp6CheckPacket (IN EFI_MTFTP6_PROTOCOL *This, IN EFI_MTFTP6_TOKEN *Token, IN UINT16 PacketLen, IN EFI_MTFTP6_PACKET *Packet) |
VOID | Mtftp6OperationClean (IN MTFTP6_INSTANCE *Instance, IN EFI_STATUS Result) |
EFI_STATUS | Mtftp6OperationStart (IN EFI_MTFTP6_PROTOCOL *This, IN EFI_MTFTP6_TOKEN *Token, IN UINT16 OpCode) |
VOID EFIAPI | Mtftp6OnTimerTick (IN EFI_EVENT Event, IN VOID *Context) |
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
MTFTP6_BLOCK_RANGE* Mtftp6AllocateRange | ( | IN UINT16 | Start, | |
IN UINT16 | End | |||
) |
Allocate a MTFTP block range, then init it to the range of [Start, End].
[in] | Start | The start block number. |
[in] | End | The last block number in the range. |
References MTFTP6_BLOCK_RANGE::Bound, MTFTP6_BLOCK_RANGE::End, MTFTP6_BLOCK_RANGE::Link, and MTFTP6_BLOCK_RANGE::Start.
Referenced by Mtftp6InitBlockRange(), and Mtftp6RemoveBlockNum().
EFI_STATUS EFIAPI Mtftp6CheckPacket | ( | IN EFI_MTFTP6_PROTOCOL * | This, | |
IN EFI_MTFTP6_TOKEN * | Token, | |||
IN UINT16 | PacketLen, | |||
IN EFI_MTFTP6_PACKET * | Packet | |||
) |
Check packet for GetInfo callback routine.
GetInfo is implemented with EfiMtftp6ReadFile. It's used to inspect the first packet from server, then abort the session.
[in] | This | The pointer to the Mtftp6 protocol. |
[in] | Token | The pointer to the Mtftp6 token. |
[in] | PacketLen | The length of the packet. |
[in] | Packet | The pointer to the received packet. |
EFI_ABORTED | Abort the Mtftp6 operation. |
References _MTFTP6_GETINFO_CONTEXT::Packet, _MTFTP6_GETINFO_CONTEXT::PacketLen, and _MTFTP6_GETINFO_CONTEXT::Status.
Referenced by EfiMtftp6GetInfo().
EFI_STATUS EFIAPI Mtftp6ConfigDummyUdpIo | ( | IN UDP_IO * | UdpIo, | |
IN VOID * | Context | |||
) |
The dummy configure routine for create a new Udp6 Io.
[in] | UdpIo | The pointer to the Udp6 Io. |
[in] | Context | The pointer to the context. |
EFI_SUCCESS | This value is always returned. |
Referenced by EfiMtftp6Configure(), and Mtftp6CreateService().
EFI_STATUS Mtftp6ConfigUdpIo | ( | IN UDP_IO * | UdpIo, | |
IN EFI_IPv6_ADDRESS * | ServerIp, | |||
IN UINT16 | ServerPort, | |||
IN EFI_IPv6_ADDRESS * | LocalIp, | |||
IN UINT16 | LocalPort | |||
) |
The configure routine for Mtftp6 instance to transmit/receive.
[in] | UdpIo | The pointer to the Udp6 Io. |
[in] | ServerIp | The pointer to the server address. |
[in] | ServerPort | The pointer to the server port. |
[in] | LocalIp | The pointer to the local address. |
[in] | LocalPort | The pointer to the local port. |
EFI_SUCCESS | Configured the Udp6 Io for Mtftp6 successfully. | |
EFI_NO_MAPPING | The corresponding Ip6 instance has not been configured yet. |
References Mtftp6GetMapping().
Referenced by Mtftp6TransmitPacket().
EFI_STATUS Mtftp6GetMapping | ( | IN UDP_IO * | UdpIo, | |
IN EFI_UDP6_CONFIG_DATA * | UdpCfgData | |||
) |
Configure the opened Udp6 instance until the corresponding Ip6 instance has been configured.
[in] | UdpIo | The pointer to the Udp6 Io. |
[in] | UdpCfgData | The pointer to the Udp6 configure data. |
EFI_SUCCESS | Configure the Udp6 instance successfully. | |
EFI_NO_MAPPING | The corresponding Ip6 instance has not been configured yet. |
References MTFTP6_GET_MAPPING_TIMEOUT, and MTFTP6_TICK_PER_SECOND.
Referenced by Mtftp6ConfigUdpIo().
INTN Mtftp6GetNextBlockNum | ( | IN LIST_ENTRY * | Head | ) |
Get the first valid block number on the range list.
[in] | Head | The block range head. |
==-1 | If the block range is empty. | |
>-1 | The first valid block number. |
References MTFTP6_BLOCK_RANGE::Start.
Referenced by Mtftp6RrqHandleData(), Mtftp6RrqHandleOack(), Mtftp6WrqHandleAck(), and Mtftp6WrqHandleOack().
EFI_STATUS Mtftp6InitBlockRange | ( | IN LIST_ENTRY * | Head, | |
IN UINT16 | Start, | |||
IN UINT16 | End | |||
) |
Initialize the block range for either RRQ or WRQ. RRQ and WRQ have different requirements for Start and End. For example, during startup, WRQ initializes its whole valid block range to [0, 0xffff]. This is bacause the server will send an ACK0 to inform the user to start the upload. When the client receives an ACK0, it will remove 0 from the range, get the next block number, which is 1, then upload the BLOCK1. For RRQ without option negotiation, the server will directly send the BLOCK1 in response to the client's RRQ. When received BLOCK1, the client will remove it from the block range and send an ACK. It also works if there is option negotiation.
[in] | Head | The block range head to initialize. |
[in] | Start | The Start block number. |
[in] | End | The last block number. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory for initial block range. | |
EFI_SUCCESS | The initial block range is created. |
References MTFTP6_BLOCK_RANGE::Link, and Mtftp6AllocateRange().
Referenced by Mtftp6RrqStart(), and Mtftp6WrqStart().
VOID EFIAPI Mtftp6OnPacketSent | ( | IN NET_BUF * | Packet, | |
IN UDP_END_POINT * | UdpEpt, | |||
IN EFI_STATUS | IoStatus, | |||
IN VOID * | Context | |||
) |
The callback function called when the packet is transmitted.
[in] | Packet | The pointer to the packet. |
[in] | UdpEpt | The pointer to the Udp6 access point. |
[in] | IoStatus | The result of the transmission. |
[in] | Context | The pointer to the context. |
Referenced by Mtftp6TransmitPacket().
VOID EFIAPI Mtftp6OnTimerTick | ( | IN EFI_EVENT | Event, | |
IN VOID * | Context | |||
) |
The timer ticking routine for the Mtftp6 instance.
[in] | Event | The pointer to the ticking event. |
[in] | Context | The pointer to the context. |
References _MTFTP6_SERVICE::Children, _MTFTP6_INSTANCE::CurRetry, _MTFTP6_INSTANCE::LastPacket, _MTFTP6_INSTANCE::MaxRetry, _MTFTP6_INSTANCE::Mtftp6, Mtftp6OperationClean(), Mtftp6SendError(), Mtftp6TransmitPacket(), _MTFTP6_INSTANCE::PacketToLive, and _MTFTP6_INSTANCE::Token.
Referenced by Mtftp6CreateService().
VOID Mtftp6OperationClean | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN EFI_STATUS | Result | |||
) |
Clean up the current Mtftp6 operation.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Result | The result to be returned to the user. |
Referenced by EfiMtftp6Configure(), Mtftp6OnTimerTick(), Mtftp6OperationStart(), Mtftp6RrqInput(), and Mtftp6WrqInput().
EFI_STATUS Mtftp6OperationStart | ( | IN EFI_MTFTP6_PROTOCOL * | This, | |
IN EFI_MTFTP6_TOKEN * | Token, | |||
IN UINT16 | OpCode | |||
) |
Start the Mtftp6 instance to perform the operation, such as read file, write file, and read directory.
[in] | This | The MTFTP session. |
[in] | Token | The token than encapsues the user's request. |
[in] | OpCode | The operation to perform. |
EFI_INVALID_PARAMETER | Some of the parameters are invalid. | |
EFI_NOT_STARTED | The MTFTP session hasn't been configured. | |
EFI_ALREADY_STARTED | There is pending operation for the session. | |
EFI_SUCCESS | The operation is successfully started. |
References _MTFTP6_INSTANCE::BlkSize, _MTFTP6_INSTANCE::Config, _MTFTP6_INSTANCE::ExtInfo, _MTFTP6_INSTANCE::IsMaster, _MTFTP6_INSTANCE::MaxRetry, MTFTP6_DEFAULT_BLK_SIZE, MTFTP6_DEFAULT_MAX_RETRY, MTFTP6_DEFAULT_SERVER_CMD_PORT, MTFTP6_DEFAULT_TIMEOUT, MTFTP6_INSTANCE_FROM_THIS, Mtftp6OperationClean(), Mtftp6ParseExtensionOption(), Mtftp6RrqStart(), Mtftp6WrqStart(), _MTFTP6_INSTANCE::OldTpl, _MTFTP6_INSTANCE::ServerCmdPort, _MTFTP6_INSTANCE::ServerDataPort, _MTFTP6_INSTANCE::ServerIp, _MTFTP6_INSTANCE::Timeout, and _MTFTP6_INSTANCE::Token.
Referenced by EfiMtftp6GetInfo(), EfiMtftp6ReadDirectory(), EfiMtftp6ReadFile(), and EfiMtftp6WriteFile().
EFI_STATUS Mtftp6RemoveBlockNum | ( | IN LIST_ENTRY * | Head, | |
IN UINT16 | Num, | |||
IN BOOLEAN | Completed, | |||
OUT UINT64 * | TotalBlock | |||
) |
Remove the block number from the block range list.
[in] | Head | The block range list to remove from. |
[in] | Num | The block number to remove. |
[in] | Completed | Whether Num is the last block number |
[out] | TotalBlock | The continuous block number in all |
EFI_NOT_FOUND | The block number isn't in the block range list. | |
EFI_SUCCESS | The block number has been removed from the list. | |
EFI_OUT_OF_RESOURCES | Failed to allocate resources. |
References MTFTP6_BLOCK_RANGE::Bound, MTFTP6_BLOCK_RANGE::End, MTFTP6_BLOCK_RANGE::Link, Mtftp6AllocateRange(), MTFTP6_BLOCK_RANGE::Round, and MTFTP6_BLOCK_RANGE::Start.
Referenced by Mtftp6RrqSaveBlock(), and Mtftp6WrqHandleAck().
EFI_STATUS Mtftp6SendError | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN UINT16 | ErrCode, | |||
IN UINT8 * | ErrInfo | |||
) |
Build and send an error packet.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | ErrCode | The error code in the packet. |
[in] | ErrInfo | The error message in the packet. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory for the error packet. | |
EFI_SUCCESS | The error packet is transmitted. | |
Others | Failed to transmit the packet. |
References Mtftp6TransmitPacket().
Referenced by Mtftp6OnTimerTick(), Mtftp6RrqHandleOack(), Mtftp6RrqInput(), Mtftp6RrqSaveBlock(), Mtftp6WrqHandleAck(), Mtftp6WrqHandleOack(), Mtftp6WrqInput(), and Mtftp6WrqSendBlock().
EFI_STATUS Mtftp6SendRequest | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN UINT16 | Operation | |||
) |
Build and transmit the request packet for the Mtftp6 instance.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Operation | The operation code of this packet. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory for the request. | |
EFI_SUCCESS | The request is built and sent. | |
Others | Failed to transmit the packet. |
References Mtftp6TransmitPacket().
Referenced by Mtftp6RrqStart(), and Mtftp6WrqStart().
VOID Mtftp6SetLastBlockNum | ( | IN LIST_ENTRY * | Head, | |
IN UINT16 | Last | |||
) |
Set the last block number of the block range list. It removes all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as [0, 0xffff] for WRQ. When it gets the last block number, it calls this function to set the last block number.
[in] | Head | The block range list. |
[in] | Last | The last block number. |
References MTFTP6_BLOCK_RANGE::End, MTFTP6_BLOCK_RANGE::Link, and MTFTP6_BLOCK_RANGE::Start.
Referenced by Mtftp6RrqSaveBlock(), and Mtftp6WrqSendBlock().
EFI_STATUS Mtftp6TransmitPacket | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN NET_BUF * | Packet | |||
) |
Send the packet for the Mtftp6 instance.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Packet | The pointer to the packet to be sent. |
EFI_SUCCESS | The packet was sent out | |
Others | Failed to transmit the packet. |
References Mtftp6ConfigUdpIo(), and Mtftp6OnPacketSent().
Referenced by Mtftp6OnTimerTick(), Mtftp6RrqHandleData(), Mtftp6RrqSendAck(), Mtftp6SendError(), Mtftp6SendRequest(), and Mtftp6WrqSendBlock().