Data Structures | |
struct | MTFTP6_BLOCK_RANGE |
Functions | |
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 | Mtftp6SendRequest (IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) |
EFI_STATUS | Mtftp6SendError (IN MTFTP6_INSTANCE *Instance, IN UINT16 ErrCode, IN UINT8 *ErrInfo) |
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) |
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) |
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) |
VOID EFIAPI | Mtftp6WrqInput (IN NET_BUF *UdpPacket, IN UDP_END_POINT *UdpEpt, IN EFI_STATUS IoStatus, IN VOID *Context) |
EFI_STATUS | Mtftp6WrqStart (IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) |
VOID EFIAPI | Mtftp6RrqInput (IN NET_BUF *UdpPacket, IN UDP_END_POINT *UdpEpt, IN EFI_STATUS IoStatus, IN VOID *Context) |
EFI_STATUS | Mtftp6RrqStart (IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) |
Copyright (c) 2009 - 2010, 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.
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.
[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_SUCCESS | The check process passed successfully. | |
EFI_ABORTED | Abort the Mtftp6 operation. |
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 | The value is always returned. |
[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 the 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 | Configure the Udp6 Io for Mtftp6 successfully. | |
EFI_NO_MAPPING | The corresponding Ip6 instance has not been configured yet. |
[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().
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 because 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 us the BLOCK1 in response to the client's RRQ. When BLOCK1 is received, 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. |
[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 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 that encapsulates 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 was successfully started. |
[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().
VOID EFIAPI Mtftp6RrqInput | ( | IN NET_BUF * | UdpPacket, | |
IN UDP_END_POINT * | UdpEpt, | |||
IN EFI_STATUS | IoStatus, | |||
IN VOID * | Context | |||
) |
The packet process callback for Mtftp6 download.
[in] | UdpPacket | The pointer to the packet received. |
[in] | UdpEpt | The pointer to the Udp6 access point. |
[in] | IoStatus | The status from Udp6 instance. |
[in] | Context | The pointer to the context. |
References _MTFTP6_INSTANCE::BlkSize, _MTFTP6_INSTANCE::McastIp, _MTFTP6_INSTANCE::McastUdpIo, _MTFTP6_INSTANCE::Mtftp6, MTFTP6_DATA_HEAD_LEN, MTFTP6_INSTANCE_SIGNATURE, MTFTP6_OPCODE_LEN, Mtftp6OperationClean(), Mtftp6RrqHandleData(), Mtftp6RrqHandleOack(), Mtftp6RrqInput(), Mtftp6SendError(), _MTFTP6_INSTANCE::ServerDataPort, _MTFTP6_INSTANCE::Token, and _MTFTP6_INSTANCE::UdpIo.
Referenced by Mtftp6RrqHandleOack(), Mtftp6RrqInput(), and Mtftp6RrqStart().
EFI_STATUS Mtftp6RrqStart | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN UINT16 | Operation | |||
) |
Start the Mtftp6 instance to download. It first initializes some of the internal states then builds and sends an RRQ reqeuest packet. Finally, it starts receive for the downloading.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Operation | The operation code of current packet. |
EFI_SUCCESS | The Mtftp6 was started to download. | |
Others | Failed to start to download. |
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Operation | The operation code of current packet. |
EFI_SUCCESS | The Mtftp6 is started to download. | |
Others | Failed to start to download. |
References Mtftp6InitBlockRange(), Mtftp6RrqInput(), and Mtftp6SendRequest().
Referenced by Mtftp6OperationStart().
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 was transmitted. | |
Others | Failed to transmit the 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 was built and sent. | |
Others | Failed to transmit the packet. |
[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().
VOID EFIAPI Mtftp6WrqInput | ( | IN NET_BUF * | UdpPacket, | |
IN UDP_END_POINT * | UdpEpt, | |||
IN EFI_STATUS | IoStatus, | |||
IN VOID * | Context | |||
) |
The packet process callback for Mtftp6 upload.
[in] | UdpPacket | The pointer to the packet received. |
[in] | UdpEpt | The pointer to the Udp6 access point. |
[in] | IoStatus | The status from the Udp6 instance. |
[in] | Context | The pointer to the context. |
[in] | UdpPacket | The pointer to the packet received. |
[in] | UdpEpt | The pointer to the Udp6 access point. |
[in] | IoStatus | The status from Udp6 instance. |
[in] | Context | The pointer to the context. |
References _MTFTP6_INSTANCE::Mtftp6, MTFTP6_BLKNO_LEN, MTFTP6_INSTANCE_SIGNATURE, MTFTP6_OPCODE_LEN, Mtftp6OperationClean(), Mtftp6SendError(), Mtftp6WrqHandleAck(), Mtftp6WrqHandleOack(), Mtftp6WrqInput(), _MTFTP6_INSTANCE::ServerDataPort, _MTFTP6_INSTANCE::Token, and _MTFTP6_INSTANCE::UdpIo.
Referenced by Mtftp6WrqInput(), and Mtftp6WrqStart().
EFI_STATUS Mtftp6WrqStart | ( | IN MTFTP6_INSTANCE * | Instance, | |
IN UINT16 | Operation | |||
) |
Start the Mtftp6 instance to upload. It will first init some states, then send the WRQ request packet, and start to receive the packet.
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Operation | The operation code of current packet. |
EFI_SUCCESS | The Mtftp6 was started to upload. | |
Others | Failed to start to upload. |
[in] | Instance | The pointer to the Mtftp6 instance. |
[in] | Operation | The operation code of the current packet. |
EFI_SUCCESS | The Mtftp6 was started to upload. | |
Others | Failed to start to upload. |
References Mtftp6InitBlockRange(), Mtftp6SendRequest(), and Mtftp6WrqInput().
Referenced by Mtftp6OperationStart().