TianoCore EDK2 master
Loading...
Searching...
No Matches
Mtftp6Support.h File Reference

Go to the source code of this file.

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 *BlockCounter)
 
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)
 

Detailed Description

Mtftp6 support functions declaration.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Mtftp6Support.h.

Function Documentation

◆ Mtftp6CheckPacket()

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.

Parameters
[in]ThisThe pointer to the Mtftp6 protocol.
[in]TokenThe pointer to the Mtftp6 token.
[in]PacketLenThe length of the packet
[in]PacketThe pointer to the received packet.
Return values
EFI_SUCCESSThe check process passed successfully.
EFI_ABORTEDAbort the Mtftp6 operation.

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.

Parameters
[in]ThisThe pointer to the Mtftp6 protocol.
[in]TokenThe pointer to the Mtftp6 token.
[in]PacketLenThe length of the packet.
[in]PacketThe pointer to the received packet.
Return values
EFI_ABORTEDAbort the Mtftp6 operation.

Definition at line 839 of file Mtftp6Support.c.

◆ Mtftp6ConfigDummyUdpIo()

EFI_STATUS EFIAPI Mtftp6ConfigDummyUdpIo ( IN UDP_IO UdpIo,
IN VOID *  Context 
)

The dummy configure routine for create a new Udp6 Io.

Parameters
[in]UdpIoThe pointer to the Udp6 Io.
[in]ContextThe pointer to the context.
Return values
EFI_SUCCESSThe value is always returned.

The dummy configure routine for create a new Udp6 Io.

Parameters
[in]UdpIoThe pointer to the Udp6 Io.
[in]ContextThe pointer to the context.
Return values
EFI_SUCCESSThis value is always returned.

Definition at line 362 of file Mtftp6Support.c.

◆ Mtftp6ConfigUdpIo()

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.

Parameters
[in]UdpIoThe pointer to the Udp6 Io.
[in]ServerIpThe pointer to the server address.
[in]ServerPortThe pointer to the server port.
[in]LocalIpThe pointer to the local address.
[in]LocalPortThe pointer to the local port.
Return values
EFI_SUCCESSConfigure the Udp6 Io for Mtftp6 successfully.
EFI_NO_MAPPINGThe corresponding Ip6 instance has not been configured yet.

The configure routine for Mtftp6 instance to transmit/receive.

Parameters
[in]UdpIoThe pointer to the Udp6 Io.
[in]ServerIpThe pointer to the server address.
[in]ServerPortThe pointer to the server port.
[in]LocalIpThe pointer to the local address.
[in]LocalPortThe pointer to the local port.
Return values
EFI_SUCCESSConfigured the Udp6 Io for Mtftp6 successfully.
EFI_NO_MAPPINGThe corresponding Ip6 instance has not been configured yet.

Definition at line 385 of file Mtftp6Support.c.

◆ Mtftp6GetNextBlockNum()

INTN Mtftp6GetNextBlockNum ( IN LIST_ENTRY Head)

Get the first valid block number on the range list.

Parameters
[in]HeadThe block range head.
Return values
==-1If the block range is empty.
>-1The first valid block number.

Definition at line 92 of file Mtftp6Support.c.

◆ Mtftp6InitBlockRange()

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.

Parameters
[in]HeadThe block range head to initialize.
[in]StartThe Start block number.
[in]EndThe last block number.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for initial block range.
EFI_SUCCESSThe initial block range is created.

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 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.

Parameters
[in]HeadThe block range head to initialize.
[in]StartThe Start block number.
[in]EndThe last block number.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for initial block range.
EFI_SUCCESSThe initial block range is created.

Definition at line 64 of file Mtftp6Support.c.

◆ Mtftp6OnTimerTick()

VOID EFIAPI Mtftp6OnTimerTick ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The timer ticking routine for the Mtftp6 instance.

Parameters
[in]EventThe pointer to the ticking event.
[in]ContextThe pointer to the context.

Definition at line 1163 of file Mtftp6Support.c.

◆ Mtftp6OperationClean()

VOID Mtftp6OperationClean ( IN MTFTP6_INSTANCE Instance,
IN EFI_STATUS  Result 
)

Clean up the current Mtftp6 operation.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]ResultThe result to be returned to the user.

Definition at line 893 of file Mtftp6Support.c.

◆ Mtftp6OperationStart()

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.

Parameters
[in]ThisThe MTFTP session
[in]TokenThe token that encapsulates the user's request.
[in]OpCodeThe operation to perform.
Return values
EFI_INVALID_PARAMETERSome of the parameters are invalid.
EFI_NOT_STARTEDThe MTFTP session hasn't been configured.
EFI_ALREADY_STARTEDThere is pending operation for the session.
EFI_SUCCESSThe operation was successfully started.

Start the Mtftp6 instance to perform the operation, such as read file, write file, and read directory.

