NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c File Reference


Functions

EFI_STATUS Mtftp6RrqSendAck (IN MTFTP6_INSTANCE *Instance, IN UINT16 BlockNum)
EFI_STATUS Mtftp6RrqSaveBlock (IN MTFTP6_INSTANCE *Instance, IN EFI_MTFTP6_PACKET *Packet, IN UINT32 Len, OUT NET_BUF **UdpPacket)
EFI_STATUS Mtftp6RrqHandleData (IN MTFTP6_INSTANCE *Instance, IN EFI_MTFTP6_PACKET *Packet, IN UINT32 Len, OUT NET_BUF **UdpPacket, OUT BOOLEAN *IsCompleted)
BOOLEAN Mtftp6RrqOackValid (IN MTFTP6_INSTANCE *Instance, IN MTFTP6_EXT_OPTION_INFO *ReplyInfo, IN MTFTP6_EXT_OPTION_INFO *RequestInfo)
EFI_STATUS EFIAPI Mtftp6RrqConfigMcastUdpIo (IN UDP_IO *McastIo, IN VOID *Context)
EFI_STATUS Mtftp6RrqHandleOack (IN MTFTP6_INSTANCE *Instance, IN EFI_MTFTP6_PACKET *Packet, IN UINT32 Len, OUT NET_BUF **UdpPacket, OUT BOOLEAN *IsCompleted)
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 Rrq process functions implementation.

Copyright (c) 2009 - 2014, 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.


Function Documentation

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

Configure Udp6Io to receive a packet from a multicast address.

Parameters:
[in] McastIo The pointer to the mcast Udp6Io.
[in] Context The pointer to the context.
Return values:
EFI_SUCCESS The mcast Udp6Io was successfully configured.
Others Failed to configure the Udp6Io.

References _MTFTP6_INSTANCE::McastIp, _MTFTP6_INSTANCE::McastPort, and _MTFTP6_INSTANCE::ServerIp.

Referenced by Mtftp6RrqHandleOack().

EFI_STATUS Mtftp6RrqHandleData ( IN MTFTP6_INSTANCE Instance,
IN EFI_MTFTP6_PACKET *  Packet,
IN UINT32  Len,
OUT NET_BUF **  UdpPacket,
OUT BOOLEAN *  IsCompleted 
)

Process the received data packets. It will save the block then send back an ACK if it is active.

Parameters:
[in] Instance The pointer to the Mtftp6 instance.
[in] Packet The pointer to the received packet.
[in] Len The length of the packet.
[out] UdpPacket The net buf of received packet.
[out] IsCompleted If TRUE, the download has been completed. Otherwise, the download has not been completed.
Return values:
EFI_SUCCESS The data packet was successfully processed.
EFI_ABORTED The download was aborted by the user.
EFI_BUFFER_TOO_SMALL The user-provided buffer is too small.

References Mtftp6GetNextBlockNum(), Mtftp6RrqSaveBlock(), Mtftp6RrqSendAck(), and Mtftp6TransmitPacket().

Referenced by Mtftp6RrqInput().

EFI_STATUS Mtftp6RrqHandleOack ( IN MTFTP6_INSTANCE Instance,
IN EFI_MTFTP6_PACKET *  Packet,
IN UINT32  Len,
OUT NET_BUF **  UdpPacket,
OUT BOOLEAN *  IsCompleted 
)

Process the OACK packet for Rrq.

Parameters:
[in] Instance The pointer to the Mtftp6 instance.
[in] Packet The pointer to the received packet.
[in] Len The length of the packet.
[out] UdpPacket The net buf of received packet.
[out] IsCompleted If TRUE, the download has been completed. Otherwise, the download has not been completed.
Return values:
EFI_DEVICE_ERROR Failed to create/start a multicast Udp6 child.
EFI_TFTP_ERROR An error happened during the process.
EFI_SUCCESS The OACK packet successfully processed.

References MTFTP6_EXT_OPTION_INFO::BitMap, MTFTP6_EXT_OPTION_INFO::BlkSize, MTFTP6_EXT_OPTION_INFO::IsMaster, MTFTP6_EXT_OPTION_INFO::McastIp, MTFTP6_EXT_OPTION_INFO::McastPort, MTFTP6_OPT_MCAST_BIT, Mtftp6GetNextBlockNum(), Mtftp6ParseExtensionOption(), Mtftp6ParseStart(), Mtftp6RrqConfigMcastUdpIo(), Mtftp6RrqInput(), Mtftp6RrqOackValid(), Mtftp6RrqSendAck(), Mtftp6SendError(), and MTFTP6_EXT_OPTION_INFO::Timeout.

Referenced by 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] 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().

BOOLEAN Mtftp6RrqOackValid ( IN MTFTP6_INSTANCE Instance,
IN MTFTP6_EXT_OPTION_INFO ReplyInfo,
IN MTFTP6_EXT_OPTION_INFO RequestInfo 
)

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:
[in] Instance The pointer to the Mtftp6 instance.
[in] ReplyInfo The pointer to options information in reply packet.
[in] RequestInfo The pointer to requested options info.
Return values:
TRUE If the option in the OACK is valid.
FALSE If the option is invalid.

References MTFTP6_OPT_BLKSIZE_BIT, MTFTP6_OPT_MCAST_BIT, and MTFTP6_OPT_TIMEOUT_BIT.

Referenced by Mtftp6RrqHandleOack().

EFI_STATUS Mtftp6RrqSaveBlock ( IN MTFTP6_INSTANCE Instance,
IN EFI_MTFTP6_PACKET *  Packet,
IN UINT32  Len,
OUT NET_BUF **  UdpPacket 
)

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

Parameters:
[in] Instance The pointer to the Mtftp6 instance.
[in] Packet The pointer to the received packet.
[in] Len The packet length.
[out] UdpPacket The net buf of the received packet.
Return values:
EFI_SUCCESS The data was saved successfully.
EFI_ABORTED The user tells to abort by return an error through CheckPacket.
EFI_BUFFER_TOO_SMALL The user's buffer is too small, and buffer length is updated to the actual buffer size needed.

References MTFTP6_DATA_HEAD_LEN, Mtftp6RemoveBlockNum(), Mtftp6SendError(), and Mtftp6SetLastBlockNum().

Referenced by Mtftp6RrqHandleData().

EFI_STATUS Mtftp6RrqSendAck ( IN MTFTP6_INSTANCE Instance,
IN UINT16  BlockNum 
)

Build and send a ACK packet for download.

Parameters:
[in] Instance The pointer to the Mtftp6 instance.
[in] BlockNum The block number to be acked.
Return values:
EFI_OUT_OF_RESOURCES Failed to allocate memory for the packet.
EFI_SUCCESS The ACK has been sent.
Others Failed to send the ACK.

References Mtftp6TransmitPacket().

Referenced by Mtftp6RrqHandleData(), and Mtftp6RrqHandleOack().

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.

Parameters:
[in] Instance The pointer to the Mtftp6 instance.
[in] Operation The operation code of current packet.
Return values:
EFI_SUCCESS The Mtftp6 is started to download.
Others Failed to start to download.

References Mtftp6InitBlockRange(), Mtftp6RrqInput(), and Mtftp6SendRequest().

Referenced by Mtftp6OperationStart().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1