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

Go to the source code of this file.

Functions

VOID EFIAPI Mtftp4RrqInput (IN NET_BUF *UdpPacket, IN UDP_END_POINT *EndPoint, IN EFI_STATUS IoStatus, IN VOID *Context)
 
EFI_STATUS Mtftp4RrqStart (IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation)
 
EFI_STATUS Mtftp4RrqSendAck (IN MTFTP4_PROTOCOL *Instance, IN UINT16 BlkNo)
 
EFI_STATUS Mtftp4RrqSaveBlock (IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len)
 
EFI_STATUS Mtftp4RrqHandleData (IN MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, IN BOOLEAN Multicast, OUT BOOLEAN *Completed)
 
BOOLEAN Mtftp4RrqOackValid (IN MTFTP4_PROTOCOL *This, IN MTFTP4_OPTION *Reply, IN MTFTP4_OPTION *Request)
 
EFI_STATUS EFIAPI Mtftp4RrqConfigMcastPort (IN UDP_IO *McastIo, IN VOID *Context)
 
EFI_STATUS Mtftp4RrqHandleOack (IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, IN BOOLEAN Multicast, OUT BOOLEAN *Completed)
 

Detailed Description

Routines to process Rrq (download).

(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Mtftp4Rrq.c.

Function Documentation

◆ Mtftp4RrqConfigMcastPort()

EFI_STATUS EFIAPI Mtftp4RrqConfigMcastPort ( IN UDP_IO McastIo,
IN VOID *  Context 
)

Configure a UDP IO port to receive the multicast.

Parameters
McastIoThe UDP IO to configure
ContextThe opaque parameter to the function which is the MTFTP session.
Return values
EFI_SUCCESSThe UDP child is successfully configured.
OthersFailed to configure the UDP child.

Definition at line 396 of file Mtftp4Rrq.c.

◆ Mtftp4RrqHandleData()

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

Function to process the received data packets.

It will save the block then send back an ACK if it is active.

Parameters
InstanceThe downloading MTFTP session
PacketThe packet received
LenThe length of the packet
MulticastWhether this packet is multicast or unicast
CompletedReturn whether the download has completed
Return values
EFI_SUCCESSThe data packet is successfully processed
EFI_ABORTEDThe download is aborted by the user
EFI_BUFFER_TOO_SMALLThe user provided buffer is too small

Definition at line 242 of file Mtftp4Rrq.c.

◆ Mtftp4RrqHandleOack()

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

Function to process the OACK.

It will first validate the OACK packet, then update the various negotiated parameters.

Parameters
InstanceThe download MTFTP session
PacketThe packet received
LenThe packet length
MulticastWhether this packet is received as a multicast
CompletedReturns whether the download has completed. NOT used by this function.
Return values
EFI_DEVICE_ERRORFailed to create/start a multicast UDP child
EFI_TFTP_ERRORSome error happened during the process
EFI_SUCCESSThe OACK is successfully processed.

Definition at line 483 of file Mtftp4Rrq.c.

◆ Mtftp4RrqInput()

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

The packet process callback for MTFTP download.

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

Definition at line 647 of file Mtftp4Rrq.c.

◆ Mtftp4RrqOackValid()

BOOLEAN Mtftp4RrqOackValid ( IN MTFTP4_PROTOCOL This,
IN MTFTP4_OPTION Reply,
IN MTFTP4_OPTION Request 
)

Validate whether the options received in the server's OACK packet is valid.

The options are valid only if:

  1. The server doesn't include options not requested by us
  2. The server can only use smaller blksize than that is requested
  3. The server can only use the same timeout as requested
  4. The server doesn't change its multicast channel.
Parameters
ThisThe downloading Mtftp session
ReplyThe options in the OACK packet
RequestThe requested options
Return values
TRUEThe options in the OACK is OK.
FALSEThe options in the OACK is invalid.

Definition at line 340 of file Mtftp4Rrq.c.

◆ Mtftp4RrqSaveBlock()

EFI_STATUS Mtftp4RrqSaveBlock ( IN OUT MTFTP4_PROTOCOL Instance,
IN EFI_MTFTP4_PACKET Packet,
IN UINT32  Len 
)

Deliver the received data block to the user, which can be saved in the user provide buffer or through the CheckPacket callback.

Parameters
InstanceThe Mtftp session
PacketThe received data packet
LenThe packet length
Return values
EFI_SUCCESSThe data is saved successfully
EFI_ABORTEDThe user tells to abort by return an error through CheckPacket
EFI_BUFFER_TOO_SMALLThe user's buffer is too small and buffer length is updated to the actual buffer size needed.

Definition at line 135 of file Mtftp4Rrq.c.

◆ Mtftp4RrqSendAck()

EFI_STATUS Mtftp4RrqSendAck ( IN MTFTP4_PROTOCOL Instance,
IN UINT16  BlkNo 
)

Build and send a ACK packet for the download session.

Parameters
InstanceThe Mtftp session
BlkNoThe BlkNo to ack.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate memory for the packet
EFI_SUCCESSThe ACK has been sent
OthersFailed to send the ACK.

Definition at line 85 of file Mtftp4Rrq.c.

◆ Mtftp4RrqStart()

EFI_STATUS Mtftp4RrqStart ( IN MTFTP4_PROTOCOL Instance,
IN UINT16  Operation 
)

Start the MTFTP session to download.

It will first initialize some of the internal states then build and send a RRQ request packet, at last, it will start receive for the downloading.

Parameters
InstanceThe Mtftp session
OperationThe MTFTP opcode, it may be a EFI_MTFTP4_OPCODE_RRQ or EFI_MTFTP4_OPCODE_DIR.
Return values
EFI_SUCCESSThe mtftp download session is started.
OthersFailed to start downloading.

Definition at line 45 of file Mtftp4Rrq.c.