diff options
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe')
6 files changed, 646 insertions, 489 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c index 2582994..626995b 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c @@ -23,6 +23,45 @@ Abstract: //
// EFI Component Name Functions
//
+/**
+ Retrieves a Unicode string that is the user readable name of the driver.
+
+ This function retrieves the user readable name of a driver in the form of a
+ Unicode string. If the driver specified by This has a user readable name in
+ the language specified by Language, then a pointer to the driver name is
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+ by This does not support the language specified by Language,
+ then EFI_UNSUPPORTED is returned.
+
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+
+ @param Language[in] A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified
+ in RFC 3066 or ISO 639-2 language code format.
+
+ @param DriverName[out] A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by
+ This and the language specified by Language was
+ returned in DriverName.
+
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.
+
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetDriverName (
@@ -31,6 +70,75 @@ Mtftp4ComponentNameGetDriverName ( OUT CHAR16 **DriverName
);
+
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
+
+ This function retrieves the user readable name of the controller specified by
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the
+ driver specified by This has a user readable name in the language specified by
+ Language, then a pointer to the controller name is returned in ControllerName,
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently
+ managing the controller specified by ControllerHandle and ChildHandle,
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.
+
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+
+ @param ControllerHandle[in] The handle of a controller that the driver
+ specified by This is managing. This handle
+ specifies the controller whose name is to be
+ returned.
+
+ @param ChildHandle[in] The handle of the child controller to retrieve
+ the name of. This is an optional parameter that
+ may be NULL. It will be NULL for device
+ drivers. It will also be NULL for a bus drivers
+ that wish to retrieve the name of the bus
+ controller. It will not be NULL for a bus
+ driver that wishes to retrieve the name of a
+ child controller.
+
+ @param Language[in] A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified in
+ RFC 3066 or ISO 639-2 language code format.
+
+ @param ControllerName[out] A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ controller specified by ControllerHandle and
+ ChildHandle in the language specified by
+ Language from the point of view of the driver
+ specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in
+ the language specified by Language for the
+ driver specified by This was returned in
+ DriverName.
+
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
+ EFI_HANDLE.
+
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle.
+
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetControllerName (
@@ -41,18 +149,29 @@ Mtftp4ComponentNameGetControllerName ( OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = {
Mtftp4ComponentNameGetDriverName,
Mtftp4ComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gMtftp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Mtftp4ComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Mtftp4ComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mMtftp4DriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"MTFTP4 Network Service"
},
{
@@ -61,6 +180,45 @@ static EFI_UNICODE_STRING_TABLE mMtftp4DriverNameTable[] = { }
};
+/**
+ Retrieves a Unicode string that is the user readable name of the driver.
+
+ This function retrieves the user readable name of a driver in the form of a
+ Unicode string. If the driver specified by This has a user readable name in
+ the language specified by Language, then a pointer to the driver name is
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+ by This does not support the language specified by Language,
+ then EFI_UNSUPPORTED is returned.
+
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+
+ @param Language[in] A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified
+ in RFC 3066 or ISO 639-2 language code format.
+
+ @param DriverName[out] A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by
+ This and the language specified by Language was
+ returned in DriverName.
+
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.
+
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetDriverName (
@@ -68,41 +226,84 @@ Mtftp4ComponentNameGetDriverName ( IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This : A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language : A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName : A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCES : The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER : Language is NULL.
- EFI_INVALID_PARAMETER : DriverName is NULL.
- EFI_UNSUPPORTED : The driver specified by This does not support the
- language specified by Language.
-
---*/
{
- return LookupUnicodeString (
- Language,
- gMtftp4ComponentName.SupportedLanguages,
- mMtftp4DriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mMtftp4DriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gMtftp4ComponentName)
+ );
}
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
+
+ This function retrieves the user readable name of the controller specified by
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the
+ driver specified by This has a user readable name in the language specified by
+ Language, then a pointer to the controller name is returned in ControllerName,
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently
+ managing the controller specified by ControllerHandle and ChildHandle,
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.
+
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
+
+ @param ControllerHandle[in] The handle of a controller that the driver
+ specified by This is managing. This handle
+ specifies the controller whose name is to be
+ returned.
+
+ @param ChildHandle[in] The handle of the child controller to retrieve
+ the name of. This is an optional parameter that
+ may be NULL. It will be NULL for device
+ drivers. It will also be NULL for a bus drivers
+ that wish to retrieve the name of the bus
+ controller. It will not be NULL for a bus
+ driver that wishes to retrieve the name of a
+ child controller.
+
+ @param Language[in] A pointer to a Null-terminated ASCII string
+ array indicating the language. This is the
+ language of the driver name that the caller is
+ requesting, and it must match one of the
+ languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up
+ to the driver writer. Language is specified in
+ RFC 3066 or ISO 639-2 language code format.
+
+ @param ControllerName[out] A pointer to the Unicode string to return.
+ This Unicode string is the name of the
+ controller specified by ControllerHandle and
+ ChildHandle in the language specified by
+ Language from the point of view of the driver
+ specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in
+ the language specified by Language for the
+ driver specified by This was returned in
+ DriverName.
+
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
+ EFI_HANDLE.
+
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle.
+
+ @retval EFI_UNSUPPORTED The driver specified by This does not support
+ the language specified by Language.
+
+**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetControllerName (
@@ -112,50 +313,6 @@ Mtftp4ComponentNameGetControllerName ( IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This : A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle :The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle :The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language : A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName : A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS :The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER : ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER : ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER : Language is NULL.
- EFI_INVALID_PARAMETER : ControllerName is NULL.
- EFI_UNSUPPORTED : The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED :The driver specified by This does not support the
- language specified by Language.
-
---*/
{
return EFI_UNSUPPORTED;
}
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c index 835dfe0..ceabbfe 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c @@ -58,14 +58,13 @@ Returns: --*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gMtftp4DriverBinding,
ImageHandle,
&gMtftp4ComponentName,
- NULL,
- NULL
+ &gMtftp4ComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.h index a9b7ac7..b6eba0c 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.h @@ -1,69 +1,70 @@ -/** @file - -Copyright (c) 2006 - 2007, 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. - -Module Name: - - Mtftp4Driver.h - -Abstract: - - -**/ - -#ifndef __EFI_MTFTP4_DRIVER_H__ -#define __EFI_MTFTP4_DRIVER_H__ - -#include <PiDxe.h> - -#include <Protocol/ServiceBinding.h> - -#include <Library/NetLib.h> -#include <Library/UefiLib.h> - - -EFI_STATUS -Mtftp4DriverBindingSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -Mtftp4DriverBindingStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -Mtftp4DriverBindingStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ); - -EFI_STATUS -Mtftp4ServiceBindingCreateChild ( - IN EFI_SERVICE_BINDING_PROTOCOL *This, - IN OUT EFI_HANDLE *ChildHandle - ); - -EFI_STATUS -Mtftp4ServiceBindingDestroyChild ( - IN EFI_SERVICE_BINDING_PROTOCOL *This, - IN EFI_HANDLE ChildHandle - ); - -extern EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName; -extern EFI_DRIVER_BINDING_PROTOCOL gMtftp4DriverBinding; - -#endif +/** @file
+
+Copyright (c) 2006 - 2007, 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.
+
+Module Name:
+
+ Mtftp4Driver.h
+
+Abstract:
+
+
+**/
+
+#ifndef __EFI_MTFTP4_DRIVER_H__
+#define __EFI_MTFTP4_DRIVER_H__
+
+#include <PiDxe.h>
+
+#include <Protocol/ServiceBinding.h>
+
+#include <Library/NetLib.h>
+#include <Library/UefiLib.h>
+
+
+EFI_STATUS
+Mtftp4DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ );
+
+EFI_STATUS
+Mtftp4DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ );
+
+EFI_STATUS
+Mtftp4DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+Mtftp4ServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN OUT EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+Mtftp4ServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+extern EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gMtftp4ComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gMtftp4DriverBinding;
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h index 22ba7dd..c12b1dd 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h @@ -1,33 +1,33 @@ -/** @file - -Copyright (c) 2006 - 2007, 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. - -Module Name: - - Mtftp4Impl.h - -Abstract: - - Mtftp4 Implementation, it supports the following RFCs: - RFC1350 - THE TFTP PROTOCOL (REVISION 2) - RFC2090 - TFTP Multicast Option - RFC2347 - TFTP Option Extension - RFC2348 - TFTP Blocksize Option - RFC2349 - TFTP Timeout Interval and Transfer Size Options - - -**/ - -#ifndef __EFI_MTFTP4_IMPL_H__ -#define __EFI_MTFTP4_IMPL_H__ - +/** @file
+
+Copyright (c) 2006 - 2007, 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.
+
+Module Name:
+
+ Mtftp4Impl.h
+
+Abstract:
+
+ Mtftp4 Implementation, it supports the following RFCs:
+ RFC1350 - THE TFTP PROTOCOL (REVISION 2)
+ RFC2090 - TFTP Multicast Option
+ RFC2347 - TFTP Option Extension
+ RFC2348 - TFTP Blocksize Option
+ RFC2349 - TFTP Timeout Interval and Transfer Size Options
+
+
+**/
+
+#ifndef __EFI_MTFTP4_IMPL_H__
+#define __EFI_MTFTP4_IMPL_H__
+
#include <PiDxe.h>
#include <Protocol/Udp4.h>
@@ -37,142 +37,142 @@ Abstract: #include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
-#include <Library/BaseLib.h> -#include <Library/UdpIoLib.h> -#include <Library/MemoryAllocationLib.h> -#include <Library/BaseMemoryLib.h> - -typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE; -typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL; - -#include "Mtftp4Driver.h" -#include "Mtftp4Option.h" -#include "Mtftp4Support.h" - -enum { - MTFTP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'), - MTFTP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('t', 'f', 't', 'p'), - - MTFTP4_DEFAULT_SERVER_PORT = 69, - MTFTP4_DEFAULT_TIMEOUT = 3, - MTFTP4_DEFAULT_RETRY = 5, - MTFTP4_DEFAULT_BLKSIZE = 512, - MTFTP4_TIME_TO_GETMAP = 5, - - MTFTP4_STATE_UNCONFIGED = 0, - MTFTP4_STATE_CONFIGED, - MTFTP4_STATE_DESTORY -}; - -struct _MTFTP4_SERVICE { - UINT32 Signature; - EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; - - BOOLEAN InDestory; - - UINT16 ChildrenNum; - NET_LIST_ENTRY Children; - - EFI_EVENT Timer; // Ticking timer for all the MTFTP clients - EFI_EVENT TimerToGetMap; - - EFI_HANDLE Controller; - EFI_HANDLE Image; - - // - // This UDP child is used to keep the connection between the UDP - // and MTFTP, so MTFTP will be notified when UDP is uninstalled. - // - UDP_IO_PORT *ConnectUdp; -}; - -typedef struct { - EFI_MTFTP4_PACKET **Packet; - UINT32 *PacketLen; - EFI_STATUS Status; -} MTFTP4_GETINFO_STATE; - -struct _MTFTP4_PROTOCOL { - UINT32 Signature; - NET_LIST_ENTRY Link; - EFI_MTFTP4_PROTOCOL Mtftp4; - - INTN State; - BOOLEAN Indestory; - - MTFTP4_SERVICE *Service; - EFI_HANDLE Handle; - - EFI_MTFTP4_CONFIG_DATA Config; - - // - // Operation parameters: token and requested options. - // - EFI_MTFTP4_TOKEN *Token; - MTFTP4_OPTION RequestOption; - UINT16 Operation; - - // - // Blocks is a list of MTFTP4_BLOCK_RANGE which contains - // holes in the file - // - UINT16 BlkSize; - UINT16 LastBlock; - NET_LIST_ENTRY Blocks; - - // - // The server's communication end point: IP and two ports. one for - // initial request, one for its selected port. - // - IP4_ADDR ServerIp; - UINT16 ListeningPort; - UINT16 ConnectedPort; - IP4_ADDR Gateway; - UDP_IO_PORT *UnicastPort; - - // - // Timeout and retransmit status - // - NET_BUF *LastPacket; - UINT32 PacketToLive; - UINT32 CurRetry; - UINT32 MaxRetry; - UINT32 Timeout; - - // - // Parameter used by RRQ's multicast download. - // - IP4_ADDR McastIp; - UINT16 McastPort; - BOOLEAN Master; - UDP_IO_PORT *McastUdpPort; - - MTFTP4_GETINFO_STATE GetInfoState; -}; - -VOID -Mtftp4CleanOperation ( - IN MTFTP4_PROTOCOL *Instance, - IN EFI_STATUS Result - ); - -EFI_STATUS -Mtftp4WrqStart ( - IN MTFTP4_PROTOCOL *Instance, - IN UINT16 Operation - ); - -EFI_STATUS -Mtftp4RrqStart ( - IN MTFTP4_PROTOCOL *Instance, - IN UINT16 Operation - ); - -#define MTFTP4_SERVICE_FROM_THIS(a) \ - CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE) - -#define MTFTP4_PROTOCOL_FROM_THIS(a) \ - CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE) - -extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate; -#endif +#include <Library/BaseLib.h>
+#include <Library/UdpIoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+
+typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE;
+typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL;
+
+#include "Mtftp4Driver.h"
+#include "Mtftp4Option.h"
+#include "Mtftp4Support.h"
+
+enum {
+ MTFTP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'),
+ MTFTP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('t', 'f', 't', 'p'),
+
+ MTFTP4_DEFAULT_SERVER_PORT = 69,
+ MTFTP4_DEFAULT_TIMEOUT = 3,
+ MTFTP4_DEFAULT_RETRY = 5,
+ MTFTP4_DEFAULT_BLKSIZE = 512,
+ MTFTP4_TIME_TO_GETMAP = 5,
+
+ MTFTP4_STATE_UNCONFIGED = 0,
+ MTFTP4_STATE_CONFIGED,
+ MTFTP4_STATE_DESTORY
+};
+
+struct _MTFTP4_SERVICE {
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+
+ BOOLEAN InDestory;
+
+ UINT16 ChildrenNum;
+ NET_LIST_ENTRY Children;
+
+ EFI_EVENT Timer; // Ticking timer for all the MTFTP clients
+ EFI_EVENT TimerToGetMap;
+
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+
+ //
+ // This UDP child is used to keep the connection between the UDP
+ // and MTFTP, so MTFTP will be notified when UDP is uninstalled.
+ //
+ UDP_IO_PORT *ConnectUdp;
+};
+
+typedef struct {
+ EFI_MTFTP4_PACKET **Packet;
+ UINT32 *PacketLen;
+ EFI_STATUS Status;
+} MTFTP4_GETINFO_STATE;
+
+struct _MTFTP4_PROTOCOL {
+ UINT32 Signature;
+ NET_LIST_ENTRY Link;
+ EFI_MTFTP4_PROTOCOL Mtftp4;
+
+ INTN State;
+ BOOLEAN Indestory;
+
+ MTFTP4_SERVICE *Service;
+ EFI_HANDLE Handle;
+
+ EFI_MTFTP4_CONFIG_DATA Config;
+
+ //
+ // Operation parameters: token and requested options.
+ //
+ EFI_MTFTP4_TOKEN *Token;
+ MTFTP4_OPTION RequestOption;
+ UINT16 Operation;
+
+ //
+ // Blocks is a list of MTFTP4_BLOCK_RANGE which contains
+ // holes in the file
+ //
+ UINT16 BlkSize;
+ UINT16 LastBlock;
+ NET_LIST_ENTRY Blocks;
+
+ //
+ // The server's communication end point: IP and two ports. one for
+ // initial request, one for its selected port.
+ //
+ IP4_ADDR ServerIp;
+ UINT16 ListeningPort;
+ UINT16 ConnectedPort;
+ IP4_ADDR Gateway;
+ UDP_IO_PORT *UnicastPort;
+
+ //
+ // Timeout and retransmit status
+ //
+ NET_BUF *LastPacket;
+ UINT32 PacketToLive;
+ UINT32 CurRetry;
+ UINT32 MaxRetry;
+ UINT32 Timeout;
+
+ //
+ // Parameter used by RRQ's multicast download.
+ //
+ IP4_ADDR McastIp;
+ UINT16 McastPort;
+ BOOLEAN Master;
+ UDP_IO_PORT *McastUdpPort;
+
+ MTFTP4_GETINFO_STATE GetInfoState;
+};
+
+VOID
+Mtftp4CleanOperation (
+ IN MTFTP4_PROTOCOL *Instance,
+ IN EFI_STATUS Result
+ );
+
+EFI_STATUS
+Mtftp4WrqStart (
+ IN MTFTP4_PROTOCOL *Instance,
+ IN UINT16 Operation
+ );
+
+EFI_STATUS
+Mtftp4RrqStart (
+ IN MTFTP4_PROTOCOL *Instance,
+ IN UINT16 Operation
+ );
+
+#define MTFTP4_SERVICE_FROM_THIS(a) \
+ CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
+
+#define MTFTP4_PROTOCOL_FROM_THIS(a) \
+ CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
+
+extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;
+#endif
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h index 3bd7574..2595dc2 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h @@ -1,73 +1,73 @@ -/** @file - -Copyright (c) 2006, 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. - -Module Name: - - Mtftp4Option.h - -Abstract: - - Mtftp4 option process routines. - - -**/ - -#ifndef __EFI_MTFTP4_OPTION_H__ -#define __EFI_MTFTP4_OPTION_H__ - -enum { - MTFTP4_SUPPORTED_OPTIONS = 4, - MTFTP4_OPCODE_LEN = 2, - MTFTP4_ERRCODE_LEN = 2, - MTFTP4_BLKNO_LEN = 2, - MTFTP4_DATA_HEAD_LEN = 4, - - MTFTP4_BLKSIZE_EXIST = 0x01, - MTFTP4_TIMEOUT_EXIST = 0x02, - MTFTP4_TSIZE_EXIST = 0x04, - MTFTP4_MCAST_EXIST = 0x08 -}; - -typedef struct { - UINT16 BlkSize; - UINT8 Timeout; - UINT32 Tsize; - IP4_ADDR McastIp; - UINT16 McastPort; - BOOLEAN Master; - UINT32 Exist; -} MTFTP4_OPTION; - -EFI_STATUS -Mtftp4ExtractOptions ( - IN EFI_MTFTP4_PACKET *Packet, - IN UINT32 PacketLen, - IN OUT UINT32 *OptionCount, - OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL - ); - -EFI_STATUS -Mtftp4ParseOption ( - IN EFI_MTFTP4_OPTION *OptionList, - IN UINT32 Count, - IN BOOLEAN Request, - OUT MTFTP4_OPTION *Option - ); - -EFI_STATUS -Mtftp4ParseOptionOack ( - IN EFI_MTFTP4_PACKET *Packet, - IN UINT32 PacketLen, - OUT MTFTP4_OPTION *Option - ); - -extern UINT8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS]; -#endif +/** @file
+
+Copyright (c) 2006, 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.
+
+Module Name:
+
+ Mtftp4Option.h
+
+Abstract:
+
+ Mtftp4 option process routines.
+
+
+**/
+
+#ifndef __EFI_MTFTP4_OPTION_H__
+#define __EFI_MTFTP4_OPTION_H__
+
+enum {
+ MTFTP4_SUPPORTED_OPTIONS = 4,
+ MTFTP4_OPCODE_LEN = 2,
+ MTFTP4_ERRCODE_LEN = 2,
+ MTFTP4_BLKNO_LEN = 2,
+ MTFTP4_DATA_HEAD_LEN = 4,
+
+ MTFTP4_BLKSIZE_EXIST = 0x01,
+ MTFTP4_TIMEOUT_EXIST = 0x02,
+ MTFTP4_TSIZE_EXIST = 0x04,
+ MTFTP4_MCAST_EXIST = 0x08
+};
+
+typedef struct {
+ UINT16 BlkSize;
+ UINT8 Timeout;
+ UINT32 Tsize;
+ IP4_ADDR McastIp;
+ UINT16 McastPort;
+ BOOLEAN Master;
+ UINT32 Exist;
+} MTFTP4_OPTION;
+
+EFI_STATUS
+Mtftp4ExtractOptions (
+ IN EFI_MTFTP4_PACKET *Packet,
+ IN UINT32 PacketLen,
+ IN OUT UINT32 *OptionCount,
+ OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL
+ );
+
+EFI_STATUS
+Mtftp4ParseOption (
+ IN EFI_MTFTP4_OPTION *OptionList,
+ IN UINT32 Count,
+ IN BOOLEAN Request,
+ OUT MTFTP4_OPTION *Option
+ );
+
+EFI_STATUS
+Mtftp4ParseOptionOack (
+ IN EFI_MTFTP4_PACKET *Packet,
+ IN UINT32 PacketLen,
+ OUT MTFTP4_OPTION *Option
+ );
+
+extern UINT8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];
+#endif
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h index be18686..5e5157b 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h @@ -1,96 +1,96 @@ -/** @file - -Copyright (c) 2006, 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. - -Module Name: - - Mtftp4Support.h - -Abstract: - - Support routines for MTFTP - - -**/ - -#ifndef __EFI_MTFTP4_SUPPORT_H__ -#define __EFI_MTFTP4_SUPPORT_H__ - -// -// The structure representing a range of block numbers, [Start, End]. -// It is used to remember the holes in the MTFTP block space. If all -// the holes are filled in, then the download or upload has completed. -// -typedef struct { - NET_LIST_ENTRY Link; - INTN Start; - INTN End; -} MTFTP4_BLOCK_RANGE; - - -EFI_STATUS -Mtftp4InitBlockRange ( - IN NET_LIST_ENTRY *Head, - IN UINT16 Start, - IN UINT16 End - ); - -INTN -Mtftp4GetNextBlockNum ( - IN NET_LIST_ENTRY *Head - ); - -VOID -Mtftp4SetLastBlockNum ( - IN NET_LIST_ENTRY *Head, - IN UINT16 Last - ); - -EFI_STATUS -Mtftp4RemoveBlockNum ( - IN NET_LIST_ENTRY *Head, - IN UINT16 Num - ); - -VOID -Mtftp4SetTimeout ( - IN MTFTP4_PROTOCOL *Instance - ); - -EFI_STATUS -Mtftp4SendPacket ( - IN MTFTP4_PROTOCOL *Instance, - IN NET_BUF *Packet - ); - -EFI_STATUS -Mtftp4SendRequest ( - IN MTFTP4_PROTOCOL *Instance - ); - -EFI_STATUS -Mtftp4SendError ( - IN MTFTP4_PROTOCOL *Instance, - IN UINT16 ErrCode, - IN UINT8* ErrInfo - ); - -EFI_STATUS -Mtftp4Retransmit ( - IN MTFTP4_PROTOCOL *Instance - ); - -VOID -EFIAPI -Mtftp4OnTimerTick ( - IN EFI_EVENT Event, - IN VOID *Context - ); -#endif +/** @file
+
+Copyright (c) 2006, 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.
+
+Module Name:
+
+ Mtftp4Support.h
+
+Abstract:
+
+ Support routines for MTFTP
+
+
+**/
+
+#ifndef __EFI_MTFTP4_SUPPORT_H__
+#define __EFI_MTFTP4_SUPPORT_H__
+
+//
+// The structure representing a range of block numbers, [Start, End].
+// It is used to remember the holes in the MTFTP block space. If all
+// the holes are filled in, then the download or upload has completed.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+ INTN Start;
+ INTN End;
+} MTFTP4_BLOCK_RANGE;
+
+
+EFI_STATUS
+Mtftp4InitBlockRange (
+ IN NET_LIST_ENTRY *Head,
+ IN UINT16 Start,
+ IN UINT16 End
+ );
+
+INTN
+Mtftp4GetNextBlockNum (
+ IN NET_LIST_ENTRY *Head
+ );
+
+VOID
+Mtftp4SetLastBlockNum (
+ IN NET_LIST_ENTRY *Head,
+ IN UINT16 Last
+ );
+
+EFI_STATUS
+Mtftp4RemoveBlockNum (
+ IN NET_LIST_ENTRY *Head,
+ IN UINT16 Num
+ );
+
+VOID
+Mtftp4SetTimeout (
+ IN MTFTP4_PROTOCOL *Instance
+ );
+
+EFI_STATUS
+Mtftp4SendPacket (
+ IN MTFTP4_PROTOCOL *Instance,
+ IN NET_BUF *Packet
+ );
+
+EFI_STATUS
+Mtftp4SendRequest (
+ IN MTFTP4_PROTOCOL *Instance
+ );
+
+EFI_STATUS
+Mtftp4SendError (
+ IN MTFTP4_PROTOCOL *Instance,
+ IN UINT16 ErrCode,
+ IN UINT8* ErrInfo
+ );
+
+EFI_STATUS
+Mtftp4Retransmit (
+ IN MTFTP4_PROTOCOL *Instance
+ );
+
+VOID
+EFIAPI
+Mtftp4OnTimerTick (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+#endif
|