]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h
a34764d2272e57e1a506589f3612e6f79a2dcac5
2 Support routines for MTFTP.
4 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php<BR>
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __EFI_MTFTP4_SUPPORT_H__
16 #define __EFI_MTFTP4_SUPPORT_H__
19 // The structure representing a range of block numbers, [Start, End].
20 // It is used to remember the holes in the MTFTP block space. If all
21 // the holes are filled in, then the download or upload has completed.
31 Initialize the block range for either RRQ or WRQ.
33 RRQ and WRQ have different requirements for Start and End.
34 For example, during start up, WRQ initializes its whole valid block range
35 to [0, 0xffff]. This is bacause the server will send us a ACK0 to inform us
36 to start the upload. When the client received ACK0, it will remove 0 from the
37 range, get the next block number, which is 1, then upload the BLOCK1. For RRQ
38 without option negotiation, the server will directly send us the BLOCK1 in
39 response to the client's RRQ. When received BLOCK1, the client will remove
40 it from the block range and send an ACK. It also works if there is option
43 @param Head The block range head to initialize
44 @param Start The Start block number.
45 @param End The last block number.
47 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for initial block range
48 @retval EFI_SUCCESS The initial block range is created.
52 Mtftp4InitBlockRange (
59 Get the first valid block number on the range list.
61 @param Head The block range head
63 @return The first valid block number, -1 if the block range is empty.
67 Mtftp4GetNextBlockNum (
72 Set the last block number of the block range list.
74 It will remove all the blocks after the Last. MTFTP initialize the block range
75 to the maximum possible range, such as [0, 0xffff] for WRQ. When it gets the
76 last block number, it will call this function to set the last block number.
78 @param Head The block range list
79 @param Last The last block number
83 Mtftp4SetLastBlockNum (
89 Remove the block number from the block range list.
91 @param Head The block range list to remove from
92 @param Num The block number to remove
94 @retval EFI_NOT_FOUND The block number isn't in the block range list
95 @retval EFI_SUCCESS The block number has been removed from the list
96 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource
100 Mtftp4RemoveBlockNum (
106 Set the timeout for the instance. User a longer time for passive instances.
108 @param Instance The Mtftp session to set time out
113 IN OUT MTFTP4_PROTOCOL
*Instance
117 Send the packet for the instance.
119 It will first save a reference to the packet for later retransmission.
120 Then determine the destination port, listen port for requests, and connected
121 port for others. At last, send the packet out.
123 @param Instance The Mtftp instance
124 @param Packet The packet to send
126 @retval EFI_SUCCESS The packet is sent out
127 @retval Others Failed to transmit the packet.
132 IN OUT MTFTP4_PROTOCOL
*Instance
,
133 IN OUT NET_BUF
*Packet
137 Build then transmit the request packet for the MTFTP session.
139 @param Instance The Mtftp session
141 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the request
142 @retval EFI_SUCCESS The request is built and sent
143 @retval Others Failed to transmit the packet.
148 IN MTFTP4_PROTOCOL
*Instance
152 Build then send an error message.
154 @param Instance The MTFTP session
155 @param ErrCode The error code
156 @param ErrInfo The error message
158 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the error packet
159 @retval EFI_SUCCESS The error packet is transmitted.
160 @retval Others Failed to transmit the packet.
165 IN MTFTP4_PROTOCOL
*Instance
,
171 Retransmit the last packet for the instance.
173 @param Instance The Mtftp instance
175 @retval EFI_SUCCESS The last packet is retransmitted.
176 @retval Others Failed to retransmit.
181 IN MTFTP4_PROTOCOL
*Instance
185 The timer ticking function for the Mtftp service instance.
187 @param Event The ticking event
188 @param Context The Mtftp service instance