Parameters
[in]ThisThe MTFTP session.
[in]TokenThe token than encapsules the user's request.
[in]OpCodeThe operation to perform.
Return values
EFI_INVALID_PARAMETERSome of the parameters are invalid.
EFI_NOT_STARTEDThe MTFTP session hasn't been configured.
EFI_ALREADY_STARTEDThere is pending operation for the session.
EFI_SUCCESSThe operation is successfully started.

Definition at line 984 of file Mtftp6Support.c.

◆ Mtftp6RemoveBlockNum()

EFI_STATUS Mtftp6RemoveBlockNum ( IN LIST_ENTRY Head,
IN UINT16  Num,
IN BOOLEAN  Completed,
OUT UINT64 *  BlockCounter 
)

Remove the block number from the block range list.

Parameters
[in]HeadThe block range list to remove from.
[in]NumThe block number to remove.
[in]CompletedWhether Num is the last block number.
[out]BlockCounterThe continuous block counter instead of the value after roll-over.
Return values
EFI_NOT_FOUNDThe block number isn't in the block range list.
EFI_SUCCESSThe block number has been removed from the list.
EFI_OUT_OF_RESOURCESFailed to allocate resources.

Definition at line 160 of file Mtftp6Support.c.

◆ Mtftp6RrqInput()

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.

Parameters
[in]UdpPacketThe pointer to the packet received.
[in]UdpEptThe pointer to the Udp6 access point.
[in]IoStatusThe status from Udp6 instance.
[in]ContextThe pointer to the context.

Definition at line 670 of file Mtftp6Rrq.c.

◆ 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 request packet. Finally, it starts receive for the downloading.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of current packet.
Return values
EFI_SUCCESSThe Mtftp6 was started to download.
OthersFailed to start to download.

Start the Mtftp6 instance to download. It first initializes some of the internal states, then builds and sends an RRQ request packet. Finally, it starts receive for the downloading.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of current packet.
Return values
EFI_SUCCESSThe Mtftp6 is started to download.
OthersFailed to start to download.

Definition at line 905 of file Mtftp6Rrq.c.

◆ Mtftp6SendError()

EFI_STATUS Mtftp6SendError ( IN MTFTP6_INSTANCE Instance,
IN UINT16  ErrCode,
IN UINT8 *  ErrInfo 
)

Build and send an error packet.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]ErrCodeThe error code in the packet.
[in]ErrInfoThe error message in the packet.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for the error packet.
EFI_SUCCESSThe error packet was transmitted.
OthersFailed to transmit the packet.

Build and send an error packet.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]ErrCodeThe error code in the packet.
[in]ErrInfoThe error message in the packet.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for the error packet.
EFI_SUCCESSThe error packet is transmitted.
OthersFailed to transmit the packet.

Definition at line 577 of file Mtftp6Support.c.

◆ Mtftp6SendRequest()

EFI_STATUS Mtftp6SendRequest ( IN MTFTP6_INSTANCE Instance,
IN UINT16  Operation 
)

Build and transmit the request packet for the Mtftp6 instance.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of this packet.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for the request.
EFI_SUCCESSThe request was built and sent.
OthersFailed to transmit the packet.

Build and transmit the request packet for the Mtftp6 instance.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of this packet.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for the request.
EFI_SUCCESSThe request is built and sent.
OthersFailed to transmit the packet.

Definition at line 451 of file Mtftp6Support.c.

◆ Mtftp6SetLastBlockNum()

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.

Parameters
[in]HeadThe block range list.
[in]LastThe last block number.

Definition at line 118 of file Mtftp6Support.c.

◆ Mtftp6TransmitPacket()

EFI_STATUS Mtftp6TransmitPacket ( IN MTFTP6_INSTANCE Instance,
IN NET_BUF Packet 
)

Send the packet for the Mtftp6 instance.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]PacketThe pointer to the packet to be sent.
Return values
EFI_SUCCESSThe packet was sent out
OthersFailed to transmit the packet.

Definition at line 655 of file Mtftp6Support.c.

◆ Mtftp6WrqInput()

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.

Parameters
[in]UdpPacketThe pointer to the packet received.
[in]UdpEptThe pointer to the Udp6 access point.
[in]IoStatusThe status from the Udp6 instance.
[in]ContextThe pointer to the context.

The packet process callback for Mtftp6 upload.

Parameters
[in]UdpPacketThe pointer to the packet received.
[in]UdpEptThe pointer to the Udp6 access point.
[in]IoStatusThe status from Udp6 instance.
[in]ContextThe pointer to the context.

Definition at line 372 of file Mtftp6Wrq.c.

◆ 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.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of current packet.
Return values
EFI_SUCCESSThe Mtftp6 was started to upload.
OthersFailed to start to upload.

Start the Mtftp6 instance to upload. It will first init some states, then send the WRQ request packet, and start to receive the packet.

Parameters
[in]InstanceThe pointer to the Mtftp6 instance.
[in]OperationThe operation code of the current packet.
Return values
EFI_SUCCESSThe Mtftp6 was started to upload.
OthersFailed to start to upload.

Definition at line 561 of file Mtftp6Wrq.c.