diff options
author | niry <niry@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-16 06:56:18 +0000 |
---|---|---|
committer | niry <niry@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-16 06:56:18 +0000 |
commit | dab714aa1171a7916df00486f077dc8e923d8ab1 (patch) | |
tree | a187ecf53a5ba50e9ce6f0c09a101c8824be7030 /MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h | |
parent | bd59b46eb41585a8977f30067c111b30278bf391 (diff) | |
download | edk2-dab714aa1171a7916df00486f077dc8e923d8ab1.zip edk2-dab714aa1171a7916df00486f077dc8e923d8ab1.tar.gz edk2-dab714aa1171a7916df00486f077dc8e923d8ab1.tar.bz2 |
Insert comments for functions/macros and add the file headers.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7293 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h')
-rw-r--r-- | MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h | 133 |
1 files changed, 117 insertions, 16 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h index ddeeac6..8c231e1 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h @@ -1,23 +1,15 @@ /** @file
-
-Copyright (c) 2006, Intel Corporation
+ Support routines for MTFTP.
+
+Copyright (c) 2006, Intel Corporation<BR>
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
+http://opensource.org/licenses/bsd-license.php<BR>
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module Name:
-
- Mtftp4Support.h
-
-Abstract:
-
- Support routines for MTFTP
-
-
**/
#ifndef __EFI_MTFTP4_SUPPORT_H__
@@ -35,6 +27,27 @@ typedef struct { } MTFTP4_BLOCK_RANGE;
+/**
+ Initialize the block range for either RRQ or WRQ.
+
+ RRQ and WRQ have different requirements for Start and End.
+ For example, during start up, WRQ initializes its whole valid block range
+ to [0, 0xffff]. This is bacause the server will send us a ACK0 to inform us
+ to start the upload. When the client received ACK0, it will remove 0 from the
+ range, get the next block number, which is 1, then upload the BLOCK1. For RRQ
+ without option negotiation, the server will directly send us the BLOCK1 in
+ response to the client's RRQ. When received BLOCK1, the client will remove
+ it from the block range and send an ACK. It also works if there is option
+ negotiation.
+
+ @param Head The block range head to initialize
+ @param Start The Start block number.
+ @param End The last block number.
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for initial block range
+ @retval EFI_SUCCESS The initial block range is created.
+
+**/
EFI_STATUS
Mtftp4InitBlockRange (
IN LIST_ENTRY *Head,
@@ -42,51 +55,139 @@ Mtftp4InitBlockRange ( IN UINT16 End
);
+/**
+ Get the first valid block number on the range list.
+
+ @param Head The block range head
+
+ @return The first valid block number, -1 if the block range is empty.
+
+**/
INTN
Mtftp4GetNextBlockNum (
IN LIST_ENTRY *Head
);
+/**
+ Set the last block number of the block range list.
+
+ It will remove all the blocks after the Last. MTFTP initialize the block range
+ to the maximum possible range, such as [0, 0xffff] for WRQ. When it gets the
+ last block number, it will call this function to set the last block number.
+
+ @param Head The block range list
+ @param Last The last block number
+
+**/
VOID
Mtftp4SetLastBlockNum (
IN LIST_ENTRY *Head,
IN UINT16 Last
);
+/**
+ Remove the block number from the block range list.
+
+ @param Head The block range list to remove from
+ @param Num The block number to remove
+
+ @retval EFI_NOT_FOUND The block number isn't in the block range list
+ @retval EFI_SUCCESS The block number has been removed from the list
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource
+
+**/
EFI_STATUS
Mtftp4RemoveBlockNum (
IN LIST_ENTRY *Head,
IN UINT16 Num
);
+/**
+ Set the timeout for the instance. User a longer time for passive instances.
+
+ @param Instance The Mtftp session to set time out
+
+**/
VOID
Mtftp4SetTimeout (
- IN MTFTP4_PROTOCOL *Instance
+ IN OUT MTFTP4_PROTOCOL *Instance
);
+/**
+ Send the packet for the instance.
+
+ It will first save a reference to the packet for later retransmission.
+ Then determine the destination port, listen port for requests, and connected
+ port for others. At last, send the packet out.
+
+ @param Instance The Mtftp instance
+ @param Packet The packet to send
+
+ @retval EFI_SUCCESS The packet is sent out
+ @retval Others Failed to transmit the packet.
+
+**/
EFI_STATUS
Mtftp4SendPacket (
- IN MTFTP4_PROTOCOL *Instance,
- IN NET_BUF *Packet
+ IN OUT MTFTP4_PROTOCOL *Instance,
+ IN OUT NET_BUF *Packet
);
+/**
+ Build then transmit the request packet for the MTFTP session.
+
+ @param Instance The Mtftp session
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the request
+ @retval EFI_SUCCESS The request is built and sent
+ @retval Others Failed to transmit the packet.
+
+**/
EFI_STATUS
Mtftp4SendRequest (
IN MTFTP4_PROTOCOL *Instance
);
+/**
+ Build then send an error message.
+
+ @param Instance The MTFTP session
+ @param ErrCode The error code
+ @param ErrInfo The error message
+
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the error packet
+ @retval EFI_SUCCESS The error packet is transmitted.
+ @retval Others Failed to transmit the packet.
+
+**/
EFI_STATUS
Mtftp4SendError (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 ErrCode,
- IN UINT8* ErrInfo
+ IN UINT8 *ErrInfo
);
+/**
+ Retransmit the last packet for the instance.
+
+ @param Instance The Mtftp instance
+
+ @retval EFI_SUCCESS The last packet is retransmitted.
+ @retval Others Failed to retransmit.
+
+**/
EFI_STATUS
Mtftp4Retransmit (
IN MTFTP4_PROTOCOL *Instance
);
+/**
+ The timer ticking function for the Mtftp service instance.
+
+ @param Event The ticking event
+ @param Context The Mtftp service instance
+
+**/
VOID
EFIAPI
Mtftp4OnTimerTick (
|