TianoCore EDK2 master
Loading...
Searching...
No Matches
Mtftp4Wrq.c File Reference
#include "Mtftp4Impl.h"

Go to the source code of this file.

Functions

EFI_STATUS Mtftp4WrqSendBlock (IN OUT MTFTP4_PROTOCOL *Instance, IN UINT16 BlockNum)
 
EFI_STATUS Mtftp4WrqHandleAck (IN MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, OUT BOOLEAN *Completed)
 
BOOLEAN Mtftp4WrqOackValid (IN MTFTP4_OPTION *Reply, IN MTFTP4_OPTION *Request)
 
EFI_STATUS Mtftp4WrqHandleOack (IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, OUT BOOLEAN *Completed)
 
VOID EFIAPI Mtftp4WrqInput (IN NET_BUF *UdpPacket, IN UDP_END_POINT *EndPoint, IN EFI_STATUS IoStatus, IN VOID *Context)
 
EFI_STATUS Mtftp4WrqStart (IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation)
 

Detailed Description

Routines to process Wrq (upload).

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Mtftp4Wrq.c.

Function Documentation

◆ Mtftp4WrqHandleAck()

EFI_STATUS Mtftp4WrqHandleAck ( IN MTFTP4_PROTOCOL Instance,
IN EFI_MTFTP4_PACKET Packet,
IN UINT32  Len,
OUT BOOLEAN *  Completed 
)

Function to handle received ACK packet.

If the ACK number matches the expected block number, and there are more data pending, send the next block. Otherwise tell the caller that we are done.

Parameters
InstanceThe MTFTP upload session
PacketThe MTFTP packet received
LenThe packet length
CompletedReturn whether the upload has finished.
Return values
EFI_SUCCESSThe ACK is successfully processed.
EFI_TFTP_ERRORThe block number loops back.
OthersFailed to transmit the next data packet.

Definition at line 133 of file Mtftp4Wrq.c.

◆ Mtftp4WrqHandleOack()

EFI_STATUS Mtftp4WrqHandleOack ( IN OUT MTFTP4_PROTOCOL Instance,
IN EFI_MTFTP4_PACKET Packet,
IN UINT32  Len,
OUT BOOLEAN *  Completed 
)

Function to handle the MTFTP OACK packet.

It parses the packet's options, and update the internal states of the session.

Parameters
InstanceThe MTFTP session
PacketThe received OACK packet
LenThe length of the packet
CompletedWhether the transmission has completed. NOT used by this function.
Return values
EFI_SUCCESSThe OACK process is OK
EFI_TFTP_ERRORSome error occurred, and the session reset.

Definition at line 249 of file Mtftp4Wrq.c.

◆ Mtftp4WrqInput()

VOID EFIAPI Mtftp4WrqInput ( IN NET_BUF UdpPacket,
IN UDP_END_POINT EndPoint,
IN EFI_STATUS  IoStatus,
IN VOID *  Context 
)

The input process routine for MTFTP upload.

Parameters
UdpPacketThe received MTFTP packet.
EndPointThe local/remote access point
IoStatusThe result of the packet receiving
ContextOpaque parameter for the callback, which is the MTFTP session.

Definition at line 330 of file Mtftp4Wrq.c.

◆ Mtftp4WrqOackValid()

BOOLEAN Mtftp4WrqOackValid ( IN MTFTP4_OPTION Reply,
IN MTFTP4_OPTION Request 
)

Check whether the received OACK is valid.

The OACK is valid only if:

  1. It only include options requested by us
  2. It can only include a smaller block size
  3. It can't change the proposed time out value.
  4. Other requirements of the individal MTFTP options as required.
Parameters
ReplyThe options included in the OACK
RequestThe options we requested
Return values
TRUEThe options included in OACK is valid.
FALSEThe options included in OACK is invalid.

Definition at line 208 of file Mtftp4Wrq.c.

◆ Mtftp4WrqSendBlock()

EFI_STATUS Mtftp4WrqSendBlock ( IN OUT MTFTP4_PROTOCOL Instance,
IN UINT16  BlockNum 
)

Build then send a MTFTP data packet for the MTFTP upload session.

Parameters
InstanceThe MTFTP upload session.
BlockNumThe block number to send.
Return values
EFI_OUT_OF_RESOURCESFailed to build the packet.
EFI_ABORTEDThe consumer of this child directs to abort the transmission by return an error through PacketNeeded.
EFI_SUCCESSThe data is sent.

Definition at line 24 of file Mtftp4Wrq.c.

◆ Mtftp4WrqStart()

EFI_STATUS Mtftp4WrqStart ( IN MTFTP4_PROTOCOL Instance,
IN UINT16  Operation 
)

Start the MTFTP session for upload.

It will first init some states, then send the WRQ request packet, and start receiving the packet.

Parameters
InstanceThe MTFTP session
OperationRedundant parameter, which is always EFI_MTFTP4_OPCODE_WRQ here.
Return values
EFI_SUCCESSThe upload process has been started.
OthersFailed to start the upload.

Definition at line 491 of file Mtftp4Wrq.c.