]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h
2 Support routines for MTFTP.
4 Copyright (c) 2006 - 2010, 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.
33 Initialize the block range for either RRQ or WRQ.
35 RRQ and WRQ have different requirements for Start and End.
36 For example, during start up, WRQ initializes its whole valid block range
37 to [0, 0xffff]. This is bacause the server will send us a ACK0 to inform us
38 to start the upload. When the client received ACK0, it will remove 0 from the
39 range, get the next block number, which is 1, then upload the BLOCK1. For RRQ
40 without option negotiation, the server will directly send us the BLOCK1 in
41 response to the client's RRQ. When received BLOCK1, the client will remove
42 it from the block range and send an ACK. It also works if there is option
45 @param Head The block range head to initialize
46 @param Start The Start block number.
47 @param End The last block number.
49 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for initial block range
50 @retval EFI_SUCCESS The initial block range is created.
54 Mtftp4InitBlockRange (
61 Get the first valid block number on the range list.
63 @param Head The block range head
65 @return The first valid block number, -1 if the block range is empty.
69 Mtftp4GetNextBlockNum (
74 Set the last block number of the block range list.
76 It will remove all the blocks after the Last. MTFTP initialize the block range
77 to the maximum possible range, such as [0, 0xffff] for WRQ. When it gets the
78 last block number, it will call this function to set the last block number.
80 @param Head The block range list
81 @param Last The last block number
85 Mtftp4SetLastBlockNum (
91 Remove the block number from the block range list.
93 @param Head The block range list to remove from
94 @param Num The block number to remove
95 @param Completed Wether Num is the last block number
96 @param TotalBlock The continuous block number in all
98 @retval EFI_NOT_FOUND The block number isn't in the block range list
99 @retval EFI_SUCCESS The block number has been removed from the list
100 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource
104 Mtftp4RemoveBlockNum (
107 IN BOOLEAN Completed
,
108 OUT UINT64
*TotalBlock
112 Set the timeout for the instance. User a longer time for passive instances.
114 @param Instance The Mtftp session to set time out
119 IN OUT MTFTP4_PROTOCOL
*Instance
123 Send the packet for the instance.
125 It will first save a reference to the packet for later retransmission.
126 Then determine the destination port, listen port for requests, and connected
127 port for others. At last, send the packet out.
129 @param Instance The Mtftp instance
130 @param Packet The packet to send
132 @retval EFI_SUCCESS The packet is sent out
133 @retval Others Failed to transmit the packet.
138 IN OUT MTFTP4_PROTOCOL
*Instance
,
139 IN OUT NET_BUF
*Packet
143 Build then transmit the request packet for the MTFTP session.
145 @param Instance The Mtftp session
147 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the request
148 @retval EFI_SUCCESS The request is built and sent
149 @retval Others Failed to transmit the packet.
154 IN MTFTP4_PROTOCOL
*Instance
158 Build then send an error message.
160 @param Instance The MTFTP session
161 @param ErrCode The error code
162 @param ErrInfo The error message
164 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the error packet
165 @retval EFI_SUCCESS The error packet is transmitted.
166 @retval Others Failed to transmit the packet.
171 IN MTFTP4_PROTOCOL
*Instance
,
177 Retransmit the last packet for the instance.
179 @param Instance The Mtftp instance
181 @retval EFI_SUCCESS The last packet is retransmitted.
182 @retval Others Failed to retransmit.
187 IN MTFTP4_PROTOCOL
*Instance
191 The timer ticking function for the Mtftp service instance.
193 @param Event The ticking event
194 @param Context The Mtftp service instance