summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-30 03:08:02 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-09-30 03:08:02 +0000
commit83cbd279b64f3081af5c06d50fa26e15a99fc066 (patch)
tree98bd3d981f28536759a3e5f451d4752d38d7a665 /MdeModulePkg/Universal
parent5bca971e545e01271c6ae5b1b66ee9f281123bf2 (diff)
downloadedk2-platforms-83cbd279b64f3081af5c06d50fa26e15a99fc066.tar.xz
Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4006 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpDebug.h60
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c5
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h151
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h664
-rw-r--r--MdeModulePkg/Universal/Network/ArpDxe/ComponentName.c327
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/ComponentName.c315
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c5
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h135
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h298
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h230
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h532
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/ComponentName.c319
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h239
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c5
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h150
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c318
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h286
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c5
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.h169
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h198
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h476
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h240
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h492
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h276
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h104
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.h108
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h302
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c315
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpDebug.h56
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c5
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h257
-rw-r--r--MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h548
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c315
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c5
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.h139
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h338
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h146
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.h192
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c17
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Bc.h1081
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/ComponentName.c315
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Dhcp.h1264
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Ebc/PxeArch.h72
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Hton.h86
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Ia32/PxeArch.h52
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Ip.h1472
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Ipf/PxeArch.h52
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h308
-rw-r--r--MdeModulePkg/Universal/Network/PxeBcDxe/X64/PxeArch.h52
-rw-r--r--MdeModulePkg/Universal/Network/PxeDhcp4Dxe/ComponentName.c317
-rw-r--r--MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.c17
-rw-r--r--MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.h671
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c315
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/snp.c17
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/snp.h841
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/ComponentName.c333
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h168
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h1020
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c8
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h282
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h716
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.h350
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h214
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h710
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/ComponentName.c331
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.c5
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.h140
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h579
68 files changed, 11119 insertions, 9411 deletions
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDebug.h b/MdeModulePkg/Universal/Network/ArpDxe/ArpDebug.h
index 05f542d086..fb69b07351 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDebug.h
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDebug.h
@@ -1,30 +1,30 @@
-/** @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:
-
- ArpDebug.h
-
-Abstract:
-
-
-**/
-
-#ifndef _ARP_DEBUG_H_
-#define _ARP_DEBUG_H_
-
-
-#define ARP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Arp", PrintArg)
-#define ARP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Arp", PrintArg)
-#define ARP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Arp", PrintArg)
-
-#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:
+
+ ArpDebug.h
+
+Abstract:
+
+
+**/
+
+#ifndef _ARP_DEBUG_H_
+#define _ARP_DEBUG_H_
+
+
+#define ARP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Arp", PrintArg)
+#define ARP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Arp", PrintArg)
+#define ARP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Arp", PrintArg)
+
+#endif
+
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
index 924028531a..58bc72219c 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
@@ -749,14 +749,13 @@ Returns:
--*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gArpDriverBinding,
ImageHandle,
&gArpComponentName,
- NULL,
- NULL
+ &gArpComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
index 93526c777f..457441a5c4 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
@@ -1,84 +1,85 @@
-/** @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:
-
- ArpDriver.c
-
-Abstract:
-
-
-**/
-
-#ifndef _ARP_DRIVER_H_
-#define _ARP_DRIVER_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:
+
+ ArpDriver.c
+
+Abstract:
+
+
+**/
+
+#ifndef _ARP_DRIVER_H_
+#define _ARP_DRIVER_H_
+
#include <PiDxe.h>
#include <Protocol/Arp.h>
-#include <Protocol/ManagedNetwork.h>
+#include <Protocol/ManagedNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include "ArpDebug.h"
-
-//
-// Global variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gArpComponentName;
-
-EFI_STATUS
-EFIAPI
-ArpDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-ArpDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-ArpDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-ArpServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-ArpServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-
-#endif
-
+#include <Library/UefiLib.h>
+
+#include "ArpDebug.h"
+
+//
+// Global variables
+//
+extern EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gArpComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2;
+
+EFI_STATUS
+EFIAPI
+ArpDriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+ArpDriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+ArpDriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+ArpServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+ArpServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+#endif
+
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
index 607443a99e..729cb5d68e 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
@@ -1,341 +1,341 @@
-/** @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:
-
- ArpImpl.h
-
-Abstract:
-
-
-**/
-
-#ifndef _ARP_IMPL_H_
-#define _ARP_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:
+
+ ArpImpl.h
+
+Abstract:
+
+
+**/
+
+#ifndef _ARP_IMPL_H_
+#define _ARP_IMPL_H_
+
#include <PiDxe.h>
#include <Protocol/Arp.h>
-#include <Protocol/ManagedNetwork.h>
+#include <Protocol/ManagedNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/NetLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "ArpDebug.h"
-
-#define ARP_ETHER_PROTO_TYPE 0x0806
-#define IPv4_ETHER_PROTO_TYPE 0x0800
-#define IPv6_ETHER_PROTO_TYPE 0x86DD
-
-#define ARP_OPCODE_REQUEST 0x0001
-#define ARP_OPCODE_REPLY 0x0002
-
-#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)
-#define ARP_DEFAULT_RETRY_COUNT 2
-#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)
-#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)
-
-#pragma pack(1)
-typedef struct _ARP_HEAD {
- UINT16 HwType;
- UINT16 ProtoType;
- UINT8 HwAddrLen;
- UINT8 ProtoAddrLen;
- UINT16 OpCode;
-} ARP_HEAD;
-#pragma pack()
-
-typedef struct _ARP_ADDRESS {
- UINT8 *SenderHwAddr;
- UINT8 *SenderProtoAddr;
- UINT8 *TargetHwAddr;
- UINT8 *TargetProtoAddr;
-} ARP_ADDRESS;
-
-#define MATCH_SW_ADDRESS 0x1
-#define MATCH_HW_ADDRESS 0x2
-
-typedef enum {
- ByNone = 0,
- ByProtoAddress = MATCH_SW_ADDRESS,
- ByHwAddress = MATCH_HW_ADDRESS,
- ByBoth = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
-} FIND_OPTYPE;
-
-#define ARP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'I')
-
-#define ARP_INSTANCE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- ARP_INSTANCE_DATA, \
- ArpProto, \
- ARP_INSTANCE_DATA_SIGNATURE \
- )
-
-typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;
-
-typedef struct _ARP_INSTANCE_DATA {
- UINT32 Signature;
- ARP_SERVICE_DATA *ArpService;
- EFI_HANDLE Handle;
- EFI_ARP_PROTOCOL ArpProto;
- NET_LIST_ENTRY List;
- EFI_ARP_CONFIG_DATA ConfigData;
- BOOLEAN Configured;
- BOOLEAN Destroyed;
-} ARP_INSTANCE_DATA;
-
-#define ARP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'S')
-
-#define ARP_SERVICE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- ARP_SERVICE_DATA, \
- ServiceBinding, \
- ARP_SERVICE_DATA_SIGNATURE \
- )
-
-struct _ARP_SERVICE_DATA {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
-
- EFI_HANDLE MnpChildHandle;
- EFI_HANDLE ImageHandle;
- EFI_HANDLE ControllerHandle;
-
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
- EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
- EFI_MANAGED_NETWORK_COMPLETION_TOKEN RxToken;
-
- EFI_SIMPLE_NETWORK_MODE SnpMode;
-
- NET_LOCK Lock;
-
- UINTN ChildrenNumber;
- NET_LIST_ENTRY ChildrenList;
-
- NET_LIST_ENTRY PendingRequestTable;
- NET_LIST_ENTRY DeniedCacheTable;
- NET_LIST_ENTRY ResolvedCacheTable;
-
- EFI_EVENT PeriodicTimer;
-};
-
-typedef struct _USER_REQUEST_CONTEXT {
- NET_LIST_ENTRY List;
- ARP_INSTANCE_DATA *Instance;
- EFI_EVENT UserRequestEvent;
- VOID *UserHwAddrBuffer;
-} USER_REQUEST_CONTEXT;
-
-#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)
-#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)
-
-typedef struct _NET_ARP_ADDRESS {
- UINT16 Type;
- UINT8 Length;
- UINT8 *AddressPtr;
- union {
- UINT8 ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
- UINT8 HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
- } Buffer;
-} NET_ARP_ADDRESS;
-
-typedef enum {
- Hardware,
- Protocol
-} ARP_ADDRESS_TYPE;
-
-typedef struct _ARP_CACHE_ENTRY {
- NET_LIST_ENTRY List;
-
- UINT32 RetryCount;
- UINT32 DefaultDecayTime;
- UINT32 DecayTime;
- UINT32 NextRetryTime;
-
- NET_ARP_ADDRESS Addresses[2];
-
- NET_LIST_ENTRY UserRequestList;
-} ARP_CACHE_ENTRY;
-
-EFI_STATUS
-EFIAPI
-ArpConfigure (
- IN EFI_ARP_PROTOCOL *This,
- IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-ArpAdd (
- IN EFI_ARP_PROTOCOL *This,
- IN BOOLEAN DenyFlag,
- IN VOID *TargetSwAddress OPTIONAL,
- IN VOID *TargetHwAddress OPTIONAL,
- IN UINT32 TimeoutValue,
- IN BOOLEAN Overwrite
- );
-
-EFI_STATUS
-EFIAPI
-ArpFind (
- IN EFI_ARP_PROTOCOL *This,
- IN BOOLEAN BySwAddress,
- IN VOID *AddressBuffer OPTIONAL,
- OUT UINT32 *EntryLength OPTIONAL,
- OUT UINT32 *EntryCount OPTIONAL,
- OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
- IN BOOLEAN Refresh
- );
-
-EFI_STATUS
-EFIAPI
-ArpDelete (
- IN EFI_ARP_PROTOCOL *This,
- IN BOOLEAN BySwAddress,
- IN VOID *AddressBuffer OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-ArpFlush (
- IN EFI_ARP_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-ArpRequest (
- IN EFI_ARP_PROTOCOL *This,
- IN VOID *TargetSwAddress OPTIONAL,
- IN EFI_EVENT ResolvedEvent OPTIONAL,
- OUT VOID *TargetHwAddress
- );
-
-EFI_STATUS
-EFIAPI
-ArpCancel (
- IN EFI_ARP_PROTOCOL *This,
- IN VOID *TargetSwAddress OPTIONAL,
- IN EFI_EVENT ResolvedEvent OPTIONAL
- );
-
-EFI_STATUS
-ArpConfigureInstance (
- IN ARP_INSTANCE_DATA *Instance,
- IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
- );
-
-ARP_CACHE_ENTRY *
-ArpFindDeniedCacheEntry (
- IN ARP_SERVICE_DATA *ArpService,
- IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
- IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
- );
-
-ARP_CACHE_ENTRY *
-ArpFindNextCacheEntryInTable (
- IN NET_LIST_ENTRY *CacheTable,
- IN NET_LIST_ENTRY *StartEntry,
- IN FIND_OPTYPE FindOpType,
- IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
- IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
- );
-
-ARP_CACHE_ENTRY *
-ArpAllocCacheEntry (
- IN ARP_INSTANCE_DATA *Instance
- );
-
-VOID
-ArpFillAddressInCacheEntry (
- IN ARP_CACHE_ENTRY *CacheEntry,
- IN NET_ARP_ADDRESS *HwAddr OPTIONAL,
- IN NET_ARP_ADDRESS *SwAddr OPTIONAL
- );
-
-UINTN
-ArpAddressResolved (
- IN ARP_CACHE_ENTRY *CacheEntry,
- IN ARP_INSTANCE_DATA *Instance OPTIONAL,
- IN EFI_EVENT UserEvent OPTIONAL
- );
-
-UINTN
-ArpDeleteCacheEntry (
- IN ARP_INSTANCE_DATA *Instance,
- IN BOOLEAN BySwAddress,
- IN UINT8 *AddressBuffer OPTIONAL,
- IN BOOLEAN Force
- );
-
-VOID
-ArpSendFrame (
- IN ARP_INSTANCE_DATA *Instance,
- IN ARP_CACHE_ENTRY *CacheEntry,
- IN UINT16 ArpOpCode
- );
-
-VOID
-ArpInitInstance (
- IN ARP_SERVICE_DATA *ArpService,
- IN ARP_INSTANCE_DATA *Instance
- );
-
-VOID
-EFIAPI
-ArpOnFrameRcvd (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-ArpOnFrameSent (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-ArpTimerHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-UINTN
-ArpCancelRequest (
- IN ARP_INSTANCE_DATA *Instance,
- IN VOID *TargetSwAddress OPTIONAL,
- IN EFI_EVENT UserEvent OPTIONAL
- );
-
-EFI_STATUS
-ArpFindCacheEntry (
- IN ARP_INSTANCE_DATA *Instance,
- IN BOOLEAN BySwAddress,
- IN VOID *AddressBuffer OPTIONAL,
- OUT UINT32 *EntryLength OPTIONAL,
- OUT UINT32 *EntryCount OPTIONAL,
- OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
- IN BOOLEAN Refresh
- );
-
-#endif
-
+#include <Library/UefiLib.h>
+#include <Library/NetLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+#include "ArpDebug.h"
+
+#define ARP_ETHER_PROTO_TYPE 0x0806
+#define IPv4_ETHER_PROTO_TYPE 0x0800
+#define IPv6_ETHER_PROTO_TYPE 0x86DD
+
+#define ARP_OPCODE_REQUEST 0x0001
+#define ARP_OPCODE_REPLY 0x0002
+
+#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)
+#define ARP_DEFAULT_RETRY_COUNT 2
+#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)
+#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)
+
+#pragma pack(1)
+typedef struct _ARP_HEAD {
+ UINT16 HwType;
+ UINT16 ProtoType;
+ UINT8 HwAddrLen;
+ UINT8 ProtoAddrLen;
+ UINT16 OpCode;
+} ARP_HEAD;
+#pragma pack()
+
+typedef struct _ARP_ADDRESS {
+ UINT8 *SenderHwAddr;
+ UINT8 *SenderProtoAddr;
+ UINT8 *TargetHwAddr;
+ UINT8 *TargetProtoAddr;
+} ARP_ADDRESS;
+
+#define MATCH_SW_ADDRESS 0x1
+#define MATCH_HW_ADDRESS 0x2
+
+typedef enum {
+ ByNone = 0,
+ ByProtoAddress = MATCH_SW_ADDRESS,
+ ByHwAddress = MATCH_HW_ADDRESS,
+ ByBoth = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
+} FIND_OPTYPE;
+
+#define ARP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'I')
+
+#define ARP_INSTANCE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ ARP_INSTANCE_DATA, \
+ ArpProto, \
+ ARP_INSTANCE_DATA_SIGNATURE \
+ )
+
+typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;
+
+typedef struct _ARP_INSTANCE_DATA {
+ UINT32 Signature;
+ ARP_SERVICE_DATA *ArpService;
+ EFI_HANDLE Handle;
+ EFI_ARP_PROTOCOL ArpProto;
+ NET_LIST_ENTRY List;
+ EFI_ARP_CONFIG_DATA ConfigData;
+ BOOLEAN Configured;
+ BOOLEAN Destroyed;
+} ARP_INSTANCE_DATA;
+
+#define ARP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'S')
+
+#define ARP_SERVICE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ ARP_SERVICE_DATA, \
+ ServiceBinding, \
+ ARP_SERVICE_DATA_SIGNATURE \
+ )
+
+struct _ARP_SERVICE_DATA {
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+
+ EFI_HANDLE MnpChildHandle;
+ EFI_HANDLE ImageHandle;
+ EFI_HANDLE ControllerHandle;
+
+ EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
+ EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
+ EFI_MANAGED_NETWORK_COMPLETION_TOKEN RxToken;
+
+ EFI_SIMPLE_NETWORK_MODE SnpMode;
+
+ NET_LOCK Lock;
+
+ UINTN ChildrenNumber;
+ NET_LIST_ENTRY ChildrenList;
+
+ NET_LIST_ENTRY PendingRequestTable;
+ NET_LIST_ENTRY DeniedCacheTable;
+ NET_LIST_ENTRY ResolvedCacheTable;
+
+ EFI_EVENT PeriodicTimer;
+};
+
+typedef struct _USER_REQUEST_CONTEXT {
+ NET_LIST_ENTRY List;
+ ARP_INSTANCE_DATA *Instance;
+ EFI_EVENT UserRequestEvent;
+ VOID *UserHwAddrBuffer;
+} USER_REQUEST_CONTEXT;
+
+#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)
+#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)
+
+typedef struct _NET_ARP_ADDRESS {
+ UINT16 Type;
+ UINT8 Length;
+ UINT8 *AddressPtr;
+ union {
+ UINT8 ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
+ UINT8 HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
+ } Buffer;
+} NET_ARP_ADDRESS;
+
+typedef enum {
+ Hardware,
+ Protocol
+} ARP_ADDRESS_TYPE;
+
+typedef struct _ARP_CACHE_ENTRY {
+ NET_LIST_ENTRY List;
+
+ UINT32 RetryCount;
+ UINT32 DefaultDecayTime;
+ UINT32 DecayTime;
+ UINT32 NextRetryTime;
+
+ NET_ARP_ADDRESS Addresses[2];
+
+ NET_LIST_ENTRY UserRequestList;
+} ARP_CACHE_ENTRY;
+
+EFI_STATUS
+EFIAPI
+ArpConfigure (
+ IN EFI_ARP_PROTOCOL *This,
+ IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+ArpAdd (
+ IN EFI_ARP_PROTOCOL *This,
+ IN BOOLEAN DenyFlag,
+ IN VOID *TargetSwAddress OPTIONAL,
+ IN VOID *TargetHwAddress OPTIONAL,
+ IN UINT32 TimeoutValue,
+ IN BOOLEAN Overwrite
+ );
+
+EFI_STATUS
+EFIAPI
+ArpFind (
+ IN EFI_ARP_PROTOCOL *This,
+ IN BOOLEAN BySwAddress,
+ IN VOID *AddressBuffer OPTIONAL,
+ OUT UINT32 *EntryLength OPTIONAL,
+ OUT UINT32 *EntryCount OPTIONAL,
+ OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
+ IN BOOLEAN Refresh
+ );
+
+EFI_STATUS
+EFIAPI
+ArpDelete (
+ IN EFI_ARP_PROTOCOL *This,
+ IN BOOLEAN BySwAddress,
+ IN VOID *AddressBuffer OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+ArpFlush (
+ IN EFI_ARP_PROTOCOL *This
+ );
+
+EFI_STATUS
+EFIAPI
+ArpRequest (
+ IN EFI_ARP_PROTOCOL *This,
+ IN VOID *TargetSwAddress OPTIONAL,
+ IN EFI_EVENT ResolvedEvent OPTIONAL,
+ OUT VOID *TargetHwAddress
+ );
+
+EFI_STATUS
+EFIAPI
+ArpCancel (
+ IN EFI_ARP_PROTOCOL *This,
+ IN VOID *TargetSwAddress OPTIONAL,
+ IN EFI_EVENT ResolvedEvent OPTIONAL
+ );
+
+EFI_STATUS
+ArpConfigureInstance (
+ IN ARP_INSTANCE_DATA *Instance,
+ IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
+ );
+
+ARP_CACHE_ENTRY *
+ArpFindDeniedCacheEntry (
+ IN ARP_SERVICE_DATA *ArpService,
+ IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
+ IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
+ );
+
+ARP_CACHE_ENTRY *
+ArpFindNextCacheEntryInTable (
+ IN NET_LIST_ENTRY *CacheTable,
+ IN NET_LIST_ENTRY *StartEntry,
+ IN FIND_OPTYPE FindOpType,
+ IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
+ IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
+ );
+
+ARP_CACHE_ENTRY *
+ArpAllocCacheEntry (
+ IN ARP_INSTANCE_DATA *Instance
+ );
+
+VOID
+ArpFillAddressInCacheEntry (
+ IN ARP_CACHE_ENTRY *CacheEntry,
+ IN NET_ARP_ADDRESS *HwAddr OPTIONAL,
+ IN NET_ARP_ADDRESS *SwAddr OPTIONAL
+ );
+
+UINTN
+ArpAddressResolved (
+ IN ARP_CACHE_ENTRY *CacheEntry,
+ IN ARP_INSTANCE_DATA *Instance OPTIONAL,
+ IN EFI_EVENT UserEvent OPTIONAL
+ );
+
+UINTN
+ArpDeleteCacheEntry (
+ IN ARP_INSTANCE_DATA *Instance,
+ IN BOOLEAN BySwAddress,
+ IN UINT8 *AddressBuffer OPTIONAL,
+ IN BOOLEAN Force
+ );
+
+VOID
+ArpSendFrame (
+ IN ARP_INSTANCE_DATA *Instance,
+ IN ARP_CACHE_ENTRY *CacheEntry,
+ IN UINT16 ArpOpCode
+ );
+
+VOID
+ArpInitInstance (
+ IN ARP_SERVICE_DATA *ArpService,
+ IN ARP_INSTANCE_DATA *Instance
+ );
+
+VOID
+EFIAPI
+ArpOnFrameRcvd (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+EFIAPI
+ArpOnFrameSent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+EFIAPI
+ArpTimerHandler (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+UINTN
+ArpCancelRequest (
+ IN ARP_INSTANCE_DATA *Instance,
+ IN VOID *TargetSwAddress OPTIONAL,
+ IN EFI_EVENT UserEvent OPTIONAL
+ );
+
+EFI_STATUS
+ArpFindCacheEntry (
+ IN ARP_INSTANCE_DATA *Instance,
+ IN BOOLEAN BySwAddress,
+ IN VOID *AddressBuffer OPTIONAL,
+ OUT UINT32 *EntryLength OPTIONAL,
+ OUT UINT32 *EntryCount OPTIONAL,
+ OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
+ IN BOOLEAN Refresh
+ );
+
+#endif
+
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ComponentName.c b/MdeModulePkg/Universal/Network/ArpDxe/ComponentName.c
index ad92f3cc31..47d7bd70ae 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/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
ArpComponentNameGetDriverName (
@@ -31,16 +70,86 @@ ArpComponentNameGetDriverName (
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
ArpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
@@ -48,13 +157,62 @@ EFI_COMPONENT_NAME_PROTOCOL gArpComponentName = {
ArpComponentNameGetDriverName,
ArpComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ArpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ArpComponentNameGetControllerName,
+ "en"
+ };
+
STATIC EFI_UNICODE_STRING_TABLE mArpDriverNameTable[] = {
- { "eng", L"ARP Network Service Driver" },
+ { "eng;en", L"ARP Network Service Driver" },
{ NULL, NULL }
};
+/**
+ 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
ArpComponentNameGetDriverName (
@@ -62,94 +220,93 @@ ArpComponentNameGetDriverName (
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 (
+ return LookupUnicodeString2 (
Language,
- gArpComponentName.SupportedLanguages,
+ This->SupportedLanguages,
mArpDriverNameTable,
- DriverName
+ DriverName,
+ (BOOLEAN)(This == &gArpComponentName)
);
}
+/**
+ 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
ArpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ 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/Dhcp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/ComponentName.c
index 6808e771ac..8402ae5cfa 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/ComponentName.c
@@ -24,6 +24,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
DhcpComponentNameGetDriverName (
@@ -32,6 +71,75 @@ DhcpComponentNameGetDriverName (
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
DhcpComponentNameGetControllerName (
@@ -42,18 +150,29 @@ DhcpComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = {
DhcpComponentNameGetDriverName,
DhcpComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DhcpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DhcpComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"DHCP Protocol Driver"
},
{
@@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
}
};
+/**
+ 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
DhcpComponentNameGetDriverName (
@@ -69,41 +227,84 @@ DhcpComponentNameGetDriverName (
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,
- gDhcp4ComponentName.SupportedLanguages,
- mDhcpDriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mDhcpDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gDhcp4ComponentName)
+ );
}
+/**
+ 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
DhcpComponentNameGetControllerName (
@@ -113,50 +314,6 @@ DhcpComponentNameGetControllerName (
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 isn't NULL and isn't 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/Dhcp4Dxe/Dhcp4Driver.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
index d14697262c..9549790883 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
@@ -61,14 +61,13 @@ Returns:
--*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gDhcp4DriverBinding,
ImageHandle,
&gDhcp4ComponentName,
- NULL,
- NULL
+ &gDhcp4ComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h
index 100bf56bb2..845a2847a3 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h
@@ -1,67 +1,68 @@
-/** @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:
-
- Dhcp4Driver.h
-
-Abstract:
-
- Header for the DHCP4 driver
-
-
-**/
-
-#ifndef __EFI_DHCP4_DRIVER_H__
-#define __EFI_DHCP4_DRIVER_H__
-
-extern EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName;
-
-EFI_STATUS
-EFIAPI
-Dhcp4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Dhcp4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Dhcp4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-Dhcp4ServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-Dhcp4ServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-
-#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:
+
+ Dhcp4Driver.h
+
+Abstract:
+
+ Header for the DHCP4 driver
+
+
+**/
+
+#ifndef __EFI_DHCP4_DRIVER_H__
+#define __EFI_DHCP4_DRIVER_H__
+
+extern EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2;
+
+EFI_STATUS
+EFIAPI
+Dhcp4DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Dhcp4DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Dhcp4DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+Dhcp4ServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+Dhcp4ServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
index d81d68fa1e..7a04109f4d 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
@@ -1,34 +1,34 @@
-/** @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:
-
- Dhcp4Impl.h
-
-Abstract:
-
- EFI DHCP protocol implementation
- RFCs supported are:
- RFC 2131: Dynamic Host Configuration Protocol
- RFC 2132: DHCP Options and BOOTP Vendor Extensions
- RFC 1534: Interoperation Between DHCP and BOOTP
- RFC 3396: Encoding Long Options in DHCP
-
-
-**/
-
-#ifndef __EFI_DHCP4_IMPL_H__
-#define __EFI_DHCP4_IMPL_H__
-
-
+/** @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:
+
+ Dhcp4Impl.h
+
+Abstract:
+
+ EFI DHCP protocol implementation
+ RFCs supported are:
+ RFC 2131: Dynamic Host Configuration Protocol
+ RFC 2132: DHCP Options and BOOTP Vendor Extensions
+ RFC 1534: Interoperation Between DHCP and BOOTP
+ RFC 3396: Encoding Long Options in DHCP
+
+
+**/
+
+#ifndef __EFI_DHCP4_IMPL_H__
+#define __EFI_DHCP4_IMPL_H__
+
+
#include <PiDxe.h>
@@ -39,121 +39,121 @@ Abstract:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
-#include <Library/BaseLib.h>
-#include <Library/NetLib.h>
-
-typedef struct _DHCP_SERVICE DHCP_SERVICE;
-typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
-
-#include "Dhcp4Option.h"
-#include "Dhcp4Io.h"
-
-enum {
- DHCP_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),
- DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),
-
- //
- // The state of the DHCP service. It starts as UNCONFIGED. If
- // and active child configures the service successfully, it
- // goes to CONFIGED. If the active child configures NULL, it
- // goes back to UNCONFIGED. It becomes DESTORY if it is (partly)
- // destoried.
- //
- DHCP_UNCONFIGED = 0,
- DHCP_CONFIGED,
- DHCP_DESTORY
-};
-
-struct _DHCP_PROTOCOL {
- UINT32 Signature;
- EFI_DHCP4_PROTOCOL Dhcp4Protocol;
- NET_LIST_ENTRY Link;
- EFI_HANDLE Handle;
- DHCP_SERVICE *Service;
-
- BOOLEAN InDestory;
-
- EFI_EVENT CompletionEvent;
- EFI_EVENT RenewRebindEvent;
-
- EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;
-};
-
-//
-// DHCP driver is specical in that it is a singleton. Although it
-// has a service binding, there can be only one active child.
-//
-struct _DHCP_SERVICE {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
-
- INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY
- BOOLEAN InDestory;
-
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
-
- NET_LIST_ENTRY Children;
- UINTN NumChildren;
-
- INTN DhcpState;
- EFI_STATUS IoStatus; // the result of last user operation
- UINT32 Xid;
-
- IP4_ADDR ClientAddr; // lease IP or configured client address
- IP4_ADDR Netmask;
- IP4_ADDR ServerAddr;
-
- EFI_DHCP4_PACKET *LastOffer; // The last received offer
- EFI_DHCP4_PACKET *Selected;
- DHCP_PARAMETER *Para;
-
- UINT32 Lease;
- UINT32 T1;
- UINT32 T2;
- INTN ExtraRefresh; // This refresh is reqested by user
-
- UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message
- UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP
- NET_BUF *LastPacket; // The last sent packet for retransmission
- EFI_MAC_ADDRESS Mac;
- UINT8 HwType;
- UINT8 HwLen;
-
- DHCP_PROTOCOL *ActiveChild;
- EFI_DHCP4_CONFIG_DATA ActiveConfig;
- UINT32 UserOptionLen;
-
- //
- // Timer event and various timer
- //
- EFI_EVENT Timer;
-
- UINT32 PacketToLive; // Retransmission timer for our packets
- INTN CurRetry;
- INTN MaxRetries;
-
- UINT32 WaitOffer; // Time to collect the offers
- UINT32 LeaseLife;
-};
-
-typedef struct {
- EFI_DHCP4_PACKET_OPTION **Option;
- UINT32 OptionCount;
- UINT32 Index;
-} DHCP_PARSE_CONTEXT;
-
-#define DHCP_INSTANCE_FROM_THIS(Proto) \
- CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)
-
-#define DHCP_SERVICE_FROM_THIS(Sb) \
- CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)
-
-extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;
-
-VOID
-DhcpYieldControl (
- IN DHCP_SERVICE *DhcpSb
- );
-
-#endif
+#include <Library/BaseLib.h>
+#include <Library/NetLib.h>
+
+typedef struct _DHCP_SERVICE DHCP_SERVICE;
+typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
+
+#include "Dhcp4Option.h"
+#include "Dhcp4Io.h"
+
+enum {
+ DHCP_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),
+ DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),
+
+ //
+ // The state of the DHCP service. It starts as UNCONFIGED. If
+ // and active child configures the service successfully, it
+ // goes to CONFIGED. If the active child configures NULL, it
+ // goes back to UNCONFIGED. It becomes DESTORY if it is (partly)
+ // destoried.
+ //
+ DHCP_UNCONFIGED = 0,
+ DHCP_CONFIGED,
+ DHCP_DESTORY
+};
+
+struct _DHCP_PROTOCOL {
+ UINT32 Signature;
+ EFI_DHCP4_PROTOCOL Dhcp4Protocol;
+ NET_LIST_ENTRY Link;
+ EFI_HANDLE Handle;
+ DHCP_SERVICE *Service;
+
+ BOOLEAN InDestory;
+
+ EFI_EVENT CompletionEvent;
+ EFI_EVENT RenewRebindEvent;
+
+ EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;
+};
+
+//
+// DHCP driver is specical in that it is a singleton. Although it
+// has a service binding, there can be only one active child.
+//
+struct _DHCP_SERVICE {
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+
+ INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY
+ BOOLEAN InDestory;
+
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+
+ NET_LIST_ENTRY Children;
+ UINTN NumChildren;
+
+ INTN DhcpState;
+ EFI_STATUS IoStatus; // the result of last user operation
+ UINT32 Xid;
+
+ IP4_ADDR ClientAddr; // lease IP or configured client address
+ IP4_ADDR Netmask;
+ IP4_ADDR ServerAddr;
+
+ EFI_DHCP4_PACKET *LastOffer; // The last received offer
+ EFI_DHCP4_PACKET *Selected;
+ DHCP_PARAMETER *Para;
+
+ UINT32 Lease;
+ UINT32 T1;
+ UINT32 T2;
+ INTN ExtraRefresh; // This refresh is reqested by user
+
+ UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message
+ UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP
+ NET_BUF *LastPacket; // The last sent packet for retransmission
+ EFI_MAC_ADDRESS Mac;
+ UINT8 HwType;
+ UINT8 HwLen;
+
+ DHCP_PROTOCOL *ActiveChild;
+ EFI_DHCP4_CONFIG_DATA ActiveConfig;
+ UINT32 UserOptionLen;
+
+ //
+ // Timer event and various timer
+ //
+ EFI_EVENT Timer;
+
+ UINT32 PacketToLive; // Retransmission timer for our packets
+ INTN CurRetry;
+ INTN MaxRetries;
+
+ UINT32 WaitOffer; // Time to collect the offers
+ UINT32 LeaseLife;
+};
+
+typedef struct {
+ EFI_DHCP4_PACKET_OPTION **Option;
+ UINT32 OptionCount;
+ UINT32 Index;
+} DHCP_PARSE_CONTEXT;
+
+#define DHCP_INSTANCE_FROM_THIS(Proto) \
+ CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)
+
+#define DHCP_SERVICE_FROM_THIS(Sb) \
+ CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)
+
+extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;
+
+VOID
+DhcpYieldControl (
+ IN DHCP_SERVICE *DhcpSb
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h
index a05b66282e..560c791d09 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h
@@ -1,115 +1,115 @@
-/** @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:
-
- Dhcp4Io.h
-
-Abstract:
-
- The DHCP4 protocol implementation.
-
-
-**/
-
-#ifndef __EFI_DHCP4_IO_H__
-#define __EFI_DHCP4_IO_H__
-
-#include <PiDxe.h>
-
-#include <Protocol/ServiceBinding.h>
-
-#include <Library/NetLib.h>
-#include <Library/UdpIoLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-
-enum {
- DHCP_WAIT_OFFER = 3, // Time to wait the offers
- DHCP_DEFAULT_LEASE = 7 *24 *60 *60, // Seven days as default.
- DHCP_SERVER_PORT = 67,
- DHCP_CLIENT_PORT = 68,
-
- //
- // BOOTP header "op" field
- //
- BOOTP_REQUEST = 1,
- BOOTP_REPLY = 2,
-
- //
- // DHCP message types
- //
- DHCP_MSG_DISCOVER = 1,
- DHCP_MSG_OFFER = 2,
- DHCP_MSG_REQUEST = 3,
- DHCP_MSG_DECLINE = 4,
- DHCP_MSG_ACK = 5,
- DHCP_MSG_NAK = 6,
- DHCP_MSG_RELEASE = 7,
- DHCP_MSG_INFORM = 8,
-
- //
- // DHCP notify user type
- //
- DHCP_NOTIFY_COMPLETION = 1,
- DHCP_NOTIFY_RENEWREBIND,
- DHCP_NOTIFY_ALL
-};
-
-#define DHCP_IS_BOOTP(Parameter) (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))
-
-#define DHCP_CONNECTED(State) \
- (((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))
-
-EFI_STATUS
-DhcpSetState (
- IN DHCP_SERVICE *DhcpSb,
- IN INTN State,
- IN BOOLEAN CallUser
- );
-
-EFI_STATUS
-DhcpSendMessage (
- IN DHCP_SERVICE *DhcpSb,
- IN EFI_DHCP4_PACKET *Seed,
- IN DHCP_PARAMETER *Para,
- IN UINT8 Type,
- IN UINT8 *Msg
- );
-
-VOID
-EFIAPI
-DhcpOnTimerTick (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-DhcpInput (
- NET_BUF *UdpPacket,
- UDP_POINTS *Points,
- EFI_STATUS IoStatus,
- VOID *Context
- );
-
-EFI_STATUS
-DhcpInitRequest (
- IN DHCP_SERVICE *DhcpSb
- );
-
-VOID
-DhcpCleanLease (
- IN DHCP_SERVICE *DhcpSb
- );
-
-#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:
+
+ Dhcp4Io.h
+
+Abstract:
+
+ The DHCP4 protocol implementation.
+
+
+**/
+
+#ifndef __EFI_DHCP4_IO_H__
+#define __EFI_DHCP4_IO_H__
+
+#include <PiDxe.h>
+
+#include <Protocol/ServiceBinding.h>
+
+#include <Library/NetLib.h>
+#include <Library/UdpIoLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+
+enum {
+ DHCP_WAIT_OFFER = 3, // Time to wait the offers
+ DHCP_DEFAULT_LEASE = 7 *24 *60 *60, // Seven days as default.
+ DHCP_SERVER_PORT = 67,
+ DHCP_CLIENT_PORT = 68,
+
+ //
+ // BOOTP header "op" field
+ //
+ BOOTP_REQUEST = 1,
+ BOOTP_REPLY = 2,
+
+ //
+ // DHCP message types
+ //
+ DHCP_MSG_DISCOVER = 1,
+ DHCP_MSG_OFFER = 2,
+ DHCP_MSG_REQUEST = 3,
+ DHCP_MSG_DECLINE = 4,
+ DHCP_MSG_ACK = 5,
+ DHCP_MSG_NAK = 6,
+ DHCP_MSG_RELEASE = 7,
+ DHCP_MSG_INFORM = 8,
+
+ //
+ // DHCP notify user type
+ //
+ DHCP_NOTIFY_COMPLETION = 1,
+ DHCP_NOTIFY_RENEWREBIND,
+ DHCP_NOTIFY_ALL
+};
+
+#define DHCP_IS_BOOTP(Parameter) (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))
+
+#define DHCP_CONNECTED(State) \
+ (((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))
+
+EFI_STATUS
+DhcpSetState (
+ IN DHCP_SERVICE *DhcpSb,
+ IN INTN State,
+ IN BOOLEAN CallUser
+ );
+
+EFI_STATUS
+DhcpSendMessage (
+ IN DHCP_SERVICE *DhcpSb,
+ IN EFI_DHCP4_PACKET *Seed,
+ IN DHCP_PARAMETER *Para,
+ IN UINT8 Type,
+ IN UINT8 *Msg
+ );
+
+VOID
+EFIAPI
+DhcpOnTimerTick (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+DhcpInput (
+ NET_BUF *UdpPacket,
+ UDP_POINTS *Points,
+ EFI_STATUS IoStatus,
+ VOID *Context
+ );
+
+EFI_STATUS
+DhcpInitRequest (
+ IN DHCP_SERVICE *DhcpSb
+ );
+
+VOID
+DhcpCleanLease (
+ IN DHCP_SERVICE *DhcpSb
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
index 4bc1920eb3..9db2e0a721 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
@@ -1,266 +1,266 @@
-/** @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:
-
- Dhcp4Option.h
-
-Abstract:
-
- To validate, parse and process the DHCP options
-
-
-**/
-
-#ifndef __EFI_DHCP4_OPTION_H__
-#define __EFI_DHCP4_OPTION_H__
-
-//
-// DHCP option tags (types)
-//
-enum {
- //
- // RFC1497 vendor extensions
- //
- DHCP_TAG_PAD = 0, // Pad Option
- DHCP_TAG_EOP = 255, // End Option
- DHCP_TAG_NETMASK = 1, // Subnet Mask
- DHCP_TAG_TIME_OFFSET = 2, // Time Offset from UTC
- DHCP_TAG_ROUTER = 3, // Router option,
- DHCP_TAG_TIME_SERVER = 4, // Time Server
- DHCP_TAG_NAME_SERVER = 5, // Name Server
- DHCP_TAG_DNS_SERVER = 6, // Domain Name Server
- DHCP_TAG_LOG_SERVER = 7, // Log Server
- DHCP_TAG_COOKIE_SERVER = 8, // Cookie Server
- DHCP_TAG_LPR_SERVER = 9, // LPR Print Server
- DHCP_TAG_IMPRESS_SERVER = 10, // Impress Server
- DHCP_TAG_RL_SERVER = 11, // Resource Location Server
- DHCP_TAG_HOSTNAME = 12, // Host Name
- DHCP_TAG_BOOTFILE_LEN = 13, // Boot File Size
- DHCP_TAG_DUMP = 14, // Merit Dump File
- DHCP_TAG_DOMAINNAME = 15, // Domain Name
- DHCP_TAG_SWAP_SERVER = 16, // Swap Server
- DHCP_TAG_ROOTPATH = 17, // Root path
- DHCP_TAG_EXTEND_PATH = 18, // Extensions Path
-
- //
- // IP Layer Parameters per Host
- //
- DHCP_TAG_IPFORWARD = 19, // IP Forwarding Enable/Disable
- DHCP_TAG_NONLOCAL_SRR = 20, // on-Local Source Routing Enable/Disable
- DHCP_TAG_POLICY_SRR = 21, // Policy Filter
- DHCP_TAG_EMTU = 22, // Maximum Datagram Reassembly Size
- DHCP_TAG_TTL = 23, // Default IP Time-to-live
- DHCP_TAG_PATHMTU_AGE = 24, // Path MTU Aging Timeout
- DHCP_TAG_PATHMTU_PLATEAU = 25, // Path MTU Plateau Table
-
- //
- // IP Layer Parameters per Interface
- //
- DHCP_TAG_IFMTU = 26, // Interface MTU
- DHCP_TAG_SUBNET_LOCAL = 27, // All Subnets are Local
- DHCP_TAG_BROADCAST = 28, // Broadcast Address
- DHCP_TAG_DISCOVER_MASK = 29, // Perform Mask Discovery
- DHCP_TAG_SUPPLY_MASK = 30, // Mask Supplier
- DHCP_TAG_DISCOVER_ROUTE = 31, // Perform Router Discovery
- DHCP_TAG_ROUTER_SOLICIT = 32, // Router Solicitation Address
- DHCP_TAG_STATIC_ROUTE = 33, // Static Route
-
- //
- // Link Layer Parameters per Interface
- //
- DHCP_TAG_TRAILER = 34, // Trailer Encapsulation
- DHCP_TAG_ARPAGE = 35, // ARP Cache Timeout
- DHCP_TAG_ETHER_ENCAP = 36, // Ethernet Encapsulation
-
- //
- // TCP Parameters
- //
- DHCP_TAG_TCP_TTL = 37, // TCP Default TTL
- DHCP_TAG_KEEP_INTERVAL = 38, // TCP Keepalive Interval
- DHCP_TAG_KEEP_GARBAGE = 39, // TCP Keepalive Garbage
-
- //
- // Application and Service Parameters
- //
- DHCP_TAG_NIS_DOMAIN = 40, // Network Information Service Domain
- DHCP_TAG_NIS_SERVER = 41, // Network Information Servers
- DHCP_TAG_NTP_SERVER = 42, // Network Time Protocol Servers
- DHCP_TAG_VENDOR = 43, // Vendor Specific Information
- DHCP_TAG_NBNS = 44, // NetBIOS over TCP/IP Name Server
- DHCP_TAG_NBDD = 45, // NetBIOS Datagram Distribution Server
- DHCP_TAG_NBTYPE = 46, // NetBIOS over TCP/IP Node Type
- DHCP_TAG_NBSCOPE = 47, // NetBIOS over TCP/IP Scope
- DHCP_TAG_XFONT = 48, // X Window System Font Server
- DHCP_TAG_XDM = 49, // X Window System Display Manager
- DHCP_TAG_NISPLUS = 64, // Network Information Service+ Domain
- DHCP_TAG_NISPLUS_SERVER = 65, // Network Information Service+ Servers
- DHCP_TAG_MOBILEIP = 68, // Mobile IP Home Agent
- DHCP_TAG_SMTP = 69, // Simple Mail Transport Protocol Server
- DHCP_TAG_POP3 = 70, // Post Office Protocol (POP3) Server
- DHCP_TAG_NNTP = 71, // Network News Transport Protocol Server
- DHCP_TAG_WWW = 72, // Default World Wide Web (WWW) Server
- DHCP_TAG_FINGER = 73, // Default Finger Server
- DHCP_TAG_IRC = 74, // Default Internet Relay Chat (IRC) Server
- DHCP_TAG_STTALK = 75, // StreetTalk Server
- DHCP_TAG_STDA = 76, // StreetTalk Directory Assistance Server
- DHCP_TAG_CLASSLESS_ROUTE = 121, // Classless Route
-
- //
- // DHCP Extensions
- //
- DHCP_TAG_REQUEST_IP = 50, // Requested IP Address
- DHCP_TAG_LEASE = 51, // IP Address Lease Time
- DHCP_TAG_OVERLOAD = 52, // Option Overload
- DHCP_TAG_TFTP = 66, // TFTP server name
- DHCP_TAG_BOOTFILE = 67, // Bootfile name
- DHCP_TAG_TYPE = 53, // DHCP Message Type
- DHCP_TAG_SERVER_ID = 54, // Server Identifier
- DHCP_TAG_PARA_LIST = 55, // Parameter Request List
- DHCP_TAG_MESSAGE = 56, // Message
- DHCP_TAG_MAXMSG = 57, // Maximum DHCP Message Size
- DHCP_TAG_T1 = 58, // Renewal (T1) Time Value
- DHCP_TAG_T2 = 59, // Rebinding (T2) Time Value
- DHCP_TAG_VENDOR_CLASS = 60, // Vendor class identifier
- DHCP_TAG_CLIENT_ID = 61 // Client-identifier
-};
-
-enum {
- DHCP_OPTION_MAGIC = 0x63538263, // Network byte order
- DHCP_MAX_OPTIONS = 256,
-
- //
- // DHCP option types, this is used to validate the DHCP options.
- //
- DHCP_OPTION_SWITCH = 1,
- DHCP_OPTION_INT8,
- DHCP_OPTION_INT16,
- DHCP_OPTION_INT32,
- DHCP_OPTION_IP,
- DHCP_OPTION_IPPAIR,
-
- //
- // Value of DHCP overload option
- //
- DHCP_OVERLOAD_FILENAME = 1,
- DHCP_OVERLOAD_SVRNAME = 2,
- DHCP_OVERLOAD_BOTH = 3
-};
-
-//
-// The DHCP option structure. This structure extends the EFI_DHCP_OPTION
-// structure to support options longer than 255 bytes, such as classless route.
-//
-typedef struct {
- UINT8 Tag;
- UINT16 Len;
- UINT8 *Data;
-} DHCP_OPTION;
-
-//
-// Structures used to parse the DHCP options with RFC3396 support.
-//
-typedef struct {
- UINT8 Index;
- UINT16 Offset;
-} DHCP_OPTION_COUNT;
-
-typedef struct {
- DHCP_OPTION_COUNT *OpCount;
- DHCP_OPTION *Options;
- UINT8 *Buf;
-} DHCP_OPTION_CONTEXT;
-
-//
-// The options that matters to DHCP driver itself. The user of
-// DHCP clients may be interested in other options, such as
-// classless route, who can parse the DHCP offer to get them.
-//
-typedef struct {
- IP4_ADDR NetMask; // DHCP_TAG_NETMASK
- IP4_ADDR Router; // DHCP_TAG_ROUTER, only the first router is used
-
- //
- // DHCP specific options
- //
- UINT8 DhcpType; // DHCP_TAG_TYPE
- UINT8 Overload; // DHCP_TAG_OVERLOAD
- IP4_ADDR ServerId; // DHCP_TAG_SERVER_ID
- UINT32 Lease; // DHCP_TAG_LEASE
- UINT32 T1; // DHCP_TAG_T1
- UINT32 T2; // DHCP_TAG_T2
-} DHCP_PARAMETER;
-
-//
-// Structure used to describe and validate the format of DHCP options.
-// Type is the options' data type, such as DHCP_OPTION_INT8. MinOccur
-// is the minium occurance of this data type. MaxOccur is defined
-// similarly. If MaxOccur is -1, it means that there is no limit on the
-// maximum occurance. Alert tells whether DHCP client should further
-// inspect the option to parse DHCP_PARAMETER.
-//
-typedef struct {
- UINT8 Tag;
- INTN Type;
- INTN MinOccur;
- INTN MaxOccur;
- BOOLEAN Alert;
-} DHCP_OPTION_FORMAT;
-
-typedef
-EFI_STATUS
-(*DHCP_CHECK_OPTION) (
- IN UINT8 Tag,
- IN UINT8 Len,
- IN UINT8 *Data,
- IN VOID *Context
- );
-
-EFI_STATUS
-DhcpIterateOptions (
- IN EFI_DHCP4_PACKET *Packet,
- IN DHCP_CHECK_OPTION Check, OPTIONAL
- IN VOID *Context
- );
-
-EFI_STATUS
-DhcpValidateOptions (
- IN EFI_DHCP4_PACKET *Packet,
- OUT DHCP_PARAMETER **Para OPTIONAL
- );
-
-EFI_STATUS
-DhcpParseOption (
- IN EFI_DHCP4_PACKET *Packet,
- OUT INTN *Count,
- OUT DHCP_OPTION **OptionPoint
- );
-
-UINT8 *
-DhcpAppendOption (
- IN UINT8 *Buf,
- IN UINT8 Tag,
- IN UINT16 DataLen,
- IN UINT8 *Data
- );
-
-EFI_STATUS
-DhcpBuild (
- IN EFI_DHCP4_PACKET *SeedPacket,
- IN UINT32 DeleteCount,
- IN UINT8 *DeleteList OPTIONAL,
- IN UINT32 AppendCount,
- IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
- OUT EFI_DHCP4_PACKET **NewPacket
- );
-
-#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:
+
+ Dhcp4Option.h
+
+Abstract:
+
+ To validate, parse and process the DHCP options
+
+
+**/
+
+#ifndef __EFI_DHCP4_OPTION_H__
+#define __EFI_DHCP4_OPTION_H__
+
+//
+// DHCP option tags (types)
+//
+enum {
+ //
+ // RFC1497 vendor extensions
+ //
+ DHCP_TAG_PAD = 0, // Pad Option
+ DHCP_TAG_EOP = 255, // End Option
+ DHCP_TAG_NETMASK = 1, // Subnet Mask
+ DHCP_TAG_TIME_OFFSET = 2, // Time Offset from UTC
+ DHCP_TAG_ROUTER = 3, // Router option,
+ DHCP_TAG_TIME_SERVER = 4, // Time Server
+ DHCP_TAG_NAME_SERVER = 5, // Name Server
+ DHCP_TAG_DNS_SERVER = 6, // Domain Name Server
+ DHCP_TAG_LOG_SERVER = 7, // Log Server
+ DHCP_TAG_COOKIE_SERVER = 8, // Cookie Server
+ DHCP_TAG_LPR_SERVER = 9, // LPR Print Server
+ DHCP_TAG_IMPRESS_SERVER = 10, // Impress Server
+ DHCP_TAG_RL_SERVER = 11, // Resource Location Server
+ DHCP_TAG_HOSTNAME = 12, // Host Name
+ DHCP_TAG_BOOTFILE_LEN = 13, // Boot File Size
+ DHCP_TAG_DUMP = 14, // Merit Dump File
+ DHCP_TAG_DOMAINNAME = 15, // Domain Name
+ DHCP_TAG_SWAP_SERVER = 16, // Swap Server
+ DHCP_TAG_ROOTPATH = 17, // Root path
+ DHCP_TAG_EXTEND_PATH = 18, // Extensions Path
+
+ //
+ // IP Layer Parameters per Host
+ //
+ DHCP_TAG_IPFORWARD = 19, // IP Forwarding Enable/Disable
+ DHCP_TAG_NONLOCAL_SRR = 20, // on-Local Source Routing Enable/Disable
+ DHCP_TAG_POLICY_SRR = 21, // Policy Filter
+ DHCP_TAG_EMTU = 22, // Maximum Datagram Reassembly Size
+ DHCP_TAG_TTL = 23, // Default IP Time-to-live
+ DHCP_TAG_PATHMTU_AGE = 24, // Path MTU Aging Timeout
+ DHCP_TAG_PATHMTU_PLATEAU = 25, // Path MTU Plateau Table
+
+ //
+ // IP Layer Parameters per Interface
+ //
+ DHCP_TAG_IFMTU = 26, // Interface MTU
+ DHCP_TAG_SUBNET_LOCAL = 27, // All Subnets are Local
+ DHCP_TAG_BROADCAST = 28, // Broadcast Address
+ DHCP_TAG_DISCOVER_MASK = 29, // Perform Mask Discovery
+ DHCP_TAG_SUPPLY_MASK = 30, // Mask Supplier
+ DHCP_TAG_DISCOVER_ROUTE = 31, // Perform Router Discovery
+ DHCP_TAG_ROUTER_SOLICIT = 32, // Router Solicitation Address
+ DHCP_TAG_STATIC_ROUTE = 33, // Static Route
+
+ //
+ // Link Layer Parameters per Interface
+ //
+ DHCP_TAG_TRAILER = 34, // Trailer Encapsulation
+ DHCP_TAG_ARPAGE = 35, // ARP Cache Timeout
+ DHCP_TAG_ETHER_ENCAP = 36, // Ethernet Encapsulation
+
+ //
+ // TCP Parameters
+ //
+ DHCP_TAG_TCP_TTL = 37, // TCP Default TTL
+ DHCP_TAG_KEEP_INTERVAL = 38, // TCP Keepalive Interval
+ DHCP_TAG_KEEP_GARBAGE = 39, // TCP Keepalive Garbage
+
+ //
+ // Application and Service Parameters
+ //
+ DHCP_TAG_NIS_DOMAIN = 40, // Network Information Service Domain
+ DHCP_TAG_NIS_SERVER = 41, // Network Information Servers
+ DHCP_TAG_NTP_SERVER = 42, // Network Time Protocol Servers
+ DHCP_TAG_VENDOR = 43, // Vendor Specific Information
+ DHCP_TAG_NBNS = 44, // NetBIOS over TCP/IP Name Server
+ DHCP_TAG_NBDD = 45, // NetBIOS Datagram Distribution Server
+ DHCP_TAG_NBTYPE = 46, // NetBIOS over TCP/IP Node Type
+ DHCP_TAG_NBSCOPE = 47, // NetBIOS over TCP/IP Scope
+ DHCP_TAG_XFONT = 48, // X Window System Font Server
+ DHCP_TAG_XDM = 49, // X Window System Display Manager
+ DHCP_TAG_NISPLUS = 64, // Network Information Service+ Domain
+ DHCP_TAG_NISPLUS_SERVER = 65, // Network Information Service+ Servers
+ DHCP_TAG_MOBILEIP = 68, // Mobile IP Home Agent
+ DHCP_TAG_SMTP = 69, // Simple Mail Transport Protocol Server
+ DHCP_TAG_POP3 = 70, // Post Office Protocol (POP3) Server
+ DHCP_TAG_NNTP = 71, // Network News Transport Protocol Server
+ DHCP_TAG_WWW = 72, // Default World Wide Web (WWW) Server
+ DHCP_TAG_FINGER = 73, // Default Finger Server
+ DHCP_TAG_IRC = 74, // Default Internet Relay Chat (IRC) Server
+ DHCP_TAG_STTALK = 75, // StreetTalk Server
+ DHCP_TAG_STDA = 76, // StreetTalk Directory Assistance Server
+ DHCP_TAG_CLASSLESS_ROUTE = 121, // Classless Route
+
+ //
+ // DHCP Extensions
+ //
+ DHCP_TAG_REQUEST_IP = 50, // Requested IP Address
+ DHCP_TAG_LEASE = 51, // IP Address Lease Time
+ DHCP_TAG_OVERLOAD = 52, // Option Overload
+ DHCP_TAG_TFTP = 66, // TFTP server name
+ DHCP_TAG_BOOTFILE = 67, // Bootfile name
+ DHCP_TAG_TYPE = 53, // DHCP Message Type
+ DHCP_TAG_SERVER_ID = 54, // Server Identifier
+ DHCP_TAG_PARA_LIST = 55, // Parameter Request List
+ DHCP_TAG_MESSAGE = 56, // Message
+ DHCP_TAG_MAXMSG = 57, // Maximum DHCP Message Size
+ DHCP_TAG_T1 = 58, // Renewal (T1) Time Value
+ DHCP_TAG_T2 = 59, // Rebinding (T2) Time Value
+ DHCP_TAG_VENDOR_CLASS = 60, // Vendor class identifier
+ DHCP_TAG_CLIENT_ID = 61 // Client-identifier
+};
+
+enum {
+ DHCP_OPTION_MAGIC = 0x63538263, // Network byte order
+ DHCP_MAX_OPTIONS = 256,
+
+ //
+ // DHCP option types, this is used to validate the DHCP options.
+ //
+ DHCP_OPTION_SWITCH = 1,
+ DHCP_OPTION_INT8,
+ DHCP_OPTION_INT16,
+ DHCP_OPTION_INT32,
+ DHCP_OPTION_IP,
+ DHCP_OPTION_IPPAIR,
+
+ //
+ // Value of DHCP overload option
+ //
+ DHCP_OVERLOAD_FILENAME = 1,
+ DHCP_OVERLOAD_SVRNAME = 2,
+ DHCP_OVERLOAD_BOTH = 3
+};
+
+//
+// The DHCP option structure. This structure extends the EFI_DHCP_OPTION
+// structure to support options longer than 255 bytes, such as classless route.
+//
+typedef struct {
+ UINT8 Tag;
+ UINT16 Len;
+ UINT8 *Data;
+} DHCP_OPTION;
+
+//
+// Structures used to parse the DHCP options with RFC3396 support.
+//
+typedef struct {
+ UINT8 Index;
+ UINT16 Offset;
+} DHCP_OPTION_COUNT;
+
+typedef struct {
+ DHCP_OPTION_COUNT *OpCount;
+ DHCP_OPTION *Options;
+ UINT8 *Buf;
+} DHCP_OPTION_CONTEXT;
+
+//
+// The options that matters to DHCP driver itself. The user of
+// DHCP clients may be interested in other options, such as
+// classless route, who can parse the DHCP offer to get them.
+//
+typedef struct {
+ IP4_ADDR NetMask; // DHCP_TAG_NETMASK
+ IP4_ADDR Router; // DHCP_TAG_ROUTER, only the first router is used
+
+ //
+ // DHCP specific options
+ //
+ UINT8 DhcpType; // DHCP_TAG_TYPE
+ UINT8 Overload; // DHCP_TAG_OVERLOAD
+ IP4_ADDR ServerId; // DHCP_TAG_SERVER_ID
+ UINT32 Lease; // DHCP_TAG_LEASE
+ UINT32 T1; // DHCP_TAG_T1
+ UINT32 T2; // DHCP_TAG_T2
+} DHCP_PARAMETER;
+
+//
+// Structure used to describe and validate the format of DHCP options.
+// Type is the options' data type, such as DHCP_OPTION_INT8. MinOccur
+// is the minium occurance of this data type. MaxOccur is defined
+// similarly. If MaxOccur is -1, it means that there is no limit on the
+// maximum occurance. Alert tells whether DHCP client should further
+// inspect the option to parse DHCP_PARAMETER.
+//
+typedef struct {
+ UINT8 Tag;
+ INTN Type;
+ INTN MinOccur;
+ INTN MaxOccur;
+ BOOLEAN Alert;
+} DHCP_OPTION_FORMAT;
+
+typedef
+EFI_STATUS
+(*DHCP_CHECK_OPTION) (
+ IN UINT8 Tag,
+ IN UINT8 Len,
+ IN UINT8 *Data,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+DhcpIterateOptions (
+ IN EFI_DHCP4_PACKET *Packet,
+ IN DHCP_CHECK_OPTION Check, OPTIONAL
+ IN VOID *Context
+ );
+
+EFI_STATUS
+DhcpValidateOptions (
+ IN EFI_DHCP4_PACKET *Packet,
+ OUT DHCP_PARAMETER **Para OPTIONAL
+ );
+
+EFI_STATUS
+DhcpParseOption (
+ IN EFI_DHCP4_PACKET *Packet,
+ OUT INTN *Count,
+ OUT DHCP_OPTION **OptionPoint
+ );
+
+UINT8 *
+DhcpAppendOption (
+ IN UINT8 *Buf,
+ IN UINT8 Tag,
+ IN UINT16 DataLen,
+ IN UINT8 *Data
+ );
+
+EFI_STATUS
+DhcpBuild (
+ IN EFI_DHCP4_PACKET *SeedPacket,
+ IN UINT32 DeleteCount,
+ IN UINT8 *DeleteList OPTIONAL,
+ IN UINT32 AppendCount,
+ IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
+ OUT EFI_DHCP4_PACKET **NewPacket
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/ComponentName.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/ComponentName.c
index 1be21a1791..1fbee2a097 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/ComponentName.c
@@ -24,6 +24,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
Ip4ConfigComponentNameGetDriverName (
@@ -32,6 +71,75 @@ Ip4ConfigComponentNameGetDriverName (
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
Ip4ConfigComponentNameGetControllerName (
@@ -42,21 +150,71 @@ Ip4ConfigComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
Ip4ConfigComponentNameGetDriverName,
Ip4ConfigComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ConfigComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ConfigComponentNameGetControllerName,
+ "en"
+ };
+
STATIC
EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable[] = {
- {"eng", L"IP4 CONFIG Network Service Driver"},
+ {"eng;en", L"IP4 CONFIG Network Service Driver"},
{NULL, NULL}
};
+/**
+ 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
Ip4ConfigComponentNameGetDriverName (
@@ -64,94 +222,93 @@ Ip4ConfigComponentNameGetDriverName (
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 (
+ return LookupUnicodeString2 (
Language,
- gIp4ConfigComponentName.SupportedLanguages,
+ This->SupportedLanguages,
mIp4ConfigDriverNameTable,
- DriverName
+ DriverName,
+ (BOOLEAN)(This == &gIp4ConfigComponentName)
);
}
+/**
+ 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
Ip4ConfigComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ 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/Ip4ConfigDxe/Ip4Config.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
index 8c58c8078c..55629447af 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
@@ -1,28 +1,28 @@
-/** @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:
-
- Ip4Config.h
-
-Abstract:
-
- Header file for IP4Config driver.
-
-
-**/
-
-#ifndef __EFI_IP4CONFIG_H__
-#define __EFI_IP4CONFIG_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:
+
+ Ip4Config.h
+
+Abstract:
+
+ Header file for IP4Config driver.
+
+
+**/
+
+#ifndef __EFI_IP4CONFIG_H__
+#define __EFI_IP4CONFIG_H__
+
#include <PiDxe.h>
#include <Protocol/Dhcp4.h>
@@ -36,97 +36,98 @@ Abstract:
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "NicIp4Variable.h"
-
-typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
-
-enum {
- IP4_CONFIG_STATE_IDLE = 0,
- IP4_CONFIG_STATE_STARTED,
- IP4_CONFIG_STATE_CONFIGURED,
-
- IP4_PROTO_ICMP = 0x01,
- IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
-
- DHCP_TAG_PARA_LIST = 55,
- DHCP_TAG_NETMASK = 1,
- DHCP_TAG_ROUTER = 3
-};
-
-//
-// Configure the DHCP to request the routers and netmask
-// from server. The DHCP_TAG_NETMASK is included in Head.
-//
-#pragma pack(1)
-typedef struct {
- EFI_DHCP4_PACKET_OPTION Head;
- UINT8 Route;
-} IP4_CONFIG_DHCP4_OPTION;
-#pragma pack()
-
-struct _IP4_CONFIG_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
-
- EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
- EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
-
- //
- // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
- //
- INTN State;
-
- //
- // Mnp child to keep the connection with MNP.
- //
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
- EFI_HANDLE MnpHandle;
-
- //
- // User's requests data
- //
- EFI_EVENT DoneEvent;
- EFI_EVENT ReconfigEvent;
- EFI_STATUS Result;
-
- //
- // Identity of this interface and some configuration info.
- //
- NIC_ADDR NicAddr;
- UINT16 NicName[IP4_NIC_NAME_LENGTH];
- UINT32 NicIndex;
- NIC_IP4_CONFIG_INFO *NicConfig;
-
- //
- // DHCP handles to access DHCP
- //
- EFI_DHCP4_PROTOCOL *Dhcp4;
- EFI_HANDLE Dhcp4Handle;
- EFI_EVENT Dhcp4Event;
-};
-
-#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
- CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
-
-#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
- CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
-
-extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
-extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
-extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
-extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
-
-VOID
-Ip4ConfigCleanDhcp4 (
- IN IP4_CONFIG_INSTANCE *This
- );
-
-VOID
-Ip4ConfigCleanConfig (
- IN IP4_CONFIG_INSTANCE *Instance
- );
-#endif
+#include <Library/MemoryAllocationLib.h>
+
+#include "NicIp4Variable.h"
+
+typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
+
+enum {
+ IP4_CONFIG_STATE_IDLE = 0,
+ IP4_CONFIG_STATE_STARTED,
+ IP4_CONFIG_STATE_CONFIGURED,
+
+ IP4_PROTO_ICMP = 0x01,
+ IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
+
+ DHCP_TAG_PARA_LIST = 55,
+ DHCP_TAG_NETMASK = 1,
+ DHCP_TAG_ROUTER = 3
+};
+
+//
+// Configure the DHCP to request the routers and netmask
+// from server. The DHCP_TAG_NETMASK is included in Head.
+//
+#pragma pack(1)
+typedef struct {
+ EFI_DHCP4_PACKET_OPTION Head;
+ UINT8 Route;
+} IP4_CONFIG_DHCP4_OPTION;
+#pragma pack()
+
+struct _IP4_CONFIG_INSTANCE {
+ UINT32 Signature;
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+
+ EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
+ EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
+
+ //
+ // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
+ //
+ INTN State;
+
+ //
+ // Mnp child to keep the connection with MNP.
+ //
+ EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
+ EFI_HANDLE MnpHandle;
+
+ //
+ // User's requests data
+ //
+ EFI_EVENT DoneEvent;
+ EFI_EVENT ReconfigEvent;
+ EFI_STATUS Result;
+
+ //
+ // Identity of this interface and some configuration info.
+ //
+ NIC_ADDR NicAddr;
+ UINT16 NicName[IP4_NIC_NAME_LENGTH];
+ UINT32 NicIndex;
+ NIC_IP4_CONFIG_INFO *NicConfig;
+
+ //
+ // DHCP handles to access DHCP
+ //
+ EFI_DHCP4_PROTOCOL *Dhcp4;
+ EFI_HANDLE Dhcp4Handle;
+ EFI_EVENT Dhcp4Event;
+};
+
+#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
+ CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
+
+#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
+ CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
+
+extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
+extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
+extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
+extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
+
+VOID
+Ip4ConfigCleanDhcp4 (
+ IN IP4_CONFIG_INSTANCE *This
+ );
+
+VOID
+Ip4ConfigCleanConfig (
+ IN IP4_CONFIG_INSTANCE *Instance
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
index c3845f4734..fdd50b3535 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
@@ -85,14 +85,13 @@ Returns:
--*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gIp4ConfigDriverBinding,
ImageHandle,
&gIp4ConfigComponentName,
- NULL,
- NULL
+ &gIp4ConfigComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
index 74d1660c4d..be8ccd7b5f 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
@@ -1,75 +1,75 @@
-/** @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:
-
- NicIp4Variable.h
-
-Abstract:
-
- Routines used to operate the Ip4 configure variable
-
-
-**/
-
-#ifndef _NIC_IP4_VARIABLE_H_
-#define _NIC_IP4_VARIABLE_H_
-
-
-#include <Protocol/NicIp4Config.h>
-
-//
-// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
-// They are of variable size
-//
-#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
- (sizeof (EFI_IP4_IPCONFIG_DATA) + \
- sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
-
-#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
- (sizeof (NIC_IP4_CONFIG_INFO) + \
- sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
-
-//
-// Compare whether two NIC address are equal includes their type and length.
-//
-#define NIC_ADDR_EQUAL(Nic1, Nic2) \
- (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
- NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
-
-BOOLEAN
-Ip4ConfigIsValid (
- IN NIC_IP4_CONFIG_INFO *NicConfig
- );
-
-IP4_CONFIG_VARIABLE *
-Ip4ConfigReadVariable (
- VOID
- );
-
-EFI_STATUS
-Ip4ConfigWriteVariable (
- IN IP4_CONFIG_VARIABLE *Config OPTIONAL
- );
-
-NIC_IP4_CONFIG_INFO *
-Ip4ConfigFindNicVariable (
- IN IP4_CONFIG_VARIABLE *Variable,
- IN NIC_ADDR *NicAddr
- );
-
-IP4_CONFIG_VARIABLE *
-Ip4ConfigModifyVariable (
- IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
- IN NIC_ADDR *NicAddr,
- IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
- );
-#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:
+
+ NicIp4Variable.h
+
+Abstract:
+
+ Routines used to operate the Ip4 configure variable
+
+
+**/
+
+#ifndef _NIC_IP4_VARIABLE_H_
+#define _NIC_IP4_VARIABLE_H_
+
+
+#include <Protocol/NicIp4Config.h>
+
+//
+// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
+// They are of variable size
+//
+#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
+ (sizeof (EFI_IP4_IPCONFIG_DATA) + \
+ sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
+
+#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
+ (sizeof (NIC_IP4_CONFIG_INFO) + \
+ sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
+
+//
+// Compare whether two NIC address are equal includes their type and length.
+//
+#define NIC_ADDR_EQUAL(Nic1, Nic2) \
+ (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
+ NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
+
+BOOLEAN
+Ip4ConfigIsValid (
+ IN NIC_IP4_CONFIG_INFO *NicConfig
+ );
+
+IP4_CONFIG_VARIABLE *
+Ip4ConfigReadVariable (
+ VOID
+ );
+
+EFI_STATUS
+Ip4ConfigWriteVariable (
+ IN IP4_CONFIG_VARIABLE *Config OPTIONAL
+ );
+
+NIC_IP4_CONFIG_INFO *
+Ip4ConfigFindNicVariable (
+ IN IP4_CONFIG_VARIABLE *Variable,
+ IN NIC_ADDR *NicAddr
+ );
+
+IP4_CONFIG_VARIABLE *
+Ip4ConfigModifyVariable (
+ IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
+ IN NIC_ADDR *NicAddr,
+ IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c
index 728887587e..01642c2383 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c
@@ -24,6 +24,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
Ip4ComponentNameGetDriverName (
@@ -32,6 +71,75 @@ Ip4ComponentNameGetDriverName (
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
Ip4ComponentNameGetControllerName (
@@ -42,18 +150,29 @@ Ip4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
Ip4ComponentNameGetDriverName,
Ip4ComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"IP4 Network Service Driver"
},
{
@@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
}
};
+/**
+ 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
Ip4ComponentNameGetDriverName (
@@ -69,44 +227,85 @@ Ip4ComponentNameGetDriverName (
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,
- gIp4ComponentName.SupportedLanguages,
- mIp4DriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mIp4DriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gIp4ComponentName)
+ );
}
+/**
+ 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
Ip4ComponentNameGetControllerName (
@@ -116,51 +315,6 @@ Ip4ComponentNameGetControllerName (
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/Ip4Dxe/Ip4Common.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
index 4c5a7b4079..35368b3461 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
@@ -1,143 +1,143 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Common.h
-
-Abstract:
-
- Common definition for IP4.
-
-
-**/
-
-#ifndef __EFI_IP4_COMMON_H__
-#define __EFI_IP4_COMMON_H__
-
-typedef struct _IP4_INTERFACE IP4_INTERFACE;
-typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
-typedef struct _IP4_SERVICE IP4_SERVICE;
-
-
-enum {
- IP4_ETHER_PROTO = 0x0800,
-
- IP4_PROTO_ICMP = 0x01,
- IP4_PROTO_IGMP = 0x02,
-
- //
- // The packet is received as link level broadcast/multicast/promiscuous.
- //
- IP4_LINK_BROADCAST = 0x00000001,
- IP4_LINK_MULTICAST = 0x00000002,
- IP4_LINK_PROMISC = 0x00000004,
-
- //
- // IP4 address cast type classfication. Keep it true that any
- // type bigger than or equal to LOCAL_BROADCAST is broadcast.
- //
- IP4_PROMISCUOUS = 1,
- IP4_LOCAL_HOST,
- IP4_MULTICAST,
- IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255
- IP4_SUBNET_BROADCAST,
- IP4_NET_BROADCAST,
-
- //
- // IP4 header flags
- //
- IP4_HEAD_DF_MASK = 0x4000,
- IP4_HEAD_MF_MASK = 0x2000,
- IP4_HEAD_OFFSET_MASK = 0x1fff
-};
-
-#define IP4_ALLZERO_ADDRESS 0x00000000u
-#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
-#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
-#define IP4_ALLROUTER_ADDRESS 0xE0000002u
-
-//
-// Compose the fragment field to be used in the IP4 header.
-//
-#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
- ((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 0x1fff)))
-
-#define IP4_LAST_FRAGMENT(FragmentField) \
- (((FragmentField) & IP4_HEAD_MF_MASK) == 0)
-
-#define IP4_FIRST_FRAGMENT(FragmentField) \
- ((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))
-
-#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
-
-//
-// Conver the Microsecond to second. IP transmit/receive time is
-// in the unit of microsecond. IP ticks once per second.
-//
-#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
-
-INTN
-Ip4GetNetCast (
- IN IP4_ADDR IpAddr,
- IN IP4_INTERFACE *IpIf
- );
-
-INTN
-Ip4GetHostCast (
- IN IP4_SERVICE *IpSb,
- IN IP4_ADDR Dst,
- IN IP4_ADDR Src
- );
-
-IP4_INTERFACE *
-Ip4FindInterface (
- IN IP4_SERVICE *IpService,
- IN IP4_ADDR Addr
- );
-
-IP4_INTERFACE *
-Ip4FindNet (
- IN IP4_SERVICE *IpService,
- IN IP4_ADDR Addr
- );
-
-IP4_INTERFACE *
-Ip4FindStationAddress (
- IN IP4_SERVICE *IpSb,
- IN IP4_ADDR Ip,
- IN IP4_ADDR Netmask
- );
-
-EFI_STATUS
-Ip4GetMulticastMac (
- IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
- IN IP4_ADDR Multicast,
- OUT EFI_MAC_ADDRESS *Mac
- );
-
-IP4_HEAD *
-Ip4NtohHead (
- IN IP4_HEAD *Head
- );
-
-EFI_STATUS
-Ip4SetVariableData (
- IN IP4_SERVICE *IpSb
- );
-
-VOID
-Ip4ClearVariableData (
- IN IP4_SERVICE *IpSb
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Common.h
+
+Abstract:
+
+ Common definition for IP4.
+
+
+**/
+
+#ifndef __EFI_IP4_COMMON_H__
+#define __EFI_IP4_COMMON_H__
+
+typedef struct _IP4_INTERFACE IP4_INTERFACE;
+typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
+typedef struct _IP4_SERVICE IP4_SERVICE;
+
+
+enum {
+ IP4_ETHER_PROTO = 0x0800,
+
+ IP4_PROTO_ICMP = 0x01,
+ IP4_PROTO_IGMP = 0x02,
+
+ //
+ // The packet is received as link level broadcast/multicast/promiscuous.
+ //
+ IP4_LINK_BROADCAST = 0x00000001,
+ IP4_LINK_MULTICAST = 0x00000002,
+ IP4_LINK_PROMISC = 0x00000004,
+
+ //
+ // IP4 address cast type classfication. Keep it true that any
+ // type bigger than or equal to LOCAL_BROADCAST is broadcast.
+ //
+ IP4_PROMISCUOUS = 1,
+ IP4_LOCAL_HOST,
+ IP4_MULTICAST,
+ IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255
+ IP4_SUBNET_BROADCAST,
+ IP4_NET_BROADCAST,
+
+ //
+ // IP4 header flags
+ //
+ IP4_HEAD_DF_MASK = 0x4000,
+ IP4_HEAD_MF_MASK = 0x2000,
+ IP4_HEAD_OFFSET_MASK = 0x1fff
+};
+
+#define IP4_ALLZERO_ADDRESS 0x00000000u
+#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
+#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
+#define IP4_ALLROUTER_ADDRESS 0xE0000002u
+
+//
+// Compose the fragment field to be used in the IP4 header.
+//
+#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
+ ((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 0x1fff)))
+
+#define IP4_LAST_FRAGMENT(FragmentField) \
+ (((FragmentField) & IP4_HEAD_MF_MASK) == 0)
+
+#define IP4_FIRST_FRAGMENT(FragmentField) \
+ ((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))
+
+#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
+
+//
+// Conver the Microsecond to second. IP transmit/receive time is
+// in the unit of microsecond. IP ticks once per second.
+//
+#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
+
+INTN
+Ip4GetNetCast (
+ IN IP4_ADDR IpAddr,
+ IN IP4_INTERFACE *IpIf
+ );
+
+INTN
+Ip4GetHostCast (
+ IN IP4_SERVICE *IpSb,
+ IN IP4_ADDR Dst,
+ IN IP4_ADDR Src
+ );
+
+IP4_INTERFACE *
+Ip4FindInterface (
+ IN IP4_SERVICE *IpService,
+ IN IP4_ADDR Addr
+ );
+
+IP4_INTERFACE *
+Ip4FindNet (
+ IN IP4_SERVICE *IpService,
+ IN IP4_ADDR Addr
+ );
+
+IP4_INTERFACE *
+Ip4FindStationAddress (
+ IN IP4_SERVICE *IpSb,
+ IN IP4_ADDR Ip,
+ IN IP4_ADDR Netmask
+ );
+
+EFI_STATUS
+Ip4GetMulticastMac (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
+ IN IP4_ADDR Multicast,
+ OUT EFI_MAC_ADDRESS *Mac
+ );
+
+IP4_HEAD *
+Ip4NtohHead (
+ IN IP4_HEAD *Head
+ );
+
+EFI_STATUS
+Ip4SetVariableData (
+ IN IP4_SERVICE *IpSb
+ );
+
+VOID
+Ip4ClearVariableData (
+ IN IP4_SERVICE *IpSb
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index f8d4b39276..0d308c0521 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -56,14 +56,13 @@ Returns:
--*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gIp4DriverBinding,
ImageHandle,
&gIp4ComponentName,
- NULL,
- NULL
+ &gIp4ComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.h
index 5421c90c3b..6ff56f0e94 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.h
@@ -1,84 +1,85 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Driver.h
-
-Abstract:
-
-
-**/
-
-#ifndef __EFI_IP4_DRIVER_H__
-#define __EFI_IP4_DRIVER_H__
-
-#include <Protocol/ServiceBinding.h>
-
-extern EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName;
-
-//
-// Function prototype for the driver's entry point
-//
-EFI_STATUS
-EFIAPI
-Ip4DriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-//
-// Function prototypes for the Drivr Binding Protocol
-//
-EFI_STATUS
-EFIAPI
-Ip4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Ip4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Ip4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// Function ptototypes for the ServiceBinding Prococol
-//
-EFI_STATUS
-EFIAPI
-Ip4ServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-Ip4ServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Driver.h
+
+Abstract:
+
+
+**/
+
+#ifndef __EFI_IP4_DRIVER_H__
+#define __EFI_IP4_DRIVER_H__
+
+#include <Protocol/ServiceBinding.h>
+
+extern EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2;
+
+//
+// Function prototype for the driver's entry point
+//
+EFI_STATUS
+EFIAPI
+Ip4DriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+//
+// Function prototypes for the Drivr Binding Protocol
+//
+EFI_STATUS
+EFIAPI
+Ip4DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Ip4DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Ip4DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+//
+// Function ptototypes for the ServiceBinding Prococol
+//
+EFI_STATUS
+EFIAPI
+Ip4ServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+Ip4ServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
index 366b02c176..7999b2e306 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
@@ -1,99 +1,99 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Icmp.h
-
-Abstract:
-
- Header file for ICMP protocol.
-
-
-**/
-
-#ifndef __EFI_IP4_ICMP_H__
-#define __EFI_IP4_ICMP_H__
-
-enum {
- //
- // ICMP type definations
- //
- ICMP_ECHO_REPLY = 0,
- ICMP_DEST_UNREACHABLE = 3,
- ICMP_SOURCE_QUENCH = 4,
- ICMP_REDIRECT = 5,
- ICMP_ECHO_REQUEST = 8,
- ICMP_TIME_EXCEEDED = 11,
- ICMP_PARAMETER_PROBLEM = 12,
- ICMP_TIMESTAMP = 13,
- ICMP_INFO_REQUEST = 15,
- ICMP_INFO_REPLY = 16,
- ICMP_TYPE_MAX = ICMP_INFO_REPLY,
-
- ICMP_DEFAULT_CODE = 0,
-
- //
- // ICMP code definations for ICMP_DEST_UNREACHABLE
- //
- ICMP_NET_UNREACHABLE = 0,
- ICMP_HOST_UNREACHABLE = 1,
- ICMP_PROTO_UNREACHABLE = 2, // Host may generate
- ICMP_PORT_UNREACHABLE = 3, // Host may generate
- ICMP_FRAGMENT_FAILED = 4,
- ICMP_SOURCEROUTE_FAILED = 5, // Host may generate
- ICMP_NET_UNKNOWN = 6,
- ICMP_HOST_UNKNOWN = 7,
- ICMP_SOURCE_ISOLATED = 8,
- ICMP_NET_PROHIBITED = 9,
- ICMP_HOST_PROHIBITED = 10,
- ICMP_NET_UNREACHABLE_TOS = 11,
- ICMP_HOST_UNREACHABLE_TOS = 12,
-
- //
- // ICMP code definations for ICMP_TIME_EXCEEDED
- //
- ICMP_TIMEOUT_IN_TRANSIT = 0,
- ICMp_TIMEOUT_REASSEMBLE = 1, // Host may generate
-
- //
- // ICMP code definations for ICMP_TIME_EXCEEDED
- //
- ICMP_NET_REDIRECT = 0,
- ICMP_HOST_REDIRECT = 1,
- ICMP_NET_TOS_REDIRECT = 2,
- ICMP_HOST_TOS_REDIRECT = 3,
-
- //
- // ICMP message classes, each class of ICMP message shares
- // a common message format. INVALID_MESSAGE is only a flag.
- //
- ICMP_INVALID_MESSAGE = 0,
- ICMP_ERROR_MESSAGE = 1,
- ICMP_QUERY_MESSAGE = 2
-};
-
-typedef struct {
- UINT8 IcmpType;
- UINT8 IcmpClass;
-} IP4_ICMP_CLASS;
-
-extern IP4_ICMP_CLASS mIcmpClass[];
-extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];
-
-EFI_STATUS
-Ip4IcmpHandle (
- IN IP4_SERVICE *IpSb,
- IN IP4_HEAD *Header,
- IN NET_BUF *Packet
- );
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Icmp.h
+
+Abstract:
+
+ Header file for ICMP protocol.
+
+
+**/
+
+#ifndef __EFI_IP4_ICMP_H__
+#define __EFI_IP4_ICMP_H__
+
+enum {
+ //
+ // ICMP type definations
+ //
+ ICMP_ECHO_REPLY = 0,
+ ICMP_DEST_UNREACHABLE = 3,
+ ICMP_SOURCE_QUENCH = 4,
+ ICMP_REDIRECT = 5,
+ ICMP_ECHO_REQUEST = 8,
+ ICMP_TIME_EXCEEDED = 11,
+ ICMP_PARAMETER_PROBLEM = 12,
+ ICMP_TIMESTAMP = 13,
+ ICMP_INFO_REQUEST = 15,
+ ICMP_INFO_REPLY = 16,
+ ICMP_TYPE_MAX = ICMP_INFO_REPLY,
+
+ ICMP_DEFAULT_CODE = 0,
+
+ //
+ // ICMP code definations for ICMP_DEST_UNREACHABLE
+ //
+ ICMP_NET_UNREACHABLE = 0,
+ ICMP_HOST_UNREACHABLE = 1,
+ ICMP_PROTO_UNREACHABLE = 2, // Host may generate
+ ICMP_PORT_UNREACHABLE = 3, // Host may generate
+ ICMP_FRAGMENT_FAILED = 4,
+ ICMP_SOURCEROUTE_FAILED = 5, // Host may generate
+ ICMP_NET_UNKNOWN = 6,
+ ICMP_HOST_UNKNOWN = 7,
+ ICMP_SOURCE_ISOLATED = 8,
+ ICMP_NET_PROHIBITED = 9,
+ ICMP_HOST_PROHIBITED = 10,
+ ICMP_NET_UNREACHABLE_TOS = 11,
+ ICMP_HOST_UNREACHABLE_TOS = 12,
+
+ //
+ // ICMP code definations for ICMP_TIME_EXCEEDED
+ //
+ ICMP_TIMEOUT_IN_TRANSIT = 0,
+ ICMp_TIMEOUT_REASSEMBLE = 1, // Host may generate
+
+ //
+ // ICMP code definations for ICMP_TIME_EXCEEDED
+ //
+ ICMP_NET_REDIRECT = 0,
+ ICMP_HOST_REDIRECT = 1,
+ ICMP_NET_TOS_REDIRECT = 2,
+ ICMP_HOST_TOS_REDIRECT = 3,
+
+ //
+ // ICMP message classes, each class of ICMP message shares
+ // a common message format. INVALID_MESSAGE is only a flag.
+ //
+ ICMP_INVALID_MESSAGE = 0,
+ ICMP_ERROR_MESSAGE = 1,
+ ICMP_QUERY_MESSAGE = 2
+};
+
+typedef struct {
+ UINT8 IcmpType;
+ UINT8 IcmpClass;
+} IP4_ICMP_CLASS;
+
+extern IP4_ICMP_CLASS mIcmpClass[];
+extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];
+
+EFI_STATUS
+Ip4IcmpHandle (
+ IN IP4_SERVICE *IpSb,
+ IN IP4_HEAD *Header,
+ IN NET_BUF *Packet
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
index 9db1d8ac79..22db034a0a 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
@@ -1,238 +1,238 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4If.h
-
-Abstract:
-
- Definition for IP4 pesudo interface structure.
-
-
-**/
-
-#ifndef __EFI_IP4_IF_H__
-#define __EFI_IP4_IF_H__
-
-enum {
- IP4_FRAME_RX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
- IP4_FRAME_TX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
- IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
- IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
-};
-
-//
-// This prototype is used by both receive and transmission.
-// When receiving Netbuf is allocated by IP4_INTERFACE, and
-// released by IP4. Flag shows whether the frame is received
-// as link broadcast/multicast...
-//
-// When transmitting, the Netbuf is from IP4, and provided
-// to the callback as a reference. Flag isn't used.
-//
-// IpInstance can be NULL which means that it is the IP4 driver
-// itself sending the packets. IP4 driver may send packets that
-// don't belong to any instance, such as ICMP errors, ICMP echo
-// responses, or IGMP packets. IpInstance is used as a tag in
-// this module.
-//
-typedef
-VOID
-(*IP4_FRAME_CALLBACK) (
- IP4_PROTOCOL *IpInstance, OPTIONAL
- NET_BUF *Packet,
- EFI_STATUS IoStatus,
- UINT32 LinkFlag,
- VOID *Context
- );
-
-//
-// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
-// Upon completion, the Callback will be called. Only one
-// receive request is send to MNP. IpInstance is always NULL.
-// Reference MNP's spec for information.
-//
-typedef struct {
- UINT32 Signature;
- IP4_INTERFACE *Interface;
-
- IP4_PROTOCOL *IpInstance;
- IP4_FRAME_CALLBACK CallBack;
- VOID *Context;
-
- EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
-} IP4_LINK_RX_TOKEN;
-
-//
-// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
-// Upon completion, the Callback will be called.
-//
-typedef struct {
- UINT32 Signature;
- NET_LIST_ENTRY Link;
-
- IP4_INTERFACE *Interface;
-
- IP4_PROTOCOL *IpInstance;
- IP4_FRAME_CALLBACK CallBack;
- NET_BUF *Packet;
- VOID *Context;
-
- EFI_MAC_ADDRESS DstMac;
- EFI_MAC_ADDRESS SrcMac;
-
- EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
- EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;
-} IP4_LINK_TX_TOKEN;
-
-//
-// Only one ARP request is requested for all the frames in
-// a time. It is started for the first frames to the Ip. Any
-// subsequent transmission frame will be linked to Frames, and
-// be sent all at once the ARP requests succeed.
-//
-typedef struct {
- UINT32 Signature;
- NET_LIST_ENTRY Link;
-
- NET_LIST_ENTRY Frames;
- IP4_INTERFACE *Interface;
-
- //
- // ARP requesting staffs
- //
- EFI_EVENT OnResolved;
- IP4_ADDR Ip;
- EFI_MAC_ADDRESS Mac;
-} IP4_ARP_QUE;
-
-//
-// Callback to select which frame to cancel. Caller can cancel a
-// single frame, or all the frame from an IP instance.
-//
-typedef
-BOOLEAN
-(*IP4_FRAME_TO_CANCEL) (
- IP4_LINK_TX_TOKEN *Frame,
- VOID *Context
- );
-
-//
-// Each IP4 instance has its own station address. All the instances
-// with the same station address share a single interface structure.
-// Each interface has its own ARP child, and shares one MNP child.
-// Notice the special cases that DHCP can configure the interface
-// with 0.0.0.0/0.0.0.0.
-//
-struct _IP4_INTERFACE {
- UINT32 Signature;
- NET_LIST_ENTRY Link;
- INTN RefCnt;
-
- //
- // IP address and subnet mask of the interface. It also contains
- // the subnet/net broadcast address for quick access. The fileds
- // are invalid if (Configured == FALSE)
- //
- IP4_ADDR Ip;
- IP4_ADDR SubnetMask;
- IP4_ADDR SubnetBrdcast;
- IP4_ADDR NetBrdcast;
- BOOLEAN Configured;
-
- //
- // Handle used to create/destory ARP child. All the IP children
- // share one MNP which is owned by IP service binding.
- //
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
-
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
- EFI_ARP_PROTOCOL *Arp;
- EFI_HANDLE ArpHandle;
-
- //
- // Queues to keep the frames sent and waiting ARP request.
- //
- NET_LIST_ENTRY ArpQues;
- NET_LIST_ENTRY SentFrames;
- IP4_LINK_RX_TOKEN *RecvRequest;
-
- //
- // The interface's MAC and broadcast MAC address.
- //
- EFI_MAC_ADDRESS Mac;
- EFI_MAC_ADDRESS BroadcastMac;
- UINT32 HwaddrLen;
-
- //
- // All the IP instances that have the same IP/SubnetMask are linked
- // together through IpInstances. If any of the instance enables
- // promiscuous receive, PromiscRecv is true.
- //
- NET_LIST_ENTRY IpInstances;
- BOOLEAN PromiscRecv;
-};
-
-IP4_INTERFACE *
-Ip4CreateInterface (
- IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE ImageHandle
- );
-
-EFI_STATUS
-Ip4SetAddress (
- IN IP4_INTERFACE *Interface,
- IN IP4_ADDR IpAddr,
- IN IP4_ADDR SubnetMask
- );
-
-EFI_STATUS
-Ip4FreeInterface (
- IN IP4_INTERFACE *Interface,
- IN IP4_PROTOCOL *IpInstance OPTIONAL
- );
-
-EFI_STATUS
-Ip4SendFrame (
- IN IP4_INTERFACE *Interface,
- IN IP4_PROTOCOL *IpInstance, OPTIONAL
- IN NET_BUF *Packet,
- IN IP4_ADDR NextHop,
- IN IP4_FRAME_CALLBACK CallBack,
- IN VOID *Context
- );
-
-VOID
-Ip4CancelFrames (
- IN IP4_INTERFACE *Interface,
- IN EFI_STATUS IoStatus,
- IN IP4_FRAME_TO_CANCEL FrameToCancel, OPTIONAL
- IN VOID *Context
- );
-
-VOID
-Ip4CancelReceive (
- IN IP4_INTERFACE *Interface
- );
-
-EFI_STATUS
-Ip4ReceiveFrame (
- IN IP4_INTERFACE *Interface,
- IN IP4_PROTOCOL *IpInstance, OPTIONAL
- IN IP4_FRAME_CALLBACK CallBack,
- IN VOID *Context
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4If.h
+
+Abstract:
+
+ Definition for IP4 pesudo interface structure.
+
+
+**/
+
+#ifndef __EFI_IP4_IF_H__
+#define __EFI_IP4_IF_H__
+
+enum {
+ IP4_FRAME_RX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
+ IP4_FRAME_TX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
+ IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
+ IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
+};
+
+//
+// This prototype is used by both receive and transmission.
+// When receiving Netbuf is allocated by IP4_INTERFACE, and
+// released by IP4. Flag shows whether the frame is received
+// as link broadcast/multicast...
+//
+// When transmitting, the Netbuf is from IP4, and provided
+// to the callback as a reference. Flag isn't used.
+//
+// IpInstance can be NULL which means that it is the IP4 driver
+// itself sending the packets. IP4 driver may send packets that
+// don't belong to any instance, such as ICMP errors, ICMP echo
+// responses, or IGMP packets. IpInstance is used as a tag in
+// this module.
+//
+typedef
+VOID
+(*IP4_FRAME_CALLBACK) (
+ IP4_PROTOCOL *IpInstance, OPTIONAL
+ NET_BUF *Packet,
+ EFI_STATUS IoStatus,
+ UINT32 LinkFlag,
+ VOID *Context
+ );
+
+//
+// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
+// Upon completion, the Callback will be called. Only one
+// receive request is send to MNP. IpInstance is always NULL.
+// Reference MNP's spec for information.
+//
+typedef struct {
+ UINT32 Signature;
+ IP4_INTERFACE *Interface;
+
+ IP4_PROTOCOL *IpInstance;
+ IP4_FRAME_CALLBACK CallBack;
+ VOID *Context;
+
+ EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
+} IP4_LINK_RX_TOKEN;
+
+//
+// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
+// Upon completion, the Callback will be called.
+//
+typedef struct {
+ UINT32 Signature;
+ NET_LIST_ENTRY Link;
+
+ IP4_INTERFACE *Interface;
+
+ IP4_PROTOCOL *IpInstance;
+ IP4_FRAME_CALLBACK CallBack;
+ NET_BUF *Packet;
+ VOID *Context;
+
+ EFI_MAC_ADDRESS DstMac;
+ EFI_MAC_ADDRESS SrcMac;
+
+ EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
+ EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;
+} IP4_LINK_TX_TOKEN;
+
+//
+// Only one ARP request is requested for all the frames in
+// a time. It is started for the first frames to the Ip. Any
+// subsequent transmission frame will be linked to Frames, and
+// be sent all at once the ARP requests succeed.
+//
+typedef struct {
+ UINT32 Signature;
+ NET_LIST_ENTRY Link;
+
+ NET_LIST_ENTRY Frames;
+ IP4_INTERFACE *Interface;
+
+ //
+ // ARP requesting staffs
+ //
+ EFI_EVENT OnResolved;
+ IP4_ADDR Ip;
+ EFI_MAC_ADDRESS Mac;
+} IP4_ARP_QUE;
+
+//
+// Callback to select which frame to cancel. Caller can cancel a
+// single frame, or all the frame from an IP instance.
+//
+typedef
+BOOLEAN
+(*IP4_FRAME_TO_CANCEL) (
+ IP4_LINK_TX_TOKEN *Frame,
+ VOID *Context
+ );
+
+//
+// Each IP4 instance has its own station address. All the instances
+// with the same station address share a single interface structure.
+// Each interface has its own ARP child, and shares one MNP child.
+// Notice the special cases that DHCP can configure the interface
+// with 0.0.0.0/0.0.0.0.
+//
+struct _IP4_INTERFACE {
+ UINT32 Signature;
+ NET_LIST_ENTRY Link;
+ INTN RefCnt;
+
+ //
+ // IP address and subnet mask of the interface. It also contains
+ // the subnet/net broadcast address for quick access. The fileds
+ // are invalid if (Configured == FALSE)
+ //
+ IP4_ADDR Ip;
+ IP4_ADDR SubnetMask;
+ IP4_ADDR SubnetBrdcast;
+ IP4_ADDR NetBrdcast;
+ BOOLEAN Configured;
+
+ //
+ // Handle used to create/destory ARP child. All the IP children
+ // share one MNP which is owned by IP service binding.
+ //
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+
+ EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
+ EFI_ARP_PROTOCOL *Arp;
+ EFI_HANDLE ArpHandle;
+
+ //
+ // Queues to keep the frames sent and waiting ARP request.
+ //
+ NET_LIST_ENTRY ArpQues;
+ NET_LIST_ENTRY SentFrames;
+ IP4_LINK_RX_TOKEN *RecvRequest;
+
+ //
+ // The interface's MAC and broadcast MAC address.
+ //
+ EFI_MAC_ADDRESS Mac;
+ EFI_MAC_ADDRESS BroadcastMac;
+ UINT32 HwaddrLen;
+
+ //
+ // All the IP instances that have the same IP/SubnetMask are linked
+ // together through IpInstances. If any of the instance enables
+ // promiscuous receive, PromiscRecv is true.
+ //
+ NET_LIST_ENTRY IpInstances;
+ BOOLEAN PromiscRecv;
+};
+
+IP4_INTERFACE *
+Ip4CreateInterface (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
+ IN EFI_HANDLE Controller,
+ IN EFI_HANDLE ImageHandle
+ );
+
+EFI_STATUS
+Ip4SetAddress (
+ IN IP4_INTERFACE *Interface,
+ IN IP4_ADDR IpAddr,
+ IN IP4_ADDR SubnetMask
+ );
+
+EFI_STATUS
+Ip4FreeInterface (
+ IN IP4_INTERFACE *Interface,
+ IN IP4_PROTOCOL *IpInstance OPTIONAL
+ );
+
+EFI_STATUS
+Ip4SendFrame (
+ IN IP4_INTERFACE *Interface,
+ IN IP4_PROTOCOL *IpInstance, OPTIONAL
+ IN NET_BUF *Packet,
+ IN IP4_ADDR NextHop,
+ IN IP4_FRAME_CALLBACK CallBack,
+ IN VOID *Context
+ );
+
+VOID
+Ip4CancelFrames (
+ IN IP4_INTERFACE *Interface,
+ IN EFI_STATUS IoStatus,
+ IN IP4_FRAME_TO_CANCEL FrameToCancel, OPTIONAL
+ IN VOID *Context
+ );
+
+VOID
+Ip4CancelReceive (
+ IN IP4_INTERFACE *Interface
+ );
+
+EFI_STATUS
+Ip4ReceiveFrame (
+ IN IP4_INTERFACE *Interface,
+ IN IP4_PROTOCOL *IpInstance, OPTIONAL
+ IN IP4_FRAME_CALLBACK CallBack,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
index 9bda9f942b..0b61874632 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
@@ -1,120 +1,120 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Igmp.h
-
-Abstract:
-
-
-**/
-
-#ifndef __EFI_IP4_IGMP_H__
-#define __EFI_IP4_IGMP_H__
-
-#pragma pack(1)
-typedef struct {
- UINT8 Type;
- UINT8 MaxRespTime;
- UINT16 Checksum;
- IP4_ADDR Group;
-} IGMP_HEAD;
-#pragma pack()
-
-//
-// The status of multicast group. It isn't necessary to maintain
-// explicit state of host state diagram. A group with non-zero
-// DelayTime is in "delaying member" state. otherwise, it is in
-// "idle member" state.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- INTN RefCnt;
- IP4_ADDR Address;
- INTN DelayTime;
- BOOLEAN ReportByUs;
- EFI_MAC_ADDRESS Mac;
-} IGMP_GROUP;
-
-//
-// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
-// attached. The Igmpv1QuerySeen remember whether the server on this
-// connected network is v1 or v2.
-//
-typedef struct {
- INTN Igmpv1QuerySeen;
- NET_LIST_ENTRY Groups;
-} IGMP_SERVICE_DATA;
-
-enum {
- //
- // IGMP message type
- //
- IGMP_MEMBERSHIP_QUERY = 0x11,
- IGMP_V1_MEMBERSHIP_REPORT = 0x12,
- IGMP_V2_MEMBERSHIP_REPORT = 0x16,
- IGMP_LEAVE_GROUP = 0x17,
-
- IGMP_V1ROUTER_PRESENT = 400,
- IGMP_UNSOLICIATED_REPORT = 10
-};
-
-EFI_STATUS
-Ip4InitIgmp (
- IN IP4_SERVICE *IpService
- );
-
-EFI_STATUS
-Ip4JoinGroup (
- IN IP4_PROTOCOL *IpInstance,
- IN IP4_ADDR Address
- );
-
-EFI_STATUS
-Ip4LeaveGroup (
- IN IP4_PROTOCOL *IpInstance,
- IN IP4_ADDR Address
- );
-
-EFI_STATUS
-Ip4IgmpHandle (
- IN IP4_SERVICE *IpService,
- IN IP4_HEAD *Head,
- IN NET_BUF *Packet
- );
-
-VOID
-Ip4IgmpTicking (
- IN IP4_SERVICE *IpService
- );
-
-IP4_ADDR *
-Ip4CombineGroups (
- IN IP4_ADDR *SourceGroups,
- IN UINT32 Count,
- IN IP4_ADDR Addr
- );
-
-INTN
-Ip4RemoveGroupAddr (
- IN IP4_ADDR *Group,
- IN UINT32 GroupCnt,
- IN IP4_ADDR Addr
- );
-
-IGMP_GROUP *
-Ip4FindGroup (
- IN IGMP_SERVICE_DATA *IgmpCtrl,
- IN IP4_ADDR Address
- );
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Igmp.h
+
+Abstract:
+
+
+**/
+
+#ifndef __EFI_IP4_IGMP_H__
+#define __EFI_IP4_IGMP_H__
+
+#pragma pack(1)
+typedef struct {
+ UINT8 Type;
+ UINT8 MaxRespTime;
+ UINT16 Checksum;
+ IP4_ADDR Group;
+} IGMP_HEAD;
+#pragma pack()
+
+//
+// The status of multicast group. It isn't necessary to maintain
+// explicit state of host state diagram. A group with non-zero
+// DelayTime is in "delaying member" state. otherwise, it is in
+// "idle member" state.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+ INTN RefCnt;
+ IP4_ADDR Address;
+ INTN DelayTime;
+ BOOLEAN ReportByUs;
+ EFI_MAC_ADDRESS Mac;
+} IGMP_GROUP;
+
+//
+// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
+// attached. The Igmpv1QuerySeen remember whether the server on this
+// connected network is v1 or v2.
+//
+typedef struct {
+ INTN Igmpv1QuerySeen;
+ NET_LIST_ENTRY Groups;
+} IGMP_SERVICE_DATA;
+
+enum {
+ //
+ // IGMP message type
+ //
+ IGMP_MEMBERSHIP_QUERY = 0x11,
+ IGMP_V1_MEMBERSHIP_REPORT = 0x12,
+ IGMP_V2_MEMBERSHIP_REPORT = 0x16,
+ IGMP_LEAVE_GROUP = 0x17,
+
+ IGMP_V1ROUTER_PRESENT = 400,
+ IGMP_UNSOLICIATED_REPORT = 10
+};
+
+EFI_STATUS
+Ip4InitIgmp (
+ IN IP4_SERVICE *IpService
+ );
+
+EFI_STATUS
+Ip4JoinGroup (
+ IN IP4_PROTOCOL *IpInstance,
+ IN IP4_ADDR Address
+ );
+
+EFI_STATUS
+Ip4LeaveGroup (
+ IN IP4_PROTOCOL *IpInstance,
+ IN IP4_ADDR Address
+ );
+
+EFI_STATUS
+Ip4IgmpHandle (
+ IN IP4_SERVICE *IpService,
+ IN IP4_HEAD *Head,
+ IN NET_BUF *Packet
+ );
+
+VOID
+Ip4IgmpTicking (
+ IN IP4_SERVICE *IpService
+ );
+
+IP4_ADDR *
+Ip4CombineGroups (
+ IN IP4_ADDR *SourceGroups,
+ IN UINT32 Count,
+ IN IP4_ADDR Addr
+ );
+
+INTN
+Ip4RemoveGroupAddr (
+ IN IP4_ADDR *Group,
+ IN UINT32 GroupCnt,
+ IN IP4_ADDR Addr
+ );
+
+IGMP_GROUP *
+Ip4FindGroup (
+ IN IGMP_SERVICE_DATA *IgmpCtrl,
+ IN IP4_ADDR Address
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index 58bf045372..35ada7feff 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -1,28 +1,28 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Impl.h
-
-Abstract:
-
- Ip4 internal functions and type defintions.
-
-
-**/
-
-#ifndef __EFI_IP4_IMPL_H__
-#define __EFI_IP4_IMPL_H__
-
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Impl.h
+
+Abstract:
+
+ Ip4 internal functions and type defintions.
+
+
+**/
+
+#ifndef __EFI_IP4_IMPL_H__
+#define __EFI_IP4_IMPL_H__
+
#include <PiDxe.h>
#include <Protocol/IP4.h>
@@ -35,224 +35,224 @@ Abstract:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/NetLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "Ip4Common.h"
-#include "Ip4Driver.h"
-#include "Ip4If.h"
-#include "Ip4Icmp.h"
-#include "Ip4Option.h"
-#include "Ip4Igmp.h"
-#include "Ip4Route.h"
-#include "Ip4Input.h"
-#include "Ip4Output.h"
-
-enum {
- IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),
- IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),
-
- //
- // The state of IP4 protocol. It starts from UNCONFIGED. if it is
- // successfully configured, it goes to CONFIGED. if configure NULL
- // is called, it becomes UNCONFIGED again. If (partly) destoried, it
- // becomes DESTORY.
- //
- IP4_STATE_UNCONFIGED = 0,
- IP4_STATE_CONFIGED,
- IP4_STATE_DESTORY,
-
- //
- // The state of IP4 service. It starts from UNSTARTED. It transits
- // to STARTED if autoconfigure is started. If default address is
- // configured, it becomes CONFIGED. and if partly destoried, it goes
- // to DESTORY.
- //
- IP4_SERVICE_UNSTARTED = 0,
- IP4_SERVICE_STARTED,
- IP4_SERVICE_CONFIGED,
- IP4_SERVICE_DESTORY
-};
-
-//
-// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
-// The user's data is kept in the Packet. When fragment is
-// needed, each fragment of the Packet has a reference to the
-// Packet, no data is actually copied. The Packet will be
-// released when all the fragments of it have been recycled by
-// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
-// user's event signalled.
-//
-typedef struct {
- IP4_PROTOCOL *IpInstance;
- EFI_IP4_COMPLETION_TOKEN *Token;
- NET_BUF *Packet;
- BOOLEAN Sent;
- INTN Life;
-} IP4_TXTOKEN_WRAP;
-
-//
-// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
-// upper layers. The received packet is kept in the Packet.
-// The Packet itself may be constructured from some fragments.
-// All the fragments of the Packet is organized by a
-// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
-// the upper layer, the assemble entry and its associated
-// fragments will be freed at last.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- IP4_PROTOCOL *IpInstance;
- NET_BUF *Packet;
- EFI_IP4_RECEIVE_DATA RxData;
-} IP4_RXDATA_WRAP;
-
-struct _IP4_PROTOCOL {
- UINT32 Signature;
-
- EFI_IP4_PROTOCOL Ip4Proto;
- EFI_HANDLE Handle;
- INTN State;
-
- IP4_SERVICE *Service;
- NET_LIST_ENTRY Link; // Link to all the IP protocol from the service
-
- //
- // User's transmit/receive tokens, and received/deliverd packets
- //
- NET_MAP RxTokens;
- NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
- NET_LIST_ENTRY Received; // Received but not delivered packet
- NET_LIST_ENTRY Delivered; // Delivered and to be recycled packets
- EFI_LOCK RecycleLock;
-
- //
- // Instance's address and route tables. There are two route tables.
- // RouteTable is used by the IP4 driver to route packet. EfiRouteTable
- // is used to communicate the current route info to the upper layer.
- //
- IP4_INTERFACE *Interface;
- NET_LIST_ENTRY AddrLink; // Ip instances with the same IP address.
- IP4_ROUTE_TABLE *RouteTable;
-
- EFI_IP4_ROUTE_TABLE *EfiRouteTable;
- UINT32 EfiRouteCount;
-
- //
- // IGMP data for this instance
- //
- IP4_ADDR *Groups; // stored in network byte order
- UINT32 GroupCount;
-
- EFI_IP4_CONFIG_DATA ConfigData;
-
-};
-
-struct _IP4_SERVICE {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- INTN State;
- BOOLEAN InDestory;
-
- //
- // List of all the IP instances and interfaces, and default
- // interface and route table and caches.
- //
- UINTN NumChildren;
- NET_LIST_ENTRY Children;
-
- NET_LIST_ENTRY Interfaces;
-
- IP4_INTERFACE *DefaultInterface;
- IP4_ROUTE_TABLE *DefaultRouteTable;
-
- //
- // Ip reassemble utilities, and IGMP data
- //
- IP4_ASSEMBLE_TABLE Assemble;
- IGMP_SERVICE_DATA IgmpCtrl;
-
- //
- // Low level protocol used by this service instance
- //
- EFI_HANDLE Image;
- EFI_HANDLE Controller;
-
- EFI_HANDLE MnpChildHandle;
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
-
- EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
- EFI_SIMPLE_NETWORK_MODE SnpMode;
-
- EFI_EVENT Timer;
-
- //
- // Auto configure staff
- //
- EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
- EFI_EVENT DoneEvent;
- EFI_EVENT ReconfigEvent;
-
- //
- // The string representation of the current mac address of the
- // NIC this IP4_SERVICE works on.
- //
- CHAR16 *MacString;
-};
-
-#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
- CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
-
-#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
- CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
-
-#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
-
-extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
-
-EFI_STATUS
-Ip4ServiceConfigMnp (
- IN IP4_SERVICE *IpSb,
- IN BOOLEAN Force
- );
-
-VOID
-Ip4InitProtocol (
- IN IP4_SERVICE *IpSb,
- IN IP4_PROTOCOL *IpInstance
- );
-
-EFI_STATUS
-Ip4CleanProtocol (
- IN IP4_PROTOCOL *IpInstance
- );
-
-EFI_STATUS
-Ip4Cancel (
- IN IP4_PROTOCOL *IpInstance,
- IN EFI_IP4_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-Ip4Groups (
- IN IP4_PROTOCOL *IpInstance,
- IN BOOLEAN JoinFlag,
- IN EFI_IPv4_ADDRESS *GroupAddress
- );
-
-VOID
-EFIAPI
-Ip4TimerTicking (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-Ip4SentPacketTicking (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Context
- );
-#endif
+#include <Library/UefiLib.h>
+#include <Library/NetLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+#include "Ip4Common.h"
+#include "Ip4Driver.h"
+#include "Ip4If.h"
+#include "Ip4Icmp.h"
+#include "Ip4Option.h"
+#include "Ip4Igmp.h"
+#include "Ip4Route.h"
+#include "Ip4Input.h"
+#include "Ip4Output.h"
+
+enum {
+ IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),
+ IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),
+
+ //
+ // The state of IP4 protocol. It starts from UNCONFIGED. if it is
+ // successfully configured, it goes to CONFIGED. if configure NULL
+ // is called, it becomes UNCONFIGED again. If (partly) destoried, it
+ // becomes DESTORY.
+ //
+ IP4_STATE_UNCONFIGED = 0,
+ IP4_STATE_CONFIGED,
+ IP4_STATE_DESTORY,
+
+ //
+ // The state of IP4 service. It starts from UNSTARTED. It transits
+ // to STARTED if autoconfigure is started. If default address is
+ // configured, it becomes CONFIGED. and if partly destoried, it goes
+ // to DESTORY.
+ //
+ IP4_SERVICE_UNSTARTED = 0,
+ IP4_SERVICE_STARTED,
+ IP4_SERVICE_CONFIGED,
+ IP4_SERVICE_DESTORY
+};
+
+//
+// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
+// The user's data is kept in the Packet. When fragment is
+// needed, each fragment of the Packet has a reference to the
+// Packet, no data is actually copied. The Packet will be
+// released when all the fragments of it have been recycled by
+// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
+// user's event signalled.
+//
+typedef struct {
+ IP4_PROTOCOL *IpInstance;
+ EFI_IP4_COMPLETION_TOKEN *Token;
+ NET_BUF *Packet;
+ BOOLEAN Sent;
+ INTN Life;
+} IP4_TXTOKEN_WRAP;
+
+//
+// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
+// upper layers. The received packet is kept in the Packet.
+// The Packet itself may be constructured from some fragments.
+// All the fragments of the Packet is organized by a
+// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
+// the upper layer, the assemble entry and its associated
+// fragments will be freed at last.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+ IP4_PROTOCOL *IpInstance;
+ NET_BUF *Packet;
+ EFI_IP4_RECEIVE_DATA RxData;
+} IP4_RXDATA_WRAP;
+
+struct _IP4_PROTOCOL {
+ UINT32 Signature;
+
+ EFI_IP4_PROTOCOL Ip4Proto;
+ EFI_HANDLE Handle;
+ INTN State;
+
+ IP4_SERVICE *Service;
+ NET_LIST_ENTRY Link; // Link to all the IP protocol from the service
+
+ //
+ // User's transmit/receive tokens, and received/deliverd packets
+ //
+ NET_MAP RxTokens;
+ NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
+ NET_LIST_ENTRY Received; // Received but not delivered packet
+ NET_LIST_ENTRY Delivered; // Delivered and to be recycled packets
+ EFI_LOCK RecycleLock;
+
+ //
+ // Instance's address and route tables. There are two route tables.
+ // RouteTable is used by the IP4 driver to route packet. EfiRouteTable
+ // is used to communicate the current route info to the upper layer.
+ //
+ IP4_INTERFACE *Interface;
+ NET_LIST_ENTRY AddrLink; // Ip instances with the same IP address.
+ IP4_ROUTE_TABLE *RouteTable;
+
+ EFI_IP4_ROUTE_TABLE *EfiRouteTable;
+ UINT32 EfiRouteCount;
+
+ //
+ // IGMP data for this instance
+ //
+ IP4_ADDR *Groups; // stored in network byte order
+ UINT32 GroupCount;
+
+ EFI_IP4_CONFIG_DATA ConfigData;
+
+};
+
+struct _IP4_SERVICE {
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ INTN State;
+ BOOLEAN InDestory;
+
+ //
+ // List of all the IP instances and interfaces, and default
+ // interface and route table and caches.
+ //
+ UINTN NumChildren;
+ NET_LIST_ENTRY Children;
+
+ NET_LIST_ENTRY Interfaces;
+
+ IP4_INTERFACE *DefaultInterface;
+ IP4_ROUTE_TABLE *DefaultRouteTable;
+
+ //
+ // Ip reassemble utilities, and IGMP data
+ //
+ IP4_ASSEMBLE_TABLE Assemble;
+ IGMP_SERVICE_DATA IgmpCtrl;
+
+ //
+ // Low level protocol used by this service instance
+ //
+ EFI_HANDLE Image;
+ EFI_HANDLE Controller;
+
+ EFI_HANDLE MnpChildHandle;
+ EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
+
+ EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
+ EFI_SIMPLE_NETWORK_MODE SnpMode;
+
+ EFI_EVENT Timer;
+
+ //
+ // Auto configure staff
+ //
+ EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
+ EFI_EVENT DoneEvent;
+ EFI_EVENT ReconfigEvent;
+
+ //
+ // The string representation of the current mac address of the
+ // NIC this IP4_SERVICE works on.
+ //
+ CHAR16 *MacString;
+};
+
+#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
+ CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
+
+#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
+ CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
+
+#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
+
+extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
+
+EFI_STATUS
+Ip4ServiceConfigMnp (
+ IN IP4_SERVICE *IpSb,
+ IN BOOLEAN Force
+ );
+
+VOID
+Ip4InitProtocol (
+ IN IP4_SERVICE *IpSb,
+ IN IP4_PROTOCOL *IpInstance
+ );
+
+EFI_STATUS
+Ip4CleanProtocol (
+ IN IP4_PROTOCOL *IpInstance
+ );
+
+EFI_STATUS
+Ip4Cancel (
+ IN IP4_PROTOCOL *IpInstance,
+ IN EFI_IP4_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+Ip4Groups (
+ IN IP4_PROTOCOL *IpInstance,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv4_ADDRESS *GroupAddress
+ );
+
+VOID
+EFIAPI
+Ip4TimerTicking (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+Ip4SentPacketTicking (
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Context
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
index 2acf769968..af8ed1adf3 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
@@ -1,138 +1,138 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Input.h
-
-Abstract:
-
-
-**/
-
-#ifndef __EFI_IP4_INPUT_H__
-#define __EFI_IP4_INPUT_H__
-
-enum {
- IP4_MIN_HEADLEN = 20,
- IP4_MAX_HEADLEN = 60,
-
- IP4_ASSEMLE_HASH_SIZE = 31,
- IP4_FRAGMENT_LIFE = 120,
- IP4_MAX_PACKET_SIZE = 65535
-};
-
-//
-// Per packet information for input process. LinkFlag specifies whether
-// the packet is received as Link layer unicast, multicast or broadcast.
-// The CastType is the IP layer cast type, such as IP multicast or unicast.
-// Start, End and Length are staffs used to assemble the packets. Start
-// is the sequence number of the first byte of data in the packet. Length
-// is the number of bytes of data. End = Start + Length, that is, the
-// sequence number of last byte + 1. Each assembled packet has a count down
-// life. If it isn't consumed before Life reaches zero, the packet is released.
-//
-typedef struct {
- UINTN LinkFlag;
- INTN CastType;
- INTN Start;
- INTN End;
- INTN Length;
- UINT32 Life;
- EFI_STATUS Status;
-} IP4_CLIP_INFO;
-
-//
-// Structure used to assemble IP packets.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
-
- //
- // Identity of one IP4 packet. Each fragment of a packet has
- // the same (Dst, Src, Id, Protocol).
- //
- IP4_ADDR Dst;
- IP4_ADDR Src;
- UINT16 Id;
- UINT8 Protocol;
-
- INTN TotalLen;
- INTN CurLen;
- NET_LIST_ENTRY Fragments; // List of all the fragments of this packet
-
- IP4_HEAD *Head; // IP head of the first fragment
- IP4_CLIP_INFO *Info; // Per packet info of the first fragment
- INTN Life; // Count down life for the packet.
-} IP4_ASSEMBLE_ENTRY;
-
-//
-// Each Ip service instance has an assemble table to reassemble
-// the packets before delivery to its children. It is organized
-// as hash table.
-//
-typedef struct {
- NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
-} IP4_ASSEMBLE_TABLE;
-
-#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
-
-#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \
- (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
-
-#define IP4_RXDATA_WRAP_SIZE(NumFrag) \
- (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
-
-VOID
-Ip4InitAssembleTable (
- IN IP4_ASSEMBLE_TABLE *Table
- );
-
-VOID
-Ip4CleanAssembleTable (
- IN IP4_ASSEMBLE_TABLE *Table
- );
-
-VOID
-Ip4AccpetFrame (
- IN IP4_PROTOCOL *Ip4Instance,
- IN NET_BUF *Packet,
- IN EFI_STATUS IoStatus,
- IN UINT32 Flag,
- IN VOID *Context
- );
-
-EFI_STATUS
-Ip4Demultiplex (
- IN IP4_SERVICE *SbInstance,
- IN IP4_HEAD *Head,
- IN NET_BUF *Packet
- );
-
-INTN
-Ip4InterfaceEnquePacket (
- IN IP4_SERVICE *SbInstance,
- IN IP4_HEAD *Head,
- IN NET_BUF *Packet,
- IN IP4_INTERFACE *Interface
- );
-
-EFI_STATUS
-Ip4InstanceDeliverPacket (
- IN IP4_PROTOCOL *Ip4Instance
- );
-
-VOID
-Ip4PacketTimerTicking (
- IN IP4_SERVICE *IpSb
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Input.h
+
+Abstract:
+
+
+**/
+
+#ifndef __EFI_IP4_INPUT_H__
+#define __EFI_IP4_INPUT_H__
+
+enum {
+ IP4_MIN_HEADLEN = 20,
+ IP4_MAX_HEADLEN = 60,
+
+ IP4_ASSEMLE_HASH_SIZE = 31,
+ IP4_FRAGMENT_LIFE = 120,
+ IP4_MAX_PACKET_SIZE = 65535
+};
+
+//
+// Per packet information for input process. LinkFlag specifies whether
+// the packet is received as Link layer unicast, multicast or broadcast.
+// The CastType is the IP layer cast type, such as IP multicast or unicast.
+// Start, End and Length are staffs used to assemble the packets. Start
+// is the sequence number of the first byte of data in the packet. Length
+// is the number of bytes of data. End = Start + Length, that is, the
+// sequence number of last byte + 1. Each assembled packet has a count down
+// life. If it isn't consumed before Life reaches zero, the packet is released.
+//
+typedef struct {
+ UINTN LinkFlag;
+ INTN CastType;
+ INTN Start;
+ INTN End;
+ INTN Length;
+ UINT32 Life;
+ EFI_STATUS Status;
+} IP4_CLIP_INFO;
+
+//
+// Structure used to assemble IP packets.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+
+ //
+ // Identity of one IP4 packet. Each fragment of a packet has
+ // the same (Dst, Src, Id, Protocol).
+ //
+ IP4_ADDR Dst;
+ IP4_ADDR Src;
+ UINT16 Id;
+ UINT8 Protocol;
+
+ INTN TotalLen;
+ INTN CurLen;
+ NET_LIST_ENTRY Fragments; // List of all the fragments of this packet
+
+ IP4_HEAD *Head; // IP head of the first fragment
+ IP4_CLIP_INFO *Info; // Per packet info of the first fragment
+ INTN Life; // Count down life for the packet.
+} IP4_ASSEMBLE_ENTRY;
+
+//
+// Each Ip service instance has an assemble table to reassemble
+// the packets before delivery to its children. It is organized
+// as hash table.
+//
+typedef struct {
+ NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
+} IP4_ASSEMBLE_TABLE;
+
+#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
+
+#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \
+ (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
+
+#define IP4_RXDATA_WRAP_SIZE(NumFrag) \
+ (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
+
+VOID
+Ip4InitAssembleTable (
+ IN IP4_ASSEMBLE_TABLE *Table
+ );
+
+VOID
+Ip4CleanAssembleTable (
+ IN IP4_ASSEMBLE_TABLE *Table
+ );
+
+VOID
+Ip4AccpetFrame (
+ IN IP4_PROTOCOL *Ip4Instance,
+ IN NET_BUF *Packet,
+ IN EFI_STATUS IoStatus,
+ IN UINT32 Flag,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+Ip4Demultiplex (
+ IN IP4_SERVICE *SbInstance,
+ IN IP4_HEAD *Head,
+ IN NET_BUF *Packet
+ );
+
+INTN
+Ip4InterfaceEnquePacket (
+ IN IP4_SERVICE *SbInstance,
+ IN IP4_HEAD *Head,
+ IN NET_BUF *Packet,
+ IN IP4_INTERFACE *Interface
+ );
+
+EFI_STATUS
+Ip4InstanceDeliverPacket (
+ IN IP4_PROTOCOL *Ip4Instance
+ );
+
+VOID
+Ip4PacketTimerTicking (
+ IN IP4_SERVICE *IpSb
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
index 665b55b06a..830962ee24 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
@@ -1,52 +1,52 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Option.h
-
-Abstract:
-
- IP4 option support routines.
-
-
-**/
-
-#ifndef __EFI_IP4_OPTION_H__
-#define __EFI_IP4_OPTION_H__
-
-enum {
- IP4_OPTION_EOP = 0,
- IP4_OPTION_NOP = 1,
- IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
- IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
- IP4_OPTION_RR = 7, // Record routing, 00000111
-
- IP4_OPTION_COPY_MASK = 0x80
-};
-
-BOOLEAN
-Ip4OptionIsValid (
- IN UINT8 *Option,
- IN UINT32 OptLen,
- IN BOOLEAN Rcvd
- );
-
-EFI_STATUS
-Ip4CopyOption (
- IN UINT8 *Option,
- IN UINT32 OptLen,
- IN BOOLEAN Fragment,
- IN UINT8 *Buf, OPTIONAL
- IN OUT UINT32 *BufLen
- );
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Option.h
+
+Abstract:
+
+ IP4 option support routines.
+
+
+**/
+
+#ifndef __EFI_IP4_OPTION_H__
+#define __EFI_IP4_OPTION_H__
+
+enum {
+ IP4_OPTION_EOP = 0,
+ IP4_OPTION_NOP = 1,
+ IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
+ IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
+ IP4_OPTION_RR = 7, // Record routing, 00000111
+
+ IP4_OPTION_COPY_MASK = 0x80
+};
+
+BOOLEAN
+Ip4OptionIsValid (
+ IN UINT8 *Option,
+ IN UINT32 OptLen,
+ IN BOOLEAN Rcvd
+ );
+
+EFI_STATUS
+Ip4CopyOption (
+ IN UINT8 *Option,
+ IN UINT32 OptLen,
+ IN BOOLEAN Fragment,
+ IN UINT8 *Buf, OPTIONAL
+ IN OUT UINT32 *BufLen
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.h
index e165e1d715..991f10cbc0 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.h
@@ -1,54 +1,54 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Output.h
-
-Abstract:
-
-
-**/
-
-#ifndef __EFI_IP4_OUTPUT_H__
-#define __EFI_IP4_OUTPUT_H__
-
-VOID
-Ip4SysPacketSent (
- IP4_PROTOCOL *Ip4Instance,
- NET_BUF *Packet,
- EFI_STATUS IoStatus,
- UINT32 Flag,
- VOID *Context
- );
-
-EFI_STATUS
-Ip4Output (
- IN IP4_SERVICE *IpSb,
- IN IP4_PROTOCOL *IpInstance, OPTIONAL
- IN NET_BUF *Data,
- IN IP4_HEAD *Head,
- IN UINT8 *Option,
- IN UINT32 OptLen,
- IN IP4_ADDR GateWay,
- IN IP4_FRAME_CALLBACK Callback,
- IN VOID *Context
- );
-
-VOID
-Ip4CancelPacket (
- IN IP4_INTERFACE *IpIf,
- IN NET_BUF *Packet,
- IN EFI_STATUS IoStatus
- );
-
-extern UINT16 mIp4Id;
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Output.h
+
+Abstract:
+
+
+**/
+
+#ifndef __EFI_IP4_OUTPUT_H__
+#define __EFI_IP4_OUTPUT_H__
+
+VOID
+Ip4SysPacketSent (
+ IP4_PROTOCOL *Ip4Instance,
+ NET_BUF *Packet,
+ EFI_STATUS IoStatus,
+ UINT32 Flag,
+ VOID *Context
+ );
+
+EFI_STATUS
+Ip4Output (
+ IN IP4_SERVICE *IpSb,
+ IN IP4_PROTOCOL *IpInstance, OPTIONAL
+ IN NET_BUF *Data,
+ IN IP4_HEAD *Head,
+ IN UINT8 *Option,
+ IN UINT32 OptLen,
+ IN IP4_ADDR GateWay,
+ IN IP4_FRAME_CALLBACK Callback,
+ IN VOID *Context
+ );
+
+VOID
+Ip4CancelPacket (
+ IN IP4_INTERFACE *IpIf,
+ IN NET_BUF *Packet,
+ IN EFI_STATUS IoStatus
+ );
+
+extern UINT16 mIp4Id;
+#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
index 3dce5d2f3a..fdf40ca5bf 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
@@ -1,151 +1,151 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Ip4Route.h
-
-Abstract:
-
- EFI IP4 route table and route cache table defintions.
-
-
-**/
-
-#ifndef __EFI_IP4_ROUTE_H__
-#define __EFI_IP4_ROUTE_H__
-
-#include "IP4Common.h"
-
-enum {
- IP4_DIRECT_ROUTE = 0x00000001,
-
- IP4_ROUTE_CACHE_HASH = 31,
- IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
-};
-
-#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
-
-//
-// The route entry in the route table. Dest/Netmask is the destion
-// network. The nexthop is the gateway to send the packet to in
-// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
-// on, the gateway is the destination of the IP packet itself. Route
-// enties of the connected network have the flag on.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- INTN RefCnt;
- IP4_ADDR Dest;
- IP4_ADDR Netmask;
- IP4_ADDR NextHop;
- UINT32 Flag;
-} IP4_ROUTE_ENTRY;
-
-//
-// The route cache entry. The route cache entry is optional.
-// But it is necessary to support the ICMP redirect message.
-// Check Ip4ProcessIcmpRedirect for information.
-//
-// The cache entry field Tag is used to tag all the route
-// cache entry spawned from a route table entry. This makes
-// it simple to delete all the route cache entries from a
-// to-be-deleted route entry.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- INTN RefCnt;
- IP4_ADDR Dest;
- IP4_ADDR Src;
- IP4_ADDR NextHop;
- UINTN Tag;
-} IP4_ROUTE_CACHE_ENTRY;
-
-//
-// The route cache table is organized as a hash table. Each
-// IP4 route table has a embedded route cache. For now the
-// route cache and route table are binded togehter. But keep
-// the route cache a seperated structure in case we want to
-// detach them later.
-//
-typedef struct {
- NET_LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
-} IP4_ROUTE_CACHE;
-
-//
-// Each IP4 instance has its own route table. Each ServiceBinding
-// instance has a default route table and default address.
-//
-// All the route table entries with the same mask are linked
-// together in one route area. For example, RouteArea[0] contains
-// the default routes. A route table also contains a route cache.
-//
-typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
-
-struct _IP4_ROUTE_TABLE {
- INTN RefCnt;
- UINT32 TotalNum;
- NET_LIST_ENTRY RouteArea[IP4_MASK_NUM];
- IP4_ROUTE_TABLE *Next;
- IP4_ROUTE_CACHE Cache;
-};
-
-IP4_ROUTE_TABLE*
-Ip4CreateRouteTable (
- VOID
- );
-
-VOID
-Ip4FreeRouteTable (
- IN IP4_ROUTE_TABLE *RouteTable
- );
-
-EFI_STATUS
-Ip4AddRoute (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Netmask,
- IN IP4_ADDR Gateway
- );
-
-EFI_STATUS
-Ip4DelRoute (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Netmask,
- IN IP4_ADDR Gateway
- );
-
-IP4_ROUTE_CACHE_ENTRY *
-Ip4FindRouteCache (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Src
- );
-
-VOID
-Ip4FreeRouteCacheEntry (
- IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry
- );
-
-IP4_ROUTE_CACHE_ENTRY *
-Ip4Route (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Src
- );
-
-EFI_STATUS
-Ip4BuildEfiRouteTable (
- IN IP4_PROTOCOL *IpInstance
- );
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Ip4Route.h
+
+Abstract:
+
+ EFI IP4 route table and route cache table defintions.
+
+
+**/
+
+#ifndef __EFI_IP4_ROUTE_H__
+#define __EFI_IP4_ROUTE_H__
+
+#include "IP4Common.h"
+
+enum {
+ IP4_DIRECT_ROUTE = 0x00000001,
+
+ IP4_ROUTE_CACHE_HASH = 31,
+ IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
+};
+
+#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
+
+//
+// The route entry in the route table. Dest/Netmask is the destion
+// network. The nexthop is the gateway to send the packet to in
+// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
+// on, the gateway is the destination of the IP packet itself. Route
+// enties of the connected network have the flag on.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+ INTN RefCnt;
+ IP4_ADDR Dest;
+ IP4_ADDR Netmask;
+ IP4_ADDR NextHop;
+ UINT32 Flag;
+} IP4_ROUTE_ENTRY;
+
+//
+// The route cache entry. The route cache entry is optional.
+// But it is necessary to support the ICMP redirect message.
+// Check Ip4ProcessIcmpRedirect for information.
+//
+// The cache entry field Tag is used to tag all the route
+// cache entry spawned from a route table entry. This makes
+// it simple to delete all the route cache entries from a
+// to-be-deleted route entry.
+//
+typedef struct {
+ NET_LIST_ENTRY Link;
+ INTN RefCnt;
+ IP4_ADDR Dest;
+ IP4_ADDR Src;
+ IP4_ADDR NextHop;
+ UINTN Tag;
+} IP4_ROUTE_CACHE_ENTRY;
+
+//
+// The route cache table is organized as a hash table. Each
+// IP4 route table has a embedded route cache. For now the
+// route cache and route table are binded togehter. But keep
+// the route cache a seperated structure in case we want to
+// detach them later.
+//
+typedef struct {
+ NET_LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
+} IP4_ROUTE_CACHE;
+
+//
+// Each IP4 instance has its own route table. Each ServiceBinding
+// instance has a default route table and default address.
+//
+// All the route table entries with the same mask are linked
+// together in one route area. For example, RouteArea[0] contains
+// the default routes. A route table also contains a route cache.
+//
+typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
+
+struct _IP4_ROUTE_TABLE {
+ INTN RefCnt;
+ UINT32 TotalNum;
+ NET_LIST_ENTRY RouteArea[IP4_MASK_NUM];
+ IP4_ROUTE_TABLE *Next;
+ IP4_ROUTE_CACHE Cache;
+};
+
+IP4_ROUTE_TABLE*
+Ip4CreateRouteTable (
+ VOID
+ );
+
+VOID
+Ip4FreeRouteTable (
+ IN IP4_ROUTE_TABLE *RouteTable
+ );
+
+EFI_STATUS
+Ip4AddRoute (
+ IN IP4_ROUTE_TABLE *RtTable,
+ IN IP4_ADDR Dest,
+ IN IP4_ADDR Netmask,
+ IN IP4_ADDR Gateway
+ );
+
+EFI_STATUS
+Ip4DelRoute (
+ IN IP4_ROUTE_TABLE *RtTable,
+ IN IP4_ADDR Dest,
+ IN IP4_ADDR Netmask,
+ IN IP4_ADDR Gateway
+ );
+
+IP4_ROUTE_CACHE_ENTRY *
+Ip4FindRouteCache (
+ IN IP4_ROUTE_TABLE *RtTable,
+ IN IP4_ADDR Dest,
+ IN IP4_ADDR Src
+ );
+
+VOID
+Ip4FreeRouteCacheEntry (
+ IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry
+ );
+
+IP4_ROUTE_CACHE_ENTRY *
+Ip4Route (
+ IN IP4_ROUTE_TABLE *RtTable,
+ IN IP4_ADDR Dest,
+ IN IP4_ADDR Src
+ );
+
+EFI_STATUS
+Ip4BuildEfiRouteTable (
+ IN IP4_PROTOCOL *IpInstance
+ );
+#endif
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c b/MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c
index 209861c775..b2af53cea7 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c
@@ -24,6 +24,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
MnpComponentNameGetDriverName (
@@ -32,6 +71,75 @@ MnpComponentNameGetDriverName (
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
MnpComponentNameGetControllerName (
@@ -42,18 +150,29 @@ MnpComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {
MnpComponentNameGetDriverName,
MnpComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) MnpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) MnpComponentNameGetControllerName,
+ "en"
+ };
+
STATIC EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"MNP Network Service Driver"
},
{
@@ -62,6 +181,45 @@ STATIC EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {
}
};
+/**
+ 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
MnpComponentNameGetDriverName (
@@ -69,41 +227,84 @@ MnpComponentNameGetDriverName (
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,
- gMnpComponentName.SupportedLanguages,
- mMnpDriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mMnpDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gMnpComponentName)
+ );
}
+/**
+ 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
MnpComponentNameGetControllerName (
@@ -113,50 +314,6 @@ MnpComponentNameGetControllerName (
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/MnpDxe/MnpDebug.h b/MdeModulePkg/Universal/Network/MnpDxe/MnpDebug.h
index 72eb59b9b4..063c05b74c 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpDebug.h
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpDebug.h
@@ -1,28 +1,28 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- MnpDebug.h
-
-Abstract:
-
-
-**/
-
-#ifndef _MNP_DEBUG_H_
-#define _MNP_DEBUG_H_
-
-#define MNP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Mnp", PrintArg)
-#define MNP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Mnp", PrintArg)
-#define MNP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Mnp", PrintArg)
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ MnpDebug.h
+
+Abstract:
+
+
+**/
+
+#ifndef _MNP_DEBUG_H_
+#define _MNP_DEBUG_H_
+
+#define MNP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Mnp", PrintArg)
+#define MNP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Mnp", PrintArg)
+#define MNP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Mnp", PrintArg)
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c
index 7303f6b40e..814566ec56 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c
@@ -547,13 +547,12 @@ Returns:
--*/
{
- return EfiLibInstallAllDriverProtocols (
+ return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gMnpDriverBinding,
ImageHandle,
&gMnpComponentName,
- NULL,
- NULL
+ &gMnpComponentName2
);
}
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h
index a387eb05d0..732c56b299 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h
@@ -1,137 +1,138 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- MnpDriver.h
-
-Abstract:
-
-
-**/
-
-#ifndef _MNP_DRIVER_H_
-#define _MNP_DRIVER_H_
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ MnpDriver.h
+
+Abstract:
+
+
+**/
+
+#ifndef _MNP_DRIVER_H_
+#define _MNP_DRIVER_H_
#include <PiDxe.h>
#include <Protocol/ManagedNetwork.h>
-#include <Protocol/SimpleNetwork.h>
+#include <Protocol/SimpleNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/NetLib.h>
+#include <Library/UefiLib.h>
+#include <Library/NetLib.h>
#include <Library/BaseLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-
-#include "MnpDebug.h"
-
-//
-// Required Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;
-
-#define MNP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'S')
-
-typedef struct _MNP_SERVICE_DATA {
- UINT32 Signature;
-
- EFI_HANDLE ControllerHandle;
-
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
-
- UINT32 Mtu;
-
- NET_LIST_ENTRY ChildrenList;
- UINTN ChildrenNumber;
- UINTN ConfiguredChildrenNumber;
-
- NET_LIST_ENTRY GroupAddressList;
- UINT32 GroupAddressCount;
-
- EFI_EVENT TxTimeoutEvent;
-
- NET_BUF_QUEUE FreeNbufQue;
- INTN NbufCnt;
-
- EFI_EVENT PollTimer;
- BOOLEAN EnableSystemPoll;
-
- EFI_EVENT TimeoutCheckTimer;
-
- UINT32 UnicastCount;
- UINT32 BroadcastCount;
- UINT32 MulticastCount;
- UINT32 PromiscuousCount;
-
- //
- // The size of the data buffer in the MNP_PACKET_BUFFER used to
- // store a packet.
- //
- UINT32 BufferLength;
- UINT32 PaddingSize;
- NET_BUF *RxNbufCache;
- UINT8 *TxBuf;
-} MNP_SERVICE_DATA;
-
-#define MNP_SERVICE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- MNP_SERVICE_DATA, \
- ServiceBinding, \
- MNP_SERVICE_DATA_SIGNATURE \
- )
-
-EFI_STATUS
-EFIAPI
-MnpDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-MnpServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-MnpServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-
-#endif
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+
+#include "MnpDebug.h"
+
+//
+// Required Global Variables
+//
+extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2;
+
+#define MNP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'S')
+
+typedef struct _MNP_SERVICE_DATA {
+ UINT32 Signature;
+
+ EFI_HANDLE ControllerHandle;
+
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
+
+ UINT32 Mtu;
+
+ NET_LIST_ENTRY ChildrenList;
+ UINTN ChildrenNumber;
+ UINTN ConfiguredChildrenNumber;
+
+ NET_LIST_ENTRY GroupAddressList;
+ UINT32 GroupAddressCount;
+
+ EFI_EVENT TxTimeoutEvent;
+
+ NET_BUF_QUEUE FreeNbufQue;
+ INTN NbufCnt;
+
+ EFI_EVENT PollTimer;
+ BOOLEAN EnableSystemPoll;
+
+ EFI_EVENT TimeoutCheckTimer;
+
+ UINT32 UnicastCount;
+ UINT32 BroadcastCount;
+ UINT32 MulticastCount;
+ UINT32 PromiscuousCount;
+
+ //
+ // The size of the data buffer in the MNP_PACKET_BUFFER used to
+ // store a packet.
+ //
+ UINT32 BufferLength;
+ UINT32 PaddingSize;
+ NET_BUF *RxNbufCache;
+ UINT8 *TxBuf;
+} MNP_SERVICE_DATA;
+
+#define MNP_SERVICE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ MNP_SERVICE_DATA, \
+ ServiceBinding, \
+ MNP_SERVICE_DATA_SIGNATURE \
+ )
+
+EFI_STATUS
+EFIAPI
+MnpDriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpDriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpDriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+MnpServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+MnpServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h b/MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h
index cdb081d2b4..7f6669fba3 100644
--- a/MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h
+++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpImpl.h
@@ -1,274 +1,274 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- MnpImpl.h
-
-Abstract:
-
-
-**/
-
-#ifndef _MNP_IMPL_H_
-#define _MNP_IMPL_H_
-
-#include "MnpDriver.h"
-#include "MnpDebug.h"
-
-#define NET_ETHER_FCS_SIZE 4
-
-#define MNP_SYS_POLL_INTERVAL (2 * TICKS_PER_MS) // 2 milliseconds
-#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
-#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
-#define MNP_INIT_NET_BUFFER_NUM 512
-#define MNP_NET_BUFFER_INCREASEMENT 64
-#define MNP_MAX_NET_BUFFER_NUM 65536
-
-#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256
-
-#define MNP_RECEIVE_UNICAST 0x01
-#define MNP_RECEIVE_BROADCAST 0x02
-
-#define UNICAST_PACKET MNP_RECEIVE_UNICAST
-#define BROADCAST_PACKET MNP_RECEIVE_BROADCAST
-
-#define MNP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'I')
-
-#define MNP_INSTANCE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- MNP_INSTANCE_DATA, \
- ManagedNetwork, \
- MNP_INSTANCE_DATA_SIGNATURE \
- )
-
-typedef struct _MNP_INSTANCE_DATA {
- UINT32 Signature;
-
- MNP_SERVICE_DATA *MnpServiceData;
-
- EFI_HANDLE Handle;
-
- NET_LIST_ENTRY InstEntry;
-
- EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;
-
- BOOLEAN Configured;
- BOOLEAN Destroyed;
-
- NET_LIST_ENTRY GroupCtrlBlkList;
-
- NET_MAP RxTokenMap;
-
- NET_LIST_ENTRY RxDeliveredPacketQueue;
- NET_LIST_ENTRY RcvdPacketQueue;
- UINTN RcvdPacketQueueSize;
-
- EFI_MANAGED_NETWORK_CONFIG_DATA ConfigData;
-
- UINT8 ReceiveFilter;
-} MNP_INSTANCE_DATA;
-
-typedef struct _MNP_GROUP_ADDRESS {
- NET_LIST_ENTRY AddrEntry;
- EFI_MAC_ADDRESS Address;
- INTN RefCnt;
-} MNP_GROUP_ADDRESS;
-
-typedef struct _MNP_GROUP_CONTROL_BLOCK {
- NET_LIST_ENTRY CtrlBlkEntry;
- MNP_GROUP_ADDRESS *GroupAddress;
-} MNP_GROUP_CONTROL_BLOCK;
-
-typedef struct _MNP_RXDATA_WRAP {
- NET_LIST_ENTRY WrapEntry;
- MNP_INSTANCE_DATA *Instance;
- EFI_MANAGED_NETWORK_RECEIVE_DATA RxData;
- NET_BUF *Nbuf;
- UINT64 TimeoutTick;
-} MNP_RXDATA_WRAP;
-
-EFI_STATUS
-MnpInitializeServiceData (
- IN MNP_SERVICE_DATA *MnpServiceData,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE ControllerHandle
- );
-
-VOID
-MnpFlushServiceData (
- MNP_SERVICE_DATA *MnpServiceData
- );
-
-VOID
-MnpInitializeInstanceData (
- IN MNP_SERVICE_DATA *MnpServiceData,
- IN MNP_INSTANCE_DATA *Instance
- );
-
-EFI_STATUS
-MnpTokenExist (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Arg
- );
-
-EFI_STATUS
-MnpCancelTokens (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Arg
- );
-
-VOID
-MnpFlushRcvdDataQueue (
- IN MNP_INSTANCE_DATA *Instance
- );
-
-EFI_STATUS
-MnpConfigureInstance (
- IN MNP_INSTANCE_DATA *Instance,
- IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
- );
-
-EFI_STATUS
-MnpGroupOp (
- IN MNP_INSTANCE_DATA *Instance,
- IN BOOLEAN JoinFlag,
- IN EFI_MAC_ADDRESS *MacAddr OPTIONAL,
- IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
- );
-
-BOOLEAN
-MnpIsValidTxToken (
- IN MNP_INSTANCE_DATA *Instance,
- IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
- );
-
-VOID
-MnpBuildTxPacket (
- IN MNP_SERVICE_DATA *MnpServiceData,
- IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
- OUT UINT8 **PktBuf,
- OUT UINT32 *PktLen
- );
-
-EFI_STATUS
-MnpSyncSendPacket (
- IN MNP_SERVICE_DATA *MnpServiceData,
- IN UINT8 *Packet,
- IN UINT32 Length,
- IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-MnpInstanceDeliverPacket (
- IN MNP_INSTANCE_DATA *Instance
- );
-
-VOID
-EFIAPI
-MnpRecycleRxData (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-MnpReceivePacket (
- IN MNP_SERVICE_DATA *MnpServiceData
- );
-
-NET_BUF *
-MnpAllocNbuf (
- IN MNP_SERVICE_DATA *MnpServiceData
- );
-
-VOID
-MnpFreeNbuf (
- IN MNP_SERVICE_DATA *MnpServiceData,
- IN NET_BUF *Nbuf
- );
-
-VOID
-EFIAPI
-MnpCheckPacketTimeout (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-EFIAPI
-MnpSystemPoll (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-EFIAPI
-MnpGetModeData (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
- OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpConfigure (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpMcastIpToMac (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN BOOLEAN Ipv6Flag,
- IN EFI_IP_ADDRESS *IpAddress,
- OUT EFI_MAC_ADDRESS *MacAddress
- );
-
-EFI_STATUS
-EFIAPI
-MnpGroups (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN BOOLEAN JoinFlag,
- IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpTransmit (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-EFIAPI
-MnpCancel (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-MnpReceive (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This,
- IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-EFIAPI
-MnpPoll (
- IN EFI_MANAGED_NETWORK_PROTOCOL *This
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ MnpImpl.h
+
+Abstract:
+
+
+**/
+
+#ifndef _MNP_IMPL_H_
+#define _MNP_IMPL_H_
+
+#include "MnpDriver.h"
+#include "MnpDebug.h"
+
+#define NET_ETHER_FCS_SIZE 4
+
+#define MNP_SYS_POLL_INTERVAL (2 * TICKS_PER_MS) // 2 milliseconds
+#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
+#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
+#define MNP_INIT_NET_BUFFER_NUM 512
+#define MNP_NET_BUFFER_INCREASEMENT 64
+#define MNP_MAX_NET_BUFFER_NUM 65536
+
+#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256
+
+#define MNP_RECEIVE_UNICAST 0x01
+#define MNP_RECEIVE_BROADCAST 0x02
+
+#define UNICAST_PACKET MNP_RECEIVE_UNICAST
+#define BROADCAST_PACKET MNP_RECEIVE_BROADCAST
+
+#define MNP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'I')
+
+#define MNP_INSTANCE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ MNP_INSTANCE_DATA, \
+ ManagedNetwork, \
+ MNP_INSTANCE_DATA_SIGNATURE \
+ )
+
+typedef struct _MNP_INSTANCE_DATA {
+ UINT32 Signature;
+
+ MNP_SERVICE_DATA *MnpServiceData;
+
+ EFI_HANDLE Handle;
+
+ NET_LIST_ENTRY InstEntry;
+
+ EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;
+
+ BOOLEAN Configured;
+ BOOLEAN Destroyed;
+
+ NET_LIST_ENTRY GroupCtrlBlkList;
+
+ NET_MAP RxTokenMap;
+
+ NET_LIST_ENTRY RxDeliveredPacketQueue;
+ NET_LIST_ENTRY RcvdPacketQueue;
+ UINTN RcvdPacketQueueSize;
+
+ EFI_MANAGED_NETWORK_CONFIG_DATA ConfigData;
+
+ UINT8 ReceiveFilter;
+} MNP_INSTANCE_DATA;
+
+typedef struct _MNP_GROUP_ADDRESS {
+ NET_LIST_ENTRY AddrEntry;
+ EFI_MAC_ADDRESS Address;
+ INTN RefCnt;
+} MNP_GROUP_ADDRESS;
+
+typedef struct _MNP_GROUP_CONTROL_BLOCK {
+ NET_LIST_ENTRY CtrlBlkEntry;
+ MNP_GROUP_ADDRESS *GroupAddress;
+} MNP_GROUP_CONTROL_BLOCK;
+
+typedef struct _MNP_RXDATA_WRAP {
+ NET_LIST_ENTRY WrapEntry;
+ MNP_INSTANCE_DATA *Instance;
+ EFI_MANAGED_NETWORK_RECEIVE_DATA RxData;
+ NET_BUF *Nbuf;
+ UINT64 TimeoutTick;
+} MNP_RXDATA_WRAP;
+
+EFI_STATUS
+MnpInitializeServiceData (
+ IN MNP_SERVICE_DATA *MnpServiceData,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_HANDLE ControllerHandle
+ );
+
+VOID
+MnpFlushServiceData (
+ MNP_SERVICE_DATA *MnpServiceData
+ );
+
+VOID
+MnpInitializeInstanceData (
+ IN MNP_SERVICE_DATA *MnpServiceData,
+ IN MNP_INSTANCE_DATA *Instance
+ );
+
+EFI_STATUS
+MnpTokenExist (
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Arg
+ );
+
+EFI_STATUS
+MnpCancelTokens (
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Arg
+ );
+
+VOID
+MnpFlushRcvdDataQueue (
+ IN MNP_INSTANCE_DATA *Instance
+ );
+
+EFI_STATUS
+MnpConfigureInstance (
+ IN MNP_INSTANCE_DATA *Instance,
+ IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
+ );
+
+EFI_STATUS
+MnpGroupOp (
+ IN MNP_INSTANCE_DATA *Instance,
+ IN BOOLEAN JoinFlag,
+ IN EFI_MAC_ADDRESS *MacAddr OPTIONAL,
+ IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
+ );
+
+BOOLEAN
+MnpIsValidTxToken (
+ IN MNP_INSTANCE_DATA *Instance,
+ IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
+ );
+
+VOID
+MnpBuildTxPacket (
+ IN MNP_SERVICE_DATA *MnpServiceData,
+ IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
+ OUT UINT8 **PktBuf,
+ OUT UINT32 *PktLen
+ );
+
+EFI_STATUS
+MnpSyncSendPacket (
+ IN MNP_SERVICE_DATA *MnpServiceData,
+ IN UINT8 *Packet,
+ IN UINT32 Length,
+ IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+MnpInstanceDeliverPacket (
+ IN MNP_INSTANCE_DATA *Instance
+ );
+
+VOID
+EFIAPI
+MnpRecycleRxData (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+MnpReceivePacket (
+ IN MNP_SERVICE_DATA *MnpServiceData
+ );
+
+NET_BUF *
+MnpAllocNbuf (
+ IN MNP_SERVICE_DATA *MnpServiceData
+ );
+
+VOID
+MnpFreeNbuf (
+ IN MNP_SERVICE_DATA *MnpServiceData,
+ IN NET_BUF *Nbuf
+ );
+
+VOID
+EFIAPI
+MnpCheckPacketTimeout (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+EFIAPI
+MnpSystemPoll (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+EFIAPI
+MnpGetModeData (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpConfigure (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpMcastIpToMac (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN BOOLEAN Ipv6Flag,
+ IN EFI_IP_ADDRESS *IpAddress,
+ OUT EFI_MAC_ADDRESS *MacAddress
+ );
+
+EFI_STATUS
+EFIAPI
+MnpGroups (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpTransmit (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+EFIAPI
+MnpCancel (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+MnpReceive (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This,
+ IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+EFIAPI
+MnpPoll (
+ IN EFI_MANAGED_NETWORK_PROTOCOL *This
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/ComponentName.c
index 258299418c..626995b687 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 835dfe0b80..ceabbfe41f 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 a9b7ac7121..b6eba0cea6 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 22ba7dd705..c12b1dd007 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 3bd7574eb2..2595dc2795 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 be186866c5..5e5157be64 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
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c
index 0c0eeffcff..d14dbd9152 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c
@@ -2381,15 +2381,14 @@ InitializeBCDriver (
//
// Initialize EFI library
//
- Status = EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &mPxeBcDriverBinding,
- NULL,
- &gPxeBcComponentName,
- NULL,
- NULL
- );
+ Status = EfiLibInstallDriverBindingComponentName2 (
+ ImageHandle,
+ SystemTable,
+ &mPxeBcDriverBinding,
+ NULL,
+ &gPxeBcComponentName,
+ &gPxeBcComponentName2
+ );
InitArpHeader ();
OptionsStrucInit ();
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.h
index e04acc3656..715a9f1562 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.h
@@ -1,25 +1,25 @@
-/** @file
-
-Copyright (c) 2004 - 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:
- bc.h
-
-Abstract:
-
-
-**/
-
-#ifndef _BC_H
-#define _BC_H
-
+/** @file
+
+Copyright (c) 2004 - 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:
+ bc.h
+
+Abstract:
+
+
+**/
+
+#ifndef _BC_H
+#define _BC_H
+
#include <PiDxe.h>
#include <Guid/SmBios.h>
@@ -29,528 +29,529 @@ Abstract:
#include <Protocol/NetworkInterfaceIdentifier.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/LoadFile.h>
-#include <Protocol/DevicePath.h>
+#include <Protocol/DevicePath.h>
#include <Protocol/Tcp.h>
#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-
-#define CALLBACK_INTERVAL 100 // ten times a second
-#define FILTER_BITS (EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | \
- EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST | \
- EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS | \
- EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST \
- )
-
-#define WAIT_TX_TIMEOUT 1000
-
-#define SUPPORT_IPV6 0
-
-#define PXE_BASECODE_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'e', 'd')
-
-//
-// Determine the classes of IPv4 address
-//
-#define IS_CLASSA_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0x80) == 0x00)
-#define IS_CLASSB_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xc0) == 0x80)
-#define IS_CLASSC_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xe0) == 0xc0)
-#define IS_INADDR_UNICAST(x) ((IS_CLASSA_IPADDR(x) || IS_CLASSB_IPADDR(x) || IS_CLASSC_IPADDR(x)) && (((EFI_IP_ADDRESS*)x)->Addr[0] != 0) )
-
-//
-// Definitions for internet group management protocol version 2 message
-// structure
-// Per RFC 2236, November 1997
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 Type;
- UINT8 MaxRespTime; // in tenths of a second
- UINT16 Checksum; // ones complement of ones complement sum of
- // 16 bit words of message
- UINT32 GroupAddress; // for general query, all systems group,
- // for group specific, the group
-} IGMPV2_MESSAGE;
-
-#define IGMP_TYPE_QUERY 0x11
-#define IGMP_TYPE_REPORT 0x16
-#define IGMP_TYPE_V1REPORT 0x12
-#define IGMP_TYPE_LEAVE_GROUP 0x17
-
-#define IGMP_DEFAULT_MAX_RESPONSE_TIME 10 // 10 second default
-#pragma pack()
-
-#define MAX_MCAST_GROUPS 8 // most we allow ourselves to join at once
-#define MAX_OFFERS 16
-
-typedef struct {
- UINTN Signature;
- EFI_LOCK Lock;
- BOOLEAN ShowErrorMessages;
- EFI_TCP_PROTOCOL Tcp;
- EFI_PXE_BASE_CODE_PROTOCOL EfiBc;
- EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *CallbackProtocolPtr;
- EFI_HANDLE Handle;
-
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiPtr;
- EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetwork;
- UINT8 *TransmitBufferPtr;
- UINT8 *ReceiveBufferPtr;
- EFI_PXE_BASE_CODE_FUNCTION Function;
-
- UINTN OldestArpEntry;
- UINTN MCastGroupCount;
- EFI_EVENT Igmpv1TimeoutEvent;
- BOOLEAN UseIgmpv1Reporting;
- EFI_EVENT IgmpGroupEvent[MAX_MCAST_GROUPS];
- UINT16 RandomPort;
-
-#if SUPPORT_IPV6
- //
- // TBD
- //
-#else
- UINT32 MCastGroup[MAX_MCAST_GROUPS];
-#endif
-
- BOOLEAN GoodStationIp;
- BOOLEAN DidTransmit;
- UINTN IpLength;
- VOID *DhcpPacketBuffer;
- UINTN FileSize;
- VOID *BootServerReceiveBuffer;
- EFI_IP_ADDRESS ServerIp;
-
- //
- // work area
- // for dhcp
- //
- VOID *ReceiveBuffers;
- VOID *TransmitBuffer;
- UINTN NumOffersReceived;
- UINT16 TotalSeconds;
-
- //
- // arrays for different types of offers
- //
- UINT8 ServerCount[4];
- UINT8 OfferCount[4][MAX_OFFERS];
- UINT8 GotBootp;
- UINT8 GotProxy[4];
- UINT8 BinlProxies[MAX_OFFERS];
-
- UINT8 *ArpBuffer;
- UINT8 *TftpAckBuffer;
- UINT8 *TftpErrorBuffer;
- IGMPV2_MESSAGE IgmpMessage;
- BOOLEAN BigBlkNumFlag;
- UINT8 Timeout;
- UINT16 RandomSeed;
-} PXE_BASECODE_DEVICE;
-
-//
-// type index
-//
-#define DHCP_ONLY_IX 0
-#define PXE10_IX 1
-#define WfM11a_IX 2
-#define BINL_IX 3
-
-#define PXE_RND_PORT_LOW 2070
-
-//
-//
-//
-#define LOADFILE_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'e', 'l')
-
-typedef struct {
- UINTN Signature;
- EFI_LOCK Lock;
- EFI_LOAD_FILE_PROTOCOL LoadFile;
- PXE_BASECODE_DEVICE *Private;
-} LOADFILE_DEVICE;
-
-#define EFI_BASE_CODE_DEV_FROM_THIS(a) CR (a, PXE_BASECODE_DEVICE, efi_bc, PXE_BASECODE_DEVICE_SIGNATURE);
-
-#define EFI_BASE_CODE_DEV_FROM_TCP(a) CR (a, PXE_BASECODE_DEVICE, Tcp, PXE_BASECODE_DEVICE_SIGNATURE);
-
-#define EFI_LOAD_FILE_DEV_FROM_THIS(a) CR (a, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE)
-
-EFI_BIS_PROTOCOL *
-PxebcBisStart (
- PXE_BASECODE_DEVICE *Private,
- BIS_APPLICATION_HANDLE *BisAppHandle,
- EFI_BIS_DATA **BisDataSigInfo
- )
-;
-
-VOID
-PxebcBisStop (
- EFI_BIS_PROTOCOL *Bis,
- BIS_APPLICATION_HANDLE BisAppHandle,
- EFI_BIS_DATA *BisDataSigInfo
- )
-;
-
-BOOLEAN
-PxebcBisVerify (
- PXE_BASECODE_DEVICE *Private,
- VOID *FileBuffer,
- UINTN FileBufferLength,
- VOID *CredentialBuffer,
- UINTN CredentialBufferLength
- )
-;
-
-BOOLEAN
-PxebcBisDetect (
- PXE_BASECODE_DEVICE *Private
- )
-;
-
-//
-// Global Variables
-//
-extern EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName;
-
-//
-// //////////////////////////////////////////////////////////
-//
-// prototypes
-//
-
-/**
- Initialize the base code drivers and install the driver binding
-
- Standard EFI Image Entry
-
- @retval EFI_SUCCESS This driver was successfully bound
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeBCDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcStart (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN UseIpv6
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcStop (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcDhcp (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN SortOffers
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcDiscover (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN UINT16 Type,
- IN UINT16 *Layer,
- IN BOOLEAN UseBis,
- IN EFI_PXE_BASE_CODE_DISCOVER_INFO * Info OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcMtftp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
- IN OUT VOID *BufferPtr,
- IN BOOLEAN Overwrite,
- IN OUT UINT64 *BufferSize,
- IN UINTN *BlockSize OPTIONAL,
- IN EFI_IP_ADDRESS * ServerIp,
- IN UINT8 *Filename,
- IN EFI_PXE_BASE_CODE_MTFTP_INFO * Info OPTIONAL,
- IN BOOLEAN DontUseBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcUdpWrite (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIp,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
- IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcUdpRead (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcTcpWrite (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN UINT16 *UrgentPointer,
- IN UINT32 *SequenceNumber,
- IN UINT32 *AckNumber,
- IN UINT16 *HlenResCode,
- IN UINT16 *Window,
- IN EFI_IP_ADDRESS *DestIp,
- IN EFI_PXE_BASE_CODE_TCP_PORT *DestPort,
- IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_TCP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcTcpRead (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_TCP_PORT *DestPort, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_TCP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcArp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_IP_ADDRESS * IpAddr,
- IN EFI_MAC_ADDRESS * MacAddr OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcIpFilter (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetParameters (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN BOOLEAN *NewAutoArp, OPTIONAL
- IN BOOLEAN *NewSendGUID, OPTIONAL
- IN UINT8 *NewTTL, OPTIONAL
- IN UINT8 *NewToS, OPTIONAL
- IN BOOLEAN *NewMakeCallback OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetStationIP (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_IP_ADDRESS * NewStationIp, OPTIONAL
- IN EFI_IP_ADDRESS * NewSubnetMask OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetPackets (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
- BOOLEAN *NewDhcpAckReceived, OPTIONAL
- BOOLEAN *NewProxyOfferReceived, OPTIONAL
- BOOLEAN *NewPxeDiscoverValid, OPTIONAL
- BOOLEAN *NewPxeReplyReceived, OPTIONAL
- BOOLEAN *NewPxeBisReplyReceived, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpAck, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewProxyOffer, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeReply, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeBisReply OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-LoadFile (
- IN EFI_LOAD_FILE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN BOOLEAN BootPolicy,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-;
-
-EFI_STATUS
-PxeBcLibGetSmbiosSystemGuidAndSerialNumber (
- IN EFI_GUID *SystemGuid,
- OUT CHAR8 **SystemSerialNumber
- )
-;
-
-
-//
-// Define SMBIOS tables.
-//
-#pragma pack(1)
-typedef struct {
- UINT8 AnchorString[4];
- UINT8 EntryPointStructureChecksum;
- UINT8 EntryPointLength;
- UINT8 MajorVersion;
- UINT8 MinorVersion;
- UINT16 MaxStructureSize;
- UINT8 EntryPointRevision;
- UINT8 FormattedArea[5];
- UINT8 IntermediateAnchorString[5];
- UINT8 IntermediateChecksum;
- UINT16 TableLength;
- UINT32 TableAddress;
- UINT16 NumberOfSmbiosStructures;
- UINT8 SmbiosBcdRevision;
-} SMBIOS_STRUCTURE_TABLE;
-
-//
-// Please note that SMBIOS structures can be odd byte aligned since the
-// unformated section of each record is a set of arbitrary size strings.
-//
-typedef struct {
- UINT8 Type;
- UINT8 Length;
- UINT8 Handle[2];
-} SMBIOS_HEADER;
-
-typedef UINT8 SMBIOS_STRING;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Vendor;
- SMBIOS_STRING BiosVersion;
- UINT8 BiosSegment[2];
- SMBIOS_STRING BiosReleaseDate;
- UINT8 BiosSize;
- UINT8 BiosCharacteristics[8];
-} SMBIOS_TYPE0;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- SMBIOS_STRING ProductName;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
-
- //
- // always byte copy this data to prevent alignment faults!
- //
- EFI_GUID Uuid;
-
- UINT8 WakeUpType;
-} SMBIOS_TYPE1;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- SMBIOS_STRING ProductName;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
-} SMBIOS_TYPE2;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- UINT8 Type;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
- SMBIOS_STRING AssetTag;
- UINT8 BootupState;
- UINT8 PowerSupplyState;
- UINT8 ThermalState;
- UINT8 SecurityStatus;
- UINT8 OemDefined[4];
-} SMBIOS_TYPE3;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- UINT8 Socket;
- UINT8 ProcessorType;
- UINT8 ProcessorFamily;
- SMBIOS_STRING ProcessorManufacture;
- UINT8 ProcessorId[8];
- SMBIOS_STRING ProcessorVersion;
- UINT8 Voltage;
- UINT8 ExternalClock[2];
- UINT8 MaxSpeed[2];
- UINT8 CurrentSpeed[2];
- UINT8 Status;
- UINT8 ProcessorUpgrade;
- UINT8 L1CacheHandle[2];
- UINT8 L2CacheHandle[2];
- UINT8 L3CacheHandle[2];
-} SMBIOS_TYPE4;
-
-typedef union {
- SMBIOS_HEADER *Hdr;
- SMBIOS_TYPE0 *Type0;
- SMBIOS_TYPE1 *Type1;
- SMBIOS_TYPE2 *Type2;
- SMBIOS_TYPE3 *Type3;
- SMBIOS_TYPE4 *Type4;
- UINT8 *Raw;
-} SMBIOS_STRUCTURE_POINTER;
-#pragma pack()
-
-#include "ip.h"
-#include "dhcp.h"
-#include "tftp.h"
-
-#endif /* _BC_H */
-
-/* EOF - bc.h */
+#include <Library/UefiLib.h>
+
+#define CALLBACK_INTERVAL 100 // ten times a second
+#define FILTER_BITS (EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | \
+ EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST | \
+ EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS | \
+ EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST \
+ )
+
+#define WAIT_TX_TIMEOUT 1000
+
+#define SUPPORT_IPV6 0
+
+#define PXE_BASECODE_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'e', 'd')
+
+//
+// Determine the classes of IPv4 address
+//
+#define IS_CLASSA_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0x80) == 0x00)
+#define IS_CLASSB_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xc0) == 0x80)
+#define IS_CLASSC_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xe0) == 0xc0)
+#define IS_INADDR_UNICAST(x) ((IS_CLASSA_IPADDR(x) || IS_CLASSB_IPADDR(x) || IS_CLASSC_IPADDR(x)) && (((EFI_IP_ADDRESS*)x)->Addr[0] != 0) )
+
+//
+// Definitions for internet group management protocol version 2 message
+// structure
+// Per RFC 2236, November 1997
+//
+#pragma pack(1)
+
+typedef struct {
+ UINT8 Type;
+ UINT8 MaxRespTime; // in tenths of a second
+ UINT16 Checksum; // ones complement of ones complement sum of
+ // 16 bit words of message
+ UINT32 GroupAddress; // for general query, all systems group,
+ // for group specific, the group
+} IGMPV2_MESSAGE;
+
+#define IGMP_TYPE_QUERY 0x11
+#define IGMP_TYPE_REPORT 0x16
+#define IGMP_TYPE_V1REPORT 0x12
+#define IGMP_TYPE_LEAVE_GROUP 0x17
+
+#define IGMP_DEFAULT_MAX_RESPONSE_TIME 10 // 10 second default
+#pragma pack()
+
+#define MAX_MCAST_GROUPS 8 // most we allow ourselves to join at once
+#define MAX_OFFERS 16
+
+typedef struct {
+ UINTN Signature;
+ EFI_LOCK Lock;
+ BOOLEAN ShowErrorMessages;
+ EFI_TCP_PROTOCOL Tcp;
+ EFI_PXE_BASE_CODE_PROTOCOL EfiBc;
+ EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *CallbackProtocolPtr;
+ EFI_HANDLE Handle;
+
+ EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiPtr;
+ EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetwork;
+ UINT8 *TransmitBufferPtr;
+ UINT8 *ReceiveBufferPtr;
+ EFI_PXE_BASE_CODE_FUNCTION Function;
+
+ UINTN OldestArpEntry;
+ UINTN MCastGroupCount;
+ EFI_EVENT Igmpv1TimeoutEvent;
+ BOOLEAN UseIgmpv1Reporting;
+ EFI_EVENT IgmpGroupEvent[MAX_MCAST_GROUPS];
+ UINT16 RandomPort;
+
+#if SUPPORT_IPV6
+ //
+ // TBD
+ //
+#else
+ UINT32 MCastGroup[MAX_MCAST_GROUPS];
+#endif
+
+ BOOLEAN GoodStationIp;
+ BOOLEAN DidTransmit;
+ UINTN IpLength;
+ VOID *DhcpPacketBuffer;
+ UINTN FileSize;
+ VOID *BootServerReceiveBuffer;
+ EFI_IP_ADDRESS ServerIp;
+
+ //
+ // work area
+ // for dhcp
+ //
+ VOID *ReceiveBuffers;
+ VOID *TransmitBuffer;
+ UINTN NumOffersReceived;
+ UINT16 TotalSeconds;
+
+ //
+ // arrays for different types of offers
+ //
+ UINT8 ServerCount[4];
+ UINT8 OfferCount[4][MAX_OFFERS];
+ UINT8 GotBootp;
+ UINT8 GotProxy[4];
+ UINT8 BinlProxies[MAX_OFFERS];
+
+ UINT8 *ArpBuffer;
+ UINT8 *TftpAckBuffer;
+ UINT8 *TftpErrorBuffer;
+ IGMPV2_MESSAGE IgmpMessage;
+ BOOLEAN BigBlkNumFlag;
+ UINT8 Timeout;
+ UINT16 RandomSeed;
+} PXE_BASECODE_DEVICE;
+
+//
+// type index
+//
+#define DHCP_ONLY_IX 0
+#define PXE10_IX 1
+#define WfM11a_IX 2
+#define BINL_IX 3
+
+#define PXE_RND_PORT_LOW 2070
+
+//
+//
+//
+#define LOADFILE_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'e', 'l')
+
+typedef struct {
+ UINTN Signature;
+ EFI_LOCK Lock;
+ EFI_LOAD_FILE_PROTOCOL LoadFile;
+ PXE_BASECODE_DEVICE *Private;
+} LOADFILE_DEVICE;
+
+#define EFI_BASE_CODE_DEV_FROM_THIS(a) CR (a, PXE_BASECODE_DEVICE, efi_bc, PXE_BASECODE_DEVICE_SIGNATURE);
+
+#define EFI_BASE_CODE_DEV_FROM_TCP(a) CR (a, PXE_BASECODE_DEVICE, Tcp, PXE_BASECODE_DEVICE_SIGNATURE);
+
+#define EFI_LOAD_FILE_DEV_FROM_THIS(a) CR (a, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE)
+
+EFI_BIS_PROTOCOL *
+PxebcBisStart (
+ PXE_BASECODE_DEVICE *Private,
+ BIS_APPLICATION_HANDLE *BisAppHandle,
+ EFI_BIS_DATA **BisDataSigInfo
+ )
+;
+
+VOID
+PxebcBisStop (
+ EFI_BIS_PROTOCOL *Bis,
+ BIS_APPLICATION_HANDLE BisAppHandle,
+ EFI_BIS_DATA *BisDataSigInfo
+ )
+;
+
+BOOLEAN
+PxebcBisVerify (
+ PXE_BASECODE_DEVICE *Private,
+ VOID *FileBuffer,
+ UINTN FileBufferLength,
+ VOID *CredentialBuffer,
+ UINTN CredentialBufferLength
+ )
+;
+
+BOOLEAN
+PxebcBisDetect (
+ PXE_BASECODE_DEVICE *Private
+ )
+;
+
+//
+// Global Variables
+//
+extern EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2;
+
+//
+// //////////////////////////////////////////////////////////
+//
+// prototypes
+//
+
+/**
+ Initialize the base code drivers and install the driver binding
+
+ Standard EFI Image Entry
+
+ @retval EFI_SUCCESS This driver was successfully bound
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeBCDriver (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcStart (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN BOOLEAN UseIpv6
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcStop (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcDhcp (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN BOOLEAN SortOffers
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcDiscover (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ IN UINT16 Type,
+ IN UINT16 *Layer,
+ IN BOOLEAN UseBis,
+ IN EFI_PXE_BASE_CODE_DISCOVER_INFO * Info OPTIONAL
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcMtftp (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
+ IN OUT VOID *BufferPtr,
+ IN BOOLEAN Overwrite,
+ IN OUT UINT64 *BufferSize,
+ IN UINTN *BlockSize OPTIONAL,
+ IN EFI_IP_ADDRESS * ServerIp,
+ IN UINT8 *Filename,
+ IN EFI_PXE_BASE_CODE_MTFTP_INFO * Info OPTIONAL,
+ IN BOOLEAN DontUseBuffer
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcUdpWrite (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN UINT16 OpFlags,
+ IN EFI_IP_ADDRESS *DestIp,
+ IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
+ IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
+ IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
+ IN UINTN *HeaderSize, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN UINTN *BufferSize,
+ IN VOID *BufferPtr
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcUdpRead (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN UINT16 OpFlags,
+ IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
+ IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
+ IN UINTN *HeaderSize, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN OUT UINTN *BufferSize,
+ IN VOID *BufferPtr
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcTcpWrite (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN UINT16 OpFlags,
+ IN UINT16 *UrgentPointer,
+ IN UINT32 *SequenceNumber,
+ IN UINT32 *AckNumber,
+ IN UINT16 *HlenResCode,
+ IN UINT16 *Window,
+ IN EFI_IP_ADDRESS *DestIp,
+ IN EFI_PXE_BASE_CODE_TCP_PORT *DestPort,
+ IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
+ IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_TCP_PORT *SrcPort, OPTIONAL
+ IN UINTN *HeaderSize, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN UINTN *BufferSize,
+ IN VOID *BufferPtr
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcTcpRead (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN UINT16 OpFlags,
+ IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_TCP_PORT *DestPort, OPTIONAL
+ IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_TCP_PORT *SrcPort, OPTIONAL
+ IN UINTN *HeaderSize, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN OUT UINTN *BufferSize,
+ IN VOID *BufferPtr
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcArp (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ IN EFI_IP_ADDRESS * IpAddr,
+ IN EFI_MAC_ADDRESS * MacAddr OPTIONAL
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcIpFilter (
+ IN EFI_PXE_BASE_CODE_PROTOCOL *This,
+ IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcSetParameters (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ IN BOOLEAN *NewAutoArp, OPTIONAL
+ IN BOOLEAN *NewSendGUID, OPTIONAL
+ IN UINT8 *NewTTL, OPTIONAL
+ IN UINT8 *NewToS, OPTIONAL
+ IN BOOLEAN *NewMakeCallback OPTIONAL
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcSetStationIP (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ IN EFI_IP_ADDRESS * NewStationIp, OPTIONAL
+ IN EFI_IP_ADDRESS * NewSubnetMask OPTIONAL
+ )
+;
+
+EFI_STATUS
+EFIAPI
+BcSetPackets (
+ IN EFI_PXE_BASE_CODE_PROTOCOL * This,
+ BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
+ BOOLEAN *NewDhcpAckReceived, OPTIONAL
+ BOOLEAN *NewProxyOfferReceived, OPTIONAL
+ BOOLEAN *NewPxeDiscoverValid, OPTIONAL
+ BOOLEAN *NewPxeReplyReceived, OPTIONAL
+ BOOLEAN *NewPxeBisReplyReceived, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewDhcpDiscover, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewDhcpAck, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewProxyOffer, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewPxeDiscover, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewPxeReply, OPTIONAL
+ IN EFI_PXE_BASE_CODE_PACKET * NewPxeBisReply OPTIONAL
+ )
+;
+
+EFI_STATUS
+EFIAPI
+LoadFile (
+ IN EFI_LOAD_FILE_PROTOCOL *This,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
+ IN BOOLEAN BootPolicy,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
+ )
+;
+
+EFI_STATUS
+PxeBcLibGetSmbiosSystemGuidAndSerialNumber (
+ IN EFI_GUID *SystemGuid,
+ OUT CHAR8 **SystemSerialNumber
+ )
+;
+
+
+//
+// Define SMBIOS tables.
+//
+#pragma pack(1)
+typedef struct {
+ UINT8 AnchorString[4];
+ UINT8 EntryPointStructureChecksum;
+ UINT8 EntryPointLength;
+ UINT8 MajorVersion;
+ UINT8 MinorVersion;
+ UINT16 MaxStructureSize;
+ UINT8 EntryPointRevision;
+ UINT8 FormattedArea[5];
+ UINT8 IntermediateAnchorString[5];
+ UINT8 IntermediateChecksum;
+ UINT16 TableLength;
+ UINT32 TableAddress;
+ UINT16 NumberOfSmbiosStructures;
+ UINT8 SmbiosBcdRevision;
+} SMBIOS_STRUCTURE_TABLE;
+
+//
+// Please note that SMBIOS structures can be odd byte aligned since the
+// unformated section of each record is a set of arbitrary size strings.
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Handle[2];
+} SMBIOS_HEADER;
+
+typedef UINT8 SMBIOS_STRING;
+
+typedef struct {
+ SMBIOS_HEADER Hdr;
+ SMBIOS_STRING Vendor;
+ SMBIOS_STRING BiosVersion;
+ UINT8 BiosSegment[2];
+ SMBIOS_STRING BiosReleaseDate;
+ UINT8 BiosSize;
+ UINT8 BiosCharacteristics[8];
+} SMBIOS_TYPE0;
+
+typedef struct {
+ SMBIOS_HEADER Hdr;
+ SMBIOS_STRING Manufacturer;
+ SMBIOS_STRING ProductName;
+ SMBIOS_STRING Version;
+ SMBIOS_STRING SerialNumber;
+
+ //
+ // always byte copy this data to prevent alignment faults!
+ //
+ EFI_GUID Uuid;
+
+ UINT8 WakeUpType;
+} SMBIOS_TYPE1;
+
+typedef struct {
+ SMBIOS_HEADER Hdr;
+ SMBIOS_STRING Manufacturer;
+ SMBIOS_STRING ProductName;
+ SMBIOS_STRING Version;
+ SMBIOS_STRING SerialNumber;
+} SMBIOS_TYPE2;
+
+typedef struct {
+ SMBIOS_HEADER Hdr;
+ SMBIOS_STRING Manufacturer;
+ UINT8 Type;
+ SMBIOS_STRING Version;
+ SMBIOS_STRING SerialNumber;
+ SMBIOS_STRING AssetTag;
+ UINT8 BootupState;
+ UINT8 PowerSupplyState;
+ UINT8 ThermalState;
+ UINT8 SecurityStatus;
+ UINT8 OemDefined[4];
+} SMBIOS_TYPE3;
+
+typedef struct {
+ SMBIOS_HEADER Hdr;
+ UINT8 Socket;
+ UINT8 ProcessorType;
+ UINT8 ProcessorFamily;
+ SMBIOS_STRING ProcessorManufacture;
+ UINT8 ProcessorId[8];
+ SMBIOS_STRING ProcessorVersion;
+ UINT8 Voltage;
+ UINT8 ExternalClock[2];
+ UINT8 MaxSpeed[2];
+ UINT8 CurrentSpeed[2];
+ UINT8 Status;
+ UINT8 ProcessorUpgrade;
+ UINT8 L1CacheHandle[2];
+ UINT8 L2CacheHandle[2];
+ UINT8 L3CacheHandle[2];
+} SMBIOS_TYPE4;
+
+typedef union {
+ SMBIOS_HEADER *Hdr;
+ SMBIOS_TYPE0 *Type0;
+ SMBIOS_TYPE1 *Type1;
+ SMBIOS_TYPE2 *Type2;
+ SMBIOS_TYPE3 *Type3;
+ SMBIOS_TYPE4 *Type4;
+ UINT8 *Raw;
+} SMBIOS_STRUCTURE_POINTER;
+#pragma pack()
+
+#include "ip.h"
+#include "dhcp.h"
+#include "tftp.h"
+
+#endif /* _BC_H */
+
+/* EOF - bc.h */
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/ComponentName.c b/MdeModulePkg/Universal/Network/PxeBcDxe/ComponentName.c
index 18dca38408..7aea928fed 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/ComponentName.c
@@ -22,6 +22,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
PxeBcComponentNameGetDriverName (
@@ -30,6 +69,75 @@ PxeBcComponentNameGetDriverName (
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
PxeBcComponentNameGetControllerName (
@@ -40,18 +148,29 @@ PxeBcComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
PxeBcComponentNameGetDriverName,
PxeBcComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeBcComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeBcComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"PXE Base Code Driver"
},
{
@@ -60,6 +179,45 @@ static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
}
};
+/**
+ 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
PxeBcComponentNameGetDriverName (
@@ -67,41 +225,84 @@ PxeBcComponentNameGetDriverName (
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_SUCCESS - 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,
- gPxeBcComponentName.SupportedLanguages,
- mPxeBcDriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mPxeBcDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gPxeBcComponentName)
+ );
}
+/**
+ 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
PxeBcComponentNameGetControllerName (
@@ -111,50 +312,6 @@ PxeBcComponentNameGetControllerName (
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/PxeBcDxe/Dhcp.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Dhcp.h
index 36f71f775a..839a093d9f 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Dhcp.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Dhcp.h
@@ -1,632 +1,632 @@
-/** @file
-
-Copyright (c) 2004, 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.
-
-
-**/
-
-#ifndef _DHCP_H
-#define _DHCP_H
-
-//
-// Definitions for DHCP version 4 UDP packet.
-// The field names in this structure are defined and described in RFC 2131.
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 op;
-#define BOOTP_REQUEST 1
-#define BOOTP_REPLY 2
-
- UINT8 htype;
- UINT8 hlen;
- UINT8 hops;
- UINT32 xid;
- UINT16 secs;
- UINT16 flags;
-#define DHCP_BROADCAST_FLAG 0x8000
-
- UINT32 ciaddr;
- UINT32 yiaddr;
- UINT32 siaddr;
- UINT32 giaddr;
- UINT8 chaddr[16];
- UINT8 sname[64];
- UINT8 file[128];
- UINT8 options[312];
-#define OP_PAD 0
-#define OP_END 255
-#define OP_SUBNET_MASK 1
-#define OP_TIME_OFFSET 2
-#define OP_ROUTER_LIST 3
-#define OP_TIME_SERVERS 4
-#define OP_NAME_SERVERS 5
-#define OP_DNS_SERVERS 6
-#define OP_LOG_SERVERS 7
-#define OP_COOKIE_SERVERS 8
-#define OP_LPR_SREVERS 9
-#define OP_IMPRESS_SERVERS 10
-#define OP_RES_LOC_SERVERS 11
-#define OP_HOST_NAME 12
-#define OP_BOOT_FILE_SZ 13
-#define OP_DUMP_FILE 14
-#define OP_DOMAIN_NAME 15
-#define OP_SWAP_SERVER 16
-#define OP_ROOT_PATH 17
-#define OP_EXTENSION_PATH 18
-#define OP_IP_FORWARDING 19
-#define OP_NON_LOCAL_SRC_RTE 20
-#define OP_POLICY_FILTER 21
-#define OP_MAX_DATAGRAM_SZ 22
-#define OP_DEFAULT_TTL 23
-#define OP_MTU_AGING_TIMEOUT 24
-#define OP_MTU_SIZES 25
-#define OP_MTU_TO_USE 26
-#define OP_ALL_SUBNETS_LOCAL 27
-#define OP_BROADCAST_ADD 28
-#define OP_PERFORM_MASK_DISCOVERY 29
-#define OP_RESPOND_TO_MASK_REQ 30
-#define OP_PERFORM_ROUTER_DISCOVERY 31
-#define OP_ROUTER_SOLICIT_ADDRESS 32
-#define OP_STATIC_ROUTER_LIST 33
-#define OP_USE_ARP_TRAILERS 34
-#define OP_ARP_CACHE_TIMEOUT 35
-#define OP_ETHERNET_ENCAPSULATION 36
-#define OP_TCP_DEFAULT_TTL 37
-#define OP_TCP_KEEP_ALIVE_INT 38
-#define OP_KEEP_ALIVE_GARBAGE 39
-#define OP_NIS_DOMAIN_NAME 40
-#define OP_NIS_SERVERS 41
-#define OP_NTP_SERVERS 42
-#define OP_VENDOR_SPECIFIC 43
-#define VEND_PXE_MTFTP_IP 1
-#define VEND_PXE_MTFTP_CPORT 2
-#define VEND_PXE_MTFTP_SPORT 3
-#define VEND_PXE_MTFTP_TMOUT 4
-#define VEND_PXE_MTFTP_DELAY 5
-#define VEND_PXE_DISCOVERY_CONTROL 6
-#define PXE_DISABLE_BROADCAST_DISCOVERY (1 << 0)
-#define PXE_DISABLE_MULTICAST_DISCOVERY (1 << 1)
-#define PXE_ACCEPT_ONLY_PXE_BOOT_SERVERS (1 << 2)
-#define PXE_DO_NOT_PROMPT (1 << 3)
-#define VEND_PXE_DISCOVERY_MCAST_ADDR 7
-#define VEND_PXE_BOOT_SERVERS 8
-#define VEND_PXE_BOOT_MENU 9
-#define VEND_PXE_BOOT_PROMPT 10
-#define VEND_PXE_MCAST_ADDRS_ALLOC 11
-#define VEND_PXE_CREDENTIAL_TYPES 12
-#define VEND_PXE_BOOT_ITEM 71
-#define OP_NBNS_SERVERS 44
-#define OP_NBDD_SERVERS 45
-#define OP_NETBIOS_NODE_TYPE 46
-#define OP_NETBIOS_SCOPE 47
-#define OP_XWINDOW_SYSTEM_FONT_SERVERS 48
-#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
-#define OP_DHCP_REQ_IP_ADD 50
-#define OP_DHCP_LEASE_TIME 51
-#define OP_DHCP_OPTION_OVERLOAD 52
-#define OVLD_FILE 1
-#define OVLD_SRVR_NAME 2
-#define OP_DHCP_MESSAGE_TYPE 53
-#define DHCPDISCOVER 1
-#define DHCPOFFER 2
-#define DHCPREQUEST 3
-#define DHCPDECLINE 4
-#define DHCPACK 5
-#define DHCPNAK 6
-#define DHCPRELEASE 7
-#define DHCPINFORM 8
-#define OP_DHCP_SERVER_IP 54
-#define OP_DHCP_PARM_REQ_LIST 55
-#define OP_DHCP_ERROR_MESSAGE 56
-#define OP_DHCP_MAX_MESSAGE_SZ 57
-#define OP_DHCP_RENEWAL_TIME 58
-#define OP_DHCP_REBINDING_TIME 59
-#define OP_DHCP_CLASS_IDENTIFIER 60
-#define OP_DHCP_CLIENT_IDENTIFIER 61
-#define OP_NISPLUS_DOMAIN_NAME 64
-#define OP_NISPLUS_SERVERS 65
-#define OP_DHCP_TFTP_SERVER_NAME 66
-#define OP_DHCP_BOOTFILE 67
-#define OP_MOBILE_IP_HOME_AGENTS 68
-#define OP_SMPT_SERVERS 69
-#define OP_POP3_SERVERS 70
-#define OP_NNTP_SERVERS 71
-#define OP_WWW_SERVERS 72
-#define OP_FINGER_SERVERS 73
-#define OP_IRC_SERVERS 74
-#define OP_STREET_TALK_SERVERS 75
-#define OP_STREET_TALK_DIR_ASSIST_SERVERS 76
-#define OP_NDS_SERVERS 85
-#define OP_NDS_TREE_NAME 86
-#define OP_NDS_CONTEXT 87
-#define OP_DHCP_SYSTEM_ARCH 93
-#define OP_DHCP_NETWORK_ARCH 94
-#define OP_DHCP_PLATFORM_ID 97
-} DHCPV4_STRUCT;
-
-//
-// DHCPv4 option header
-//
-typedef struct {
- UINT8 OpCode;
- UINT8 Length;
- //
- // followed by Data[]
- //
-} DHCPV4_OP_HEADER;
-
-//
-// Generic DHCPv4 option (header followed by data)
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Data[1];
-} DHCPV4_OP_STRUCT;
-
-//
-// Maximum DHCP packet size on ethernet
-//
-#define MAX_DHCP_MSG_SZ (MAX_ENET_DATA_SIZE - sizeof (IPV4_HEADER) - sizeof (UDPV4_HEADER))
-
-//
-// Macros used in pxe_bc_dhcp.c and pxe_loadfile.c
-//
-#define DHCPV4_TRANSMIT_BUFFER (*(DHCPV4_STRUCT *) (Private->TransmitBuffer))
-#define DHCPV4_OPTIONS_BUFFER (*(struct optionsstr *) DHCPV4_TRANSMIT_BUFFER.options)
-
-#define DHCPV4_ACK_INDEX 0
-#define PXE_BINL_INDEX 1
-#define PXE_OFFER_INDEX 1
-#define PXE_ACK_INDEX 2
-#define PXE_BIS_INDEX 3
-
-#define DHCPV4_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[DHCPV4_ACK_INDEX]
-#define PXE_BINL_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BINL_INDEX]
-#define PXE_OFFER_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_OFFER_INDEX]
-#define PXE_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_ACK_INDEX]
-#define PXE_BIS_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BIS_INDEX]
-
-#define DHCPV4_ACK_PACKET DHCPV4_ACK_BUFFER.u.Dhcpv4
-#define PXE_BINL_PACKET PXE_BINL_BUFFER.u.Dhcpv4
-#define PXE_OFFER_PACKET PXE_OFFER_BUFFER.u.Dhcpv4
-#define PXE_ACK_PACKET PXE_ACK_BUFFER.u.Dhcpv4
-#define PXE_BIS_PACKET PXE_BIS_BUFFER.u.Dhcpv4
-
-//
-// network structure definitions
-//
-//
-// some option definitions
-//
-#define DHCPV4_OPTION_LENGTH(type) (sizeof (type) - sizeof (DHCPV4_OP_HEADER))
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type;
-} DHCPV4_OP_MESSAGE_TYPE;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Overload;
-} DHCPV4_OP_OVERLOAD;
-
-//
-// boot server list structure
-// one or more contained in a pxe boot servers structure
-//
-typedef struct {
- UINT8 IpCount;
- EFI_IPv4_ADDRESS IpList[1]; // IP count of IPs
-} PXEV4_SERVER_LIST;
-
-typedef struct {
- UINT8 IpCount;
- EFI_IPv6_ADDRESS IpList[1]; // IP count of IPs
-} PXEV6_SERVER_LIST;
-
-typedef union {
- PXEV4_SERVER_LIST Ipv4List;
- PXEV6_SERVER_LIST Ipv6List;
-} PXE_SERVER_LISTS;
-
-typedef struct {
- UINT16 Type;
- PXE_SERVER_LISTS u;
-} PXE_SERVER_LIST;
-
-//
-// pxe boot servers structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- PXE_SERVER_LIST ServerList[1]; // one or more
-} PXE_OP_SERVER_LIST;
-
-//
-// pxe boot item structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT16 Type;
- UINT16 Layer;
-} PXE_OP_BOOT_ITEM;
-
-//
-// pxe boot menu item structure
-//
-typedef struct {
- UINT16 Type;
- UINT8 DataLen;
- UINT8 Data[1];
-} PXE_BOOT_MENU_ENTRY;
-
-//
-// pxe boot menu structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- PXE_BOOT_MENU_ENTRY MenuItem[1];
-} PXE_OP_BOOT_MENU;
-
-//
-// pxe boot prompt structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Timeout;
- UINT8 Prompt[1];
-} PXE_OP_BOOT_PROMPT;
-
-#define PXE_BOOT_PROMPT_AUTO_SELECT 0
-#define PXE_BOOT_PROMPT_NO_TIMEOUT 255
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Class[1];
-} DHCPV4_OP_CLASS;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 File[1];
-} DHCPV4_OP_BOOTFILE;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 VendorOptions[1];
-} DHCPV4_OP_VENDOR_OPTIONS;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 MaxSize[2];
-} DHCPV4_OP_MAX_MESSAGE_SIZE;
-
-typedef struct {
- UINT8 _OP_SUBNET_MASK; /* 1 */
- UINT8 _OP_TIME_OFFSET; /* 2 */
- UINT8 _OP_ROUTER_LIST; /* 3 */
- UINT8 _OP_TIME_SERVERS; /* 4 */
- UINT8 _OP_NAME_SERVERS; /* 5 */
- UINT8 _OP_DNS_SERVERS; /* 6 */
- UINT8 _OP_HOST_NAME; /* 12 */
- UINT8 _OP_BOOT_FILE_SZ; /* 13 */
- UINT8 _OP_DOMAIN_NAME; /* 15 */
- UINT8 _OP_ROOT_PATH; /* 17 */
- UINT8 _OP_EXTENSION_PATH; /* 18 */
- UINT8 _OP_MAX_DATAGRAM_SZ; /* 22 */
- UINT8 _OP_DEFAULT_TTL; /* 23 */
- UINT8 _OP_BROADCAST_ADD; /* 28 */
- UINT8 _OP_NIS_DOMAIN_NAME; /* 40 */
- UINT8 _OP_NIS_SERVERS; /* 41 */
- UINT8 _OP_NTP_SERVERS; /* 42 */
- UINT8 _OP_VENDOR_SPECIFIC; /* 43 */
- UINT8 _OP_DHCP_REQ_IP_ADD; /* 50 */
- UINT8 _OP_DHCP_LEASE_TIME; /* 51 */
- UINT8 _OP_DHCP_SERVER_IP; /* 54 */
- UINT8 _OP_DHCP_RENEWAL_TIME; /* 58 */
- UINT8 _OP_DHCP_REBINDING_TIME; /* 59 */
- UINT8 _OP_DHCP_CLASS_IDENTIFIER; /* 60 */
- UINT8 _OP_DHCP_TFTP_SERVER_NAME; /* 66 */
- UINT8 _OP_DHCP_BOOTFILE; /* 67 */
- UINT8 _OP_DHCP_PLATFORM_ID; /* 97 */
- UINT8 VendorOption128; // vendor option 128
- UINT8 VendorOption129; // vendor option 129
- UINT8 VendorOption130; // vendor option 130
- UINT8 VendorOption131; // vendor option 131
- UINT8 VendorOption132; // vendor option 132
- UINT8 VendorOption133; // vendor option 133
- UINT8 VendorOption134; // vendor option 134
- UINT8 VendorOption135; // vendor option 135
-} DHCPV4_REQUESTED_OPTIONS_DATA;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- DHCPV4_REQUESTED_OPTIONS_DATA Data;
-} DHCPV4_OP_REQUESTED_OPTIONS;
-
-typedef struct opipstr {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_IP_ADDRESS;
-
-//
-// ip list structure - e.g. router list
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS IpList[1];
-} DHCPV4_OP_IP_LIST;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type;
- UINT8 Guid[sizeof (EFI_GUID)];
-} DHCPV4_OP_CLIENT_ID;
-
-//
-// special options start - someday obsolete ???
-//
-#define DHCPV4_OP_PLATFORM_ID DHCPV4_OP_CLIENT_ID
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type; // SNP = 2
- UINT8 MajorVersion;
- UINT8 MinorVersion;
-} DHCPV4_OP_NETWORK_INTERFACE;
-
-#define UNDI_TYPE 1
-#define SNP_TYPE 2
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT16 Type;
-} DHCPV4_OP_ARCHITECTURE_TYPE;
-//
-// special options end - someday obsolete ???
-//
-typedef struct {
- UINT8 ClassIdentifier[10]; // PXEClient:
- UINT8 Lit2[5]; // Arch:
- UINT8 ArchitectureType[5]; // 00000 - 65536
- UINT8 Lit3[1]; // :
- UINT8 InterfaceName[4]; // e.g. UNDI
- UINT8 Lit4[1]; // :
- UINT8 UndiMajor[3]; // 000 - 255
- UINT8 UndiMinor[3]; // 000 - 255
-} DHCPV4_CLASS_ID_DATA;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- DHCPV4_CLASS_ID_DATA Data;
-} DHCPV4_OP_CLASS_ID;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_REQUESTED_IP;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_SERVER_IP;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_SUBNET_MASK;
-
-typedef struct { // oppxedisctlstr {
- DHCPV4_OP_HEADER Header;
- UINT8 ControlBits;
-} PXE_OP_DISCOVERY_CONTROL;
-
-#define DISABLE_BCAST (1 << 0)
-#define DISABLE_MCAST (1 << 1)
-#define USE_ACCEPT_LIST (1 << 2)
-#define USE_BOOTFILE (1 << 3)
-
-#pragma pack()
-//
-// definitions of indices to populate option interest array
-//
-#define VEND_PXE_MTFTP_IP_IX 1 // multicast IP address of bootfile for MTFTP listen
-#define VEND_PXE_MTFTP_CPORT_IX 2 // UDP Port to monitor for MTFTP responses - Intel order
-#define VEND_PXE_MTFTP_SPORT_IX 3 // Server UDP Port for MTFTP open - Intel order
-#define VEND_PXE_MTFTP_TMOUT_IX 4 // Listen timeout - secs
-#define VEND_PXE_MTFTP_DELAY_IX 5 // Transmission timeout - secs
-#define VEND_PXE_DISCOVERY_CONTROL_IX 6 // bit field
-#define VEND_PXE_DISCOVERY_MCAST_ADDR_IX 7 // boot server discovery multicast address
-#define VEND_PXE_BOOT_SERVERS_IX 8 // list of boot servers of form tp(2) cnt(1) ips[cnt]
-#define VEND_PXE_BOOT_MENU_IX 9
-#define VEND_PXE_BOOT_PROMPT_IX 10
-#define VEND_PXE_MCAST_ADDRS_ALLOC_IX 0 // not used by PXE client
-#define VEND_PXE_CREDENTIAL_TYPES_IX 11
-#define VEND_13_IX 0 // not used by PXE client
-#define VEND_14_IX 0 // not used by PXE client
-#define VEND_15_IX 0 // not used by PXE client
-#define VEND_16_IX 0 // not used by PXE client
-#define VEND_17_IX 0 // not used by PXE client
-#define VEND_18_IX 0 // not used by PXE client
-#define VEND_19_IX 0 // not used by PXE client
-#define VEND_20_IX 0 // not used by PXE client
-#define VEND_21_IX 0 // not used by PXE client
-#define VEND_22_IX 0 // not used by PXE client
-#define VEND_23_IX 0 // not used by PXE client
-#define VEND_24_IX 0 // not used by PXE client
-#define VEND_25_IX 0 // not used by PXE client
-#define VEND_26_IX 0 // not used by PXE client
-#define VEND_27_IX 0 // not used by PXE client
-#define VEND_28_IX 0 // not used by PXE client
-#define VEND_29_IX 0 // not used by PXE client
-#define VEND_30_IX 0 // not used by PXE client
-#define VEND_31_IX 0 // not used by PXE client
-#define VEND_32_IX 0 // not used by PXE client
-#define VEND_33_IX 0 // not used by PXE client
-#define VEND_34_IX 0 // not used by PXE client
-#define VEND_35_IX 0 // not used by PXE client
-#define VEND_36_IX 0 // not used by PXE client
-#define VEND_37_IX 0 // not used by PXE client
-#define VEND_38_IX 0 // not used by PXE client
-#define VEND_39_IX 0 // not used by PXE client
-#define VEND_40_IX 0 // not used by PXE client
-#define VEND_41_IX 0 // not used by PXE client
-#define VEND_42_IX 0 // not used by PXE client
-#define VEND_43_IX 0 // not used by PXE client
-#define VEND_44_IX 0 // not used by PXE client
-#define VEND_45_IX 0 // not used by PXE client
-#define VEND_46_IX 0 // not used by PXE client
-#define VEND_47_IX 0 // not used by PXE client
-#define VEND_48_IX 0 // not used by PXE client
-#define VEND_49_IX 0 // not used by PXE client
-#define VEND_50_IX 0 // not used by PXE client
-#define VEND_51_IX 0 // not used by PXE client
-#define VEND_52_IX 0 // not used by PXE client
-#define VEND_53_IX 0 // not used by PXE client
-#define VEND_54_IX 0 // not used by PXE client
-#define VEND_55_IX 0 // not used by PXE client
-#define VEND_56_IX 0 // not used by PXE client
-#define VEND_57_IX 0 // not used by PXE client
-#define VEND_58_IX 0 // not used by PXE client
-#define VEND_59_IX 0 // not used by PXE client
-#define VEND_60_IX 0 // not used by PXE client
-#define VEND_61_IX 0 // not used by PXE client
-#define VEND_62_IX 0 // not used by PXE client
-#define VEND_63_IX 0 // not used by PXE client
-#define VEND_64_IX 0 // not used by PXE client
-#define VEND_65_IX 0 // not used by PXE client
-#define VEND_66_IX 0 // not used by PXE client
-#define VEND_67_IX 0 // not used by PXE client
-#define VEND_68_IX 0 // not used by PXE client
-#define VEND_69_IX 0 // not used by PXE client
-#define VEND_70_IX 0 // not used by PXE client
-#define VEND_PXE_BOOT_ITEM_IX 12
-
-#define MAX_OUR_PXE_OPT VEND_PXE_BOOT_ITEM // largest PXE option in which we are interested
-#define MAX_OUR_PXE_IX VEND_PXE_BOOT_ITEM_IX // largest PXE option index
-//
-// define various types by options that are sent
-//
-#define WfM11a_OPTS ((1<<VEND_PXE_MTFTP_IP_IX) | \
- (1<<VEND_PXE_MTFTP_CPORT_IX) | \
- (1<<VEND_PXE_MTFTP_SPORT_IX) | \
- (1<<VEND_PXE_MTFTP_TMOUT_IX) | \
- (1<<VEND_PXE_MTFTP_DELAY_IX))
-
-#define DISCOVER_OPTS ((1<<VEND_PXE_DISCOVERY_CONTROL_IX) | \
- (1<<VEND_PXE_DISCOVERY_MCAST_ADDR_IX) | \
- (1<<VEND_PXE_BOOT_SERVERS_IX) | \
- (1<<VEND_PXE_BOOT_MENU_IX) | \
- (1<<VEND_PXE_BOOT_PROMPT_IX) | \
- (1<<VEND_PXE_BOOT_ITEM_IX))
-
-#define CREDENTIALS_OPT (1 << VEND_PXE_CREDENTIAL_TYPES_IX)
-
-//
-// definitions of indices to populate option interest array
-//
-#define OP_SUBNET_MASK_IX 1
-#define OP_TIME_OFFSET_IX 0 // not used by PXE client
-#define OP_ROUTER_LIST_IX 2
-#define OP_TIME_SERVERS_IX 0 // not used by PXE client
-#define OP_NAME_SERVERS_IX 0 // not used by PXE client
-#define OP_DNS_SERVERS_IX 0 // not used by PXE client
-#define OP_LOG_SERVERS_IX 0 // not used by PXE client
-#define OP_COOKIE_SERVERS_IX 0 // not used by PXE client
-#define OP_LPR_SREVERS_IX 0 // not used by PXE client
-#define OP_IMPRESS_SERVERS_IX 0 // not used by PXE client
-#define OP_RES_LOC_SERVERS_IX 0 // not used by PXE client
-#define OP_HOST_NAME_IX 0 // not used by PXE client
-#define OP_BOOT_FILE_SZ_IX 9
-#define OP_DUMP_FILE_IX 0 // not used by PXE client
-#define OP_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_SWAP_SERVER_IX 0 // not used by PXE client
-#define OP_ROOT_PATH_IX 0 // not used by PXE client
-#define OP_EXTENSION_PATH_IX 0 // not used by PXE client
-#define OP_IP_FORWARDING_IX 0 // not used by PXE client
-#define OP_NON_LOCAL_SRC_RTE_IX 0 // not used by PXE client
-#define OP_POLICY_FILTER_IX 0 // not used by PXE client
-#define OP_MAX_DATAGRAM_SZ_IX 0 // not used by PXE client
-#define OP_DEFAULT_TTL_IX 0 // not used by PXE client
-#define OP_MTU_AGING_TIMEOUT_IX 0 // not used by PXE client
-#define OP_MTU_SIZES_IX 0 // not used by PXE client
-#define OP_MTU_TO_USE_IX 0 // not used by PXE client
-#define OP_ALL_SUBNETS_LOCAL_IX 0 // not used by PXE client
-#define OP_BROADCAST_ADD_IX 0 // not used by PXE client
-#define OP_PERFORM_MASK_DISCOVERY_IX 0 // not used by PXE client
-#define OP_RESPOND_TO_MASK_REQ_IX 0 // not used by PXE client
-#define OP_PERFORM_ROUTER_DISCOVERY_IX 0 // not used by PXE client
-#define OP_ROUTER_SOLICIT_ADDRESS_IX 0 // not used by PXE client
-#define OP_STATIC_ROUTER_LIST_IX 0 // not used by PXE client
-#define OP_USE_ARP_TRAILERS_IX 0 // not used by PXE client
-#define OP_ARP_CACHE_TIMEOUT_IX 0 // not used by PXE client
-#define OP_ETHERNET_ENCAPSULATION_IX 0 // not used by PXE client
-#define OP_TCP_DEFAULT_TTL_IX 0 // not used by PXE client
-#define OP_TCP_KEEP_ALIVE_INT_IX 0 // not used by PXE client
-#define OP_KEEP_ALIVE_GARBAGE_IX 0 // not used by PXE client
-#define OP_NIS_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_NIS_SERVERS_IX 0 // not used by PXE client
-#define OP_NTP_SERVERS_IX 0 // not used by PXE client
-#define OP_VENDOR_SPECIFIC_IX 3
-#define OP_NBNS_SERVERS_IX 0 // not used by PXE client
-#define OP_NBDD_SERVERS_IX 0 // not used by PXE client
-#define OP_NETBIOS_NODE_TYPE_IX 0 // not used by PXE client
-#define OP_NETBIOS_SCOPE_IX 0 // not used by PXE client
-#define OP_XWINDOW_SYSTEM_FONT_SERVERS_IX 0 // not used by PXE client
-#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS_IX 0 // not used by PXE client
-// DHCP option indices
-//
-#define OP_DHCP_REQ_IP_ADD_IX 0 // not used by PXE client
-#define OP_DHCP_LEASE_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_OPTION_OVERLOAD_IX 4
-#define OP_DHCP_MESSAGE_TYPE_IX 5
-#define OP_DHCP_SERVER_IP_IX 6
-#define OP_DHCP_PARM_REQ_LIST_IX 0 // not used by PXE client
-#define OP_DHCP_ERROR_MESSAGE_IX 0 // not used by PXE client
-#define OP_DHCP_MAX_MESSAGE_SZ_IX 0 // not used by PXE client
-#define OP_DHCP_RENEWAL_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_REBINDING_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_CLASS_IDENTIFIER_IX 7
-#define OP_DHCP_CLIENT_IDENTIFIER_IX 0 // not used by PXE client
-#define OP_RESERVED62_IX 0 // not used by PXE client
-#define OP_RESERVED63_IX 0 // not used by PXE client
-#define OP_NISPLUS_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_NISPLUS_SERVERS_IX 0 // not used by PXE client
-#define OP_DHCP_TFTP_SERVER_NAME_IX 0 // not used by PXE client
-#define OP_DHCP_BOOTFILE_IX 8
-
-#define MAX_OUR_OPT OP_DHCP_BOOTFILE // largest option in which we are interested
-#define MAX_OUR_IX OP_BOOT_FILE_SZ_IX
-
-typedef struct {
- DHCPV4_OP_STRUCT *PktOptAdds[MAX_OUR_IX];
- DHCPV4_OP_STRUCT *PxeOptAdds[MAX_OUR_PXE_IX];
- UINT8 Status;
-} OPTION_POINTERS;
-
-typedef struct DhcpReceiveBufferStruct {
- union {
- UINT8 ReceiveBuffer[MAX_DHCP_MSG_SZ];
- DHCPV4_STRUCT Dhcpv4;
- } u;
-
- OPTION_POINTERS OpAdds;
-} DHCP_RECEIVE_BUFFER;
-
-#define PXE_TYPE (1 << 0)
-#define WfM11a_TYPE (1 << 1)
-#define DISCOVER_TYPE (1 << 2)
-#define CREDENTIALS_TYPE (1 << 3)
-#define USE_THREE_BYTE (1 << 4)
-
-#endif // _DHCP_H
-
-/* EOF - dhcp.h */
+/** @file
+
+Copyright (c) 2004, 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.
+
+
+**/
+
+#ifndef _DHCP_H
+#define _DHCP_H
+
+//
+// Definitions for DHCP version 4 UDP packet.
+// The field names in this structure are defined and described in RFC 2131.
+//
+#pragma pack(1)
+
+typedef struct {
+ UINT8 op;
+#define BOOTP_REQUEST 1
+#define BOOTP_REPLY 2
+
+ UINT8 htype;
+ UINT8 hlen;
+ UINT8 hops;
+ UINT32 xid;
+ UINT16 secs;
+ UINT16 flags;
+#define DHCP_BROADCAST_FLAG 0x8000
+
+ UINT32 ciaddr;
+ UINT32 yiaddr;
+ UINT32 siaddr;
+ UINT32 giaddr;
+ UINT8 chaddr[16];
+ UINT8 sname[64];
+ UINT8 file[128];
+ UINT8 options[312];
+#define OP_PAD 0
+#define OP_END 255
+#define OP_SUBNET_MASK 1
+#define OP_TIME_OFFSET 2
+#define OP_ROUTER_LIST 3
+#define OP_TIME_SERVERS 4
+#define OP_NAME_SERVERS 5
+#define OP_DNS_SERVERS 6
+#define OP_LOG_SERVERS 7
+#define OP_COOKIE_SERVERS 8
+#define OP_LPR_SREVERS 9
+#define OP_IMPRESS_SERVERS 10
+#define OP_RES_LOC_SERVERS 11
+#define OP_HOST_NAME 12
+#define OP_BOOT_FILE_SZ 13
+#define OP_DUMP_FILE 14
+#define OP_DOMAIN_NAME 15
+#define OP_SWAP_SERVER 16
+#define OP_ROOT_PATH 17
+#define OP_EXTENSION_PATH 18
+#define OP_IP_FORWARDING 19
+#define OP_NON_LOCAL_SRC_RTE 20
+#define OP_POLICY_FILTER 21
+#define OP_MAX_DATAGRAM_SZ 22
+#define OP_DEFAULT_TTL 23
+#define OP_MTU_AGING_TIMEOUT 24
+#define OP_MTU_SIZES 25
+#define OP_MTU_TO_USE 26
+#define OP_ALL_SUBNETS_LOCAL 27
+#define OP_BROADCAST_ADD 28
+#define OP_PERFORM_MASK_DISCOVERY 29
+#define OP_RESPOND_TO_MASK_REQ 30
+#define OP_PERFORM_ROUTER_DISCOVERY 31
+#define OP_ROUTER_SOLICIT_ADDRESS 32
+#define OP_STATIC_ROUTER_LIST 33
+#define OP_USE_ARP_TRAILERS 34
+#define OP_ARP_CACHE_TIMEOUT 35
+#define OP_ETHERNET_ENCAPSULATION 36
+#define OP_TCP_DEFAULT_TTL 37
+#define OP_TCP_KEEP_ALIVE_INT 38
+#define OP_KEEP_ALIVE_GARBAGE 39
+#define OP_NIS_DOMAIN_NAME 40
+#define OP_NIS_SERVERS 41
+#define OP_NTP_SERVERS 42
+#define OP_VENDOR_SPECIFIC 43
+#define VEND_PXE_MTFTP_IP 1
+#define VEND_PXE_MTFTP_CPORT 2
+#define VEND_PXE_MTFTP_SPORT 3
+#define VEND_PXE_MTFTP_TMOUT 4
+#define VEND_PXE_MTFTP_DELAY 5
+#define VEND_PXE_DISCOVERY_CONTROL 6
+#define PXE_DISABLE_BROADCAST_DISCOVERY (1 << 0)
+#define PXE_DISABLE_MULTICAST_DISCOVERY (1 << 1)
+#define PXE_ACCEPT_ONLY_PXE_BOOT_SERVERS (1 << 2)
+#define PXE_DO_NOT_PROMPT (1 << 3)
+#define VEND_PXE_DISCOVERY_MCAST_ADDR 7
+#define VEND_PXE_BOOT_SERVERS 8
+#define VEND_PXE_BOOT_MENU 9
+#define VEND_PXE_BOOT_PROMPT 10
+#define VEND_PXE_MCAST_ADDRS_ALLOC 11
+#define VEND_PXE_CREDENTIAL_TYPES 12
+#define VEND_PXE_BOOT_ITEM 71
+#define OP_NBNS_SERVERS 44
+#define OP_NBDD_SERVERS 45
+#define OP_NETBIOS_NODE_TYPE 46
+#define OP_NETBIOS_SCOPE 47
+#define OP_XWINDOW_SYSTEM_FONT_SERVERS 48
+#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
+#define OP_DHCP_REQ_IP_ADD 50
+#define OP_DHCP_LEASE_TIME 51
+#define OP_DHCP_OPTION_OVERLOAD 52
+#define OVLD_FILE 1
+#define OVLD_SRVR_NAME 2
+#define OP_DHCP_MESSAGE_TYPE 53
+#define DHCPDISCOVER 1
+#define DHCPOFFER 2
+#define DHCPREQUEST 3
+#define DHCPDECLINE 4
+#define DHCPACK 5
+#define DHCPNAK 6
+#define DHCPRELEASE 7
+#define DHCPINFORM 8
+#define OP_DHCP_SERVER_IP 54
+#define OP_DHCP_PARM_REQ_LIST 55
+#define OP_DHCP_ERROR_MESSAGE 56
+#define OP_DHCP_MAX_MESSAGE_SZ 57
+#define OP_DHCP_RENEWAL_TIME 58
+#define OP_DHCP_REBINDING_TIME 59
+#define OP_DHCP_CLASS_IDENTIFIER 60
+#define OP_DHCP_CLIENT_IDENTIFIER 61
+#define OP_NISPLUS_DOMAIN_NAME 64
+#define OP_NISPLUS_SERVERS 65
+#define OP_DHCP_TFTP_SERVER_NAME 66
+#define OP_DHCP_BOOTFILE 67
+#define OP_MOBILE_IP_HOME_AGENTS 68
+#define OP_SMPT_SERVERS 69
+#define OP_POP3_SERVERS 70
+#define OP_NNTP_SERVERS 71
+#define OP_WWW_SERVERS 72
+#define OP_FINGER_SERVERS 73
+#define OP_IRC_SERVERS 74
+#define OP_STREET_TALK_SERVERS 75
+#define OP_STREET_TALK_DIR_ASSIST_SERVERS 76
+#define OP_NDS_SERVERS 85
+#define OP_NDS_TREE_NAME 86
+#define OP_NDS_CONTEXT 87
+#define OP_DHCP_SYSTEM_ARCH 93
+#define OP_DHCP_NETWORK_ARCH 94
+#define OP_DHCP_PLATFORM_ID 97
+} DHCPV4_STRUCT;
+
+//
+// DHCPv4 option header
+//
+typedef struct {
+ UINT8 OpCode;
+ UINT8 Length;
+ //
+ // followed by Data[]
+ //
+} DHCPV4_OP_HEADER;
+
+//
+// Generic DHCPv4 option (header followed by data)
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Data[1];
+} DHCPV4_OP_STRUCT;
+
+//
+// Maximum DHCP packet size on ethernet
+//
+#define MAX_DHCP_MSG_SZ (MAX_ENET_DATA_SIZE - sizeof (IPV4_HEADER) - sizeof (UDPV4_HEADER))
+
+//
+// Macros used in pxe_bc_dhcp.c and pxe_loadfile.c
+//
+#define DHCPV4_TRANSMIT_BUFFER (*(DHCPV4_STRUCT *) (Private->TransmitBuffer))
+#define DHCPV4_OPTIONS_BUFFER (*(struct optionsstr *) DHCPV4_TRANSMIT_BUFFER.options)
+
+#define DHCPV4_ACK_INDEX 0
+#define PXE_BINL_INDEX 1
+#define PXE_OFFER_INDEX 1
+#define PXE_ACK_INDEX 2
+#define PXE_BIS_INDEX 3
+
+#define DHCPV4_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[DHCPV4_ACK_INDEX]
+#define PXE_BINL_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BINL_INDEX]
+#define PXE_OFFER_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_OFFER_INDEX]
+#define PXE_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_ACK_INDEX]
+#define PXE_BIS_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BIS_INDEX]
+
+#define DHCPV4_ACK_PACKET DHCPV4_ACK_BUFFER.u.Dhcpv4
+#define PXE_BINL_PACKET PXE_BINL_BUFFER.u.Dhcpv4
+#define PXE_OFFER_PACKET PXE_OFFER_BUFFER.u.Dhcpv4
+#define PXE_ACK_PACKET PXE_ACK_BUFFER.u.Dhcpv4
+#define PXE_BIS_PACKET PXE_BIS_BUFFER.u.Dhcpv4
+
+//
+// network structure definitions
+//
+//
+// some option definitions
+//
+#define DHCPV4_OPTION_LENGTH(type) (sizeof (type) - sizeof (DHCPV4_OP_HEADER))
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Type;
+} DHCPV4_OP_MESSAGE_TYPE;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Overload;
+} DHCPV4_OP_OVERLOAD;
+
+//
+// boot server list structure
+// one or more contained in a pxe boot servers structure
+//
+typedef struct {
+ UINT8 IpCount;
+ EFI_IPv4_ADDRESS IpList[1]; // IP count of IPs
+} PXEV4_SERVER_LIST;
+
+typedef struct {
+ UINT8 IpCount;
+ EFI_IPv6_ADDRESS IpList[1]; // IP count of IPs
+} PXEV6_SERVER_LIST;
+
+typedef union {
+ PXEV4_SERVER_LIST Ipv4List;
+ PXEV6_SERVER_LIST Ipv6List;
+} PXE_SERVER_LISTS;
+
+typedef struct {
+ UINT16 Type;
+ PXE_SERVER_LISTS u;
+} PXE_SERVER_LIST;
+
+//
+// pxe boot servers structure
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ PXE_SERVER_LIST ServerList[1]; // one or more
+} PXE_OP_SERVER_LIST;
+
+//
+// pxe boot item structure
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT16 Type;
+ UINT16 Layer;
+} PXE_OP_BOOT_ITEM;
+
+//
+// pxe boot menu item structure
+//
+typedef struct {
+ UINT16 Type;
+ UINT8 DataLen;
+ UINT8 Data[1];
+} PXE_BOOT_MENU_ENTRY;
+
+//
+// pxe boot menu structure
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ PXE_BOOT_MENU_ENTRY MenuItem[1];
+} PXE_OP_BOOT_MENU;
+
+//
+// pxe boot prompt structure
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Timeout;
+ UINT8 Prompt[1];
+} PXE_OP_BOOT_PROMPT;
+
+#define PXE_BOOT_PROMPT_AUTO_SELECT 0
+#define PXE_BOOT_PROMPT_NO_TIMEOUT 255
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Class[1];
+} DHCPV4_OP_CLASS;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 File[1];
+} DHCPV4_OP_BOOTFILE;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 VendorOptions[1];
+} DHCPV4_OP_VENDOR_OPTIONS;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 MaxSize[2];
+} DHCPV4_OP_MAX_MESSAGE_SIZE;
+
+typedef struct {
+ UINT8 _OP_SUBNET_MASK; /* 1 */
+ UINT8 _OP_TIME_OFFSET; /* 2 */
+ UINT8 _OP_ROUTER_LIST; /* 3 */
+ UINT8 _OP_TIME_SERVERS; /* 4 */
+ UINT8 _OP_NAME_SERVERS; /* 5 */
+ UINT8 _OP_DNS_SERVERS; /* 6 */
+ UINT8 _OP_HOST_NAME; /* 12 */
+ UINT8 _OP_BOOT_FILE_SZ; /* 13 */
+ UINT8 _OP_DOMAIN_NAME; /* 15 */
+ UINT8 _OP_ROOT_PATH; /* 17 */
+ UINT8 _OP_EXTENSION_PATH; /* 18 */
+ UINT8 _OP_MAX_DATAGRAM_SZ; /* 22 */
+ UINT8 _OP_DEFAULT_TTL; /* 23 */
+ UINT8 _OP_BROADCAST_ADD; /* 28 */
+ UINT8 _OP_NIS_DOMAIN_NAME; /* 40 */
+ UINT8 _OP_NIS_SERVERS; /* 41 */
+ UINT8 _OP_NTP_SERVERS; /* 42 */
+ UINT8 _OP_VENDOR_SPECIFIC; /* 43 */
+ UINT8 _OP_DHCP_REQ_IP_ADD; /* 50 */
+ UINT8 _OP_DHCP_LEASE_TIME; /* 51 */
+ UINT8 _OP_DHCP_SERVER_IP; /* 54 */
+ UINT8 _OP_DHCP_RENEWAL_TIME; /* 58 */
+ UINT8 _OP_DHCP_REBINDING_TIME; /* 59 */
+ UINT8 _OP_DHCP_CLASS_IDENTIFIER; /* 60 */
+ UINT8 _OP_DHCP_TFTP_SERVER_NAME; /* 66 */
+ UINT8 _OP_DHCP_BOOTFILE; /* 67 */
+ UINT8 _OP_DHCP_PLATFORM_ID; /* 97 */
+ UINT8 VendorOption128; // vendor option 128
+ UINT8 VendorOption129; // vendor option 129
+ UINT8 VendorOption130; // vendor option 130
+ UINT8 VendorOption131; // vendor option 131
+ UINT8 VendorOption132; // vendor option 132
+ UINT8 VendorOption133; // vendor option 133
+ UINT8 VendorOption134; // vendor option 134
+ UINT8 VendorOption135; // vendor option 135
+} DHCPV4_REQUESTED_OPTIONS_DATA;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ DHCPV4_REQUESTED_OPTIONS_DATA Data;
+} DHCPV4_OP_REQUESTED_OPTIONS;
+
+typedef struct opipstr {
+ DHCPV4_OP_HEADER Header;
+ EFI_IPv4_ADDRESS Ip;
+} DHCPV4_OP_IP_ADDRESS;
+
+//
+// ip list structure - e.g. router list
+//
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ EFI_IPv4_ADDRESS IpList[1];
+} DHCPV4_OP_IP_LIST;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Type;
+ UINT8 Guid[sizeof (EFI_GUID)];
+} DHCPV4_OP_CLIENT_ID;
+
+//
+// special options start - someday obsolete ???
+//
+#define DHCPV4_OP_PLATFORM_ID DHCPV4_OP_CLIENT_ID
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT8 Type; // SNP = 2
+ UINT8 MajorVersion;
+ UINT8 MinorVersion;
+} DHCPV4_OP_NETWORK_INTERFACE;
+
+#define UNDI_TYPE 1
+#define SNP_TYPE 2
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ UINT16 Type;
+} DHCPV4_OP_ARCHITECTURE_TYPE;
+//
+// special options end - someday obsolete ???
+//
+typedef struct {
+ UINT8 ClassIdentifier[10]; // PXEClient:
+ UINT8 Lit2[5]; // Arch:
+ UINT8 ArchitectureType[5]; // 00000 - 65536
+ UINT8 Lit3[1]; // :
+ UINT8 InterfaceName[4]; // e.g. UNDI
+ UINT8 Lit4[1]; // :
+ UINT8 UndiMajor[3]; // 000 - 255
+ UINT8 UndiMinor[3]; // 000 - 255
+} DHCPV4_CLASS_ID_DATA;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ DHCPV4_CLASS_ID_DATA Data;
+} DHCPV4_OP_CLASS_ID;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ EFI_IPv4_ADDRESS Ip;
+} DHCPV4_OP_REQUESTED_IP;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ EFI_IPv4_ADDRESS Ip;
+} DHCPV4_OP_SERVER_IP;
+
+typedef struct {
+ DHCPV4_OP_HEADER Header;
+ EFI_IPv4_ADDRESS Ip;
+} DHCPV4_OP_SUBNET_MASK;
+
+typedef struct { // oppxedisctlstr {
+ DHCPV4_OP_HEADER Header;
+ UINT8 ControlBits;
+} PXE_OP_DISCOVERY_CONTROL;
+
+#define DISABLE_BCAST (1 << 0)
+#define DISABLE_MCAST (1 << 1)
+#define USE_ACCEPT_LIST (1 << 2)
+#define USE_BOOTFILE (1 << 3)
+
+#pragma pack()
+//
+// definitions of indices to populate option interest array
+//
+#define VEND_PXE_MTFTP_IP_IX 1 // multicast IP address of bootfile for MTFTP listen
+#define VEND_PXE_MTFTP_CPORT_IX 2 // UDP Port to monitor for MTFTP responses - Intel order
+#define VEND_PXE_MTFTP_SPORT_IX 3 // Server UDP Port for MTFTP open - Intel order
+#define VEND_PXE_MTFTP_TMOUT_IX 4 // Listen timeout - secs
+#define VEND_PXE_MTFTP_DELAY_IX 5 // Transmission timeout - secs
+#define VEND_PXE_DISCOVERY_CONTROL_IX 6 // bit field
+#define VEND_PXE_DISCOVERY_MCAST_ADDR_IX 7 // boot server discovery multicast address
+#define VEND_PXE_BOOT_SERVERS_IX 8 // list of boot servers of form tp(2) cnt(1) ips[cnt]
+#define VEND_PXE_BOOT_MENU_IX 9
+#define VEND_PXE_BOOT_PROMPT_IX 10
+#define VEND_PXE_MCAST_ADDRS_ALLOC_IX 0 // not used by PXE client
+#define VEND_PXE_CREDENTIAL_TYPES_IX 11
+#define VEND_13_IX 0 // not used by PXE client
+#define VEND_14_IX 0 // not used by PXE client
+#define VEND_15_IX 0 // not used by PXE client
+#define VEND_16_IX 0 // not used by PXE client
+#define VEND_17_IX 0 // not used by PXE client
+#define VEND_18_IX 0 // not used by PXE client
+#define VEND_19_IX 0 // not used by PXE client
+#define VEND_20_IX 0 // not used by PXE client
+#define VEND_21_IX 0 // not used by PXE client
+#define VEND_22_IX 0 // not used by PXE client
+#define VEND_23_IX 0 // not used by PXE client
+#define VEND_24_IX 0 // not used by PXE client
+#define VEND_25_IX 0 // not used by PXE client
+#define VEND_26_IX 0 // not used by PXE client
+#define VEND_27_IX 0 // not used by PXE client
+#define VEND_28_IX 0 // not used by PXE client
+#define VEND_29_IX 0 // not used by PXE client
+#define VEND_30_IX 0 // not used by PXE client
+#define VEND_31_IX 0 // not used by PXE client
+#define VEND_32_IX 0 // not used by PXE client
+#define VEND_33_IX 0 // not used by PXE client
+#define VEND_34_IX 0 // not used by PXE client
+#define VEND_35_IX 0 // not used by PXE client
+#define VEND_36_IX 0 // not used by PXE client
+#define VEND_37_IX 0 // not used by PXE client
+#define VEND_38_IX 0 // not used by PXE client
+#define VEND_39_IX 0 // not used by PXE client
+#define VEND_40_IX 0 // not used by PXE client
+#define VEND_41_IX 0 // not used by PXE client
+#define VEND_42_IX 0 // not used by PXE client
+#define VEND_43_IX 0 // not used by PXE client
+#define VEND_44_IX 0 // not used by PXE client
+#define VEND_45_IX 0 // not used by PXE client
+#define VEND_46_IX 0 // not used by PXE client
+#define VEND_47_IX 0 // not used by PXE client
+#define VEND_48_IX 0 // not used by PXE client
+#define VEND_49_IX 0 // not used by PXE client
+#define VEND_50_IX 0 // not used by PXE client
+#define VEND_51_IX 0 // not used by PXE client
+#define VEND_52_IX 0 // not used by PXE client
+#define VEND_53_IX 0 // not used by PXE client
+#define VEND_54_IX 0 // not used by PXE client
+#define VEND_55_IX 0 // not used by PXE client
+#define VEND_56_IX 0 // not used by PXE client
+#define VEND_57_IX 0 // not used by PXE client
+#define VEND_58_IX 0 // not used by PXE client
+#define VEND_59_IX 0 // not used by PXE client
+#define VEND_60_IX 0 // not used by PXE client
+#define VEND_61_IX 0 // not used by PXE client
+#define VEND_62_IX 0 // not used by PXE client
+#define VEND_63_IX 0 // not used by PXE client
+#define VEND_64_IX 0 // not used by PXE client
+#define VEND_65_IX 0 // not used by PXE client
+#define VEND_66_IX 0 // not used by PXE client
+#define VEND_67_IX 0 // not used by PXE client
+#define VEND_68_IX 0 // not used by PXE client
+#define VEND_69_IX 0 // not used by PXE client
+#define VEND_70_IX 0 // not used by PXE client
+#define VEND_PXE_BOOT_ITEM_IX 12
+
+#define MAX_OUR_PXE_OPT VEND_PXE_BOOT_ITEM // largest PXE option in which we are interested
+#define MAX_OUR_PXE_IX VEND_PXE_BOOT_ITEM_IX // largest PXE option index
+//
+// define various types by options that are sent
+//
+#define WfM11a_OPTS ((1<<VEND_PXE_MTFTP_IP_IX) | \
+ (1<<VEND_PXE_MTFTP_CPORT_IX) | \
+ (1<<VEND_PXE_MTFTP_SPORT_IX) | \
+ (1<<VEND_PXE_MTFTP_TMOUT_IX) | \
+ (1<<VEND_PXE_MTFTP_DELAY_IX))
+
+#define DISCOVER_OPTS ((1<<VEND_PXE_DISCOVERY_CONTROL_IX) | \
+ (1<<VEND_PXE_DISCOVERY_MCAST_ADDR_IX) | \
+ (1<<VEND_PXE_BOOT_SERVERS_IX) | \
+ (1<<VEND_PXE_BOOT_MENU_IX) | \
+ (1<<VEND_PXE_BOOT_PROMPT_IX) | \
+ (1<<VEND_PXE_BOOT_ITEM_IX))
+
+#define CREDENTIALS_OPT (1 << VEND_PXE_CREDENTIAL_TYPES_IX)
+
+//
+// definitions of indices to populate option interest array
+//
+#define OP_SUBNET_MASK_IX 1
+#define OP_TIME_OFFSET_IX 0 // not used by PXE client
+#define OP_ROUTER_LIST_IX 2
+#define OP_TIME_SERVERS_IX 0 // not used by PXE client
+#define OP_NAME_SERVERS_IX 0 // not used by PXE client
+#define OP_DNS_SERVERS_IX 0 // not used by PXE client
+#define OP_LOG_SERVERS_IX 0 // not used by PXE client
+#define OP_COOKIE_SERVERS_IX 0 // not used by PXE client
+#define OP_LPR_SREVERS_IX 0 // not used by PXE client
+#define OP_IMPRESS_SERVERS_IX 0 // not used by PXE client
+#define OP_RES_LOC_SERVERS_IX 0 // not used by PXE client
+#define OP_HOST_NAME_IX 0 // not used by PXE client
+#define OP_BOOT_FILE_SZ_IX 9
+#define OP_DUMP_FILE_IX 0 // not used by PXE client
+#define OP_DOMAIN_NAME_IX 0 // not used by PXE client
+#define OP_SWAP_SERVER_IX 0 // not used by PXE client
+#define OP_ROOT_PATH_IX 0 // not used by PXE client
+#define OP_EXTENSION_PATH_IX 0 // not used by PXE client
+#define OP_IP_FORWARDING_IX 0 // not used by PXE client
+#define OP_NON_LOCAL_SRC_RTE_IX 0 // not used by PXE client
+#define OP_POLICY_FILTER_IX 0 // not used by PXE client
+#define OP_MAX_DATAGRAM_SZ_IX 0 // not used by PXE client
+#define OP_DEFAULT_TTL_IX 0 // not used by PXE client
+#define OP_MTU_AGING_TIMEOUT_IX 0 // not used by PXE client
+#define OP_MTU_SIZES_IX 0 // not used by PXE client
+#define OP_MTU_TO_USE_IX 0 // not used by PXE client
+#define OP_ALL_SUBNETS_LOCAL_IX 0 // not used by PXE client
+#define OP_BROADCAST_ADD_IX 0 // not used by PXE client
+#define OP_PERFORM_MASK_DISCOVERY_IX 0 // not used by PXE client
+#define OP_RESPOND_TO_MASK_REQ_IX 0 // not used by PXE client
+#define OP_PERFORM_ROUTER_DISCOVERY_IX 0 // not used by PXE client
+#define OP_ROUTER_SOLICIT_ADDRESS_IX 0 // not used by PXE client
+#define OP_STATIC_ROUTER_LIST_IX 0 // not used by PXE client
+#define OP_USE_ARP_TRAILERS_IX 0 // not used by PXE client
+#define OP_ARP_CACHE_TIMEOUT_IX 0 // not used by PXE client
+#define OP_ETHERNET_ENCAPSULATION_IX 0 // not used by PXE client
+#define OP_TCP_DEFAULT_TTL_IX 0 // not used by PXE client
+#define OP_TCP_KEEP_ALIVE_INT_IX 0 // not used by PXE client
+#define OP_KEEP_ALIVE_GARBAGE_IX 0 // not used by PXE client
+#define OP_NIS_DOMAIN_NAME_IX 0 // not used by PXE client
+#define OP_NIS_SERVERS_IX 0 // not used by PXE client
+#define OP_NTP_SERVERS_IX 0 // not used by PXE client
+#define OP_VENDOR_SPECIFIC_IX 3
+#define OP_NBNS_SERVERS_IX 0 // not used by PXE client
+#define OP_NBDD_SERVERS_IX 0 // not used by PXE client
+#define OP_NETBIOS_NODE_TYPE_IX 0 // not used by PXE client
+#define OP_NETBIOS_SCOPE_IX 0 // not used by PXE client
+#define OP_XWINDOW_SYSTEM_FONT_SERVERS_IX 0 // not used by PXE client
+#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS_IX 0 // not used by PXE client
+// DHCP option indices
+//
+#define OP_DHCP_REQ_IP_ADD_IX 0 // not used by PXE client
+#define OP_DHCP_LEASE_TIME_IX 0 // not used by PXE client
+#define OP_DHCP_OPTION_OVERLOAD_IX 4
+#define OP_DHCP_MESSAGE_TYPE_IX 5
+#define OP_DHCP_SERVER_IP_IX 6
+#define OP_DHCP_PARM_REQ_LIST_IX 0 // not used by PXE client
+#define OP_DHCP_ERROR_MESSAGE_IX 0 // not used by PXE client
+#define OP_DHCP_MAX_MESSAGE_SZ_IX 0 // not used by PXE client
+#define OP_DHCP_RENEWAL_TIME_IX 0 // not used by PXE client
+#define OP_DHCP_REBINDING_TIME_IX 0 // not used by PXE client
+#define OP_DHCP_CLASS_IDENTIFIER_IX 7
+#define OP_DHCP_CLIENT_IDENTIFIER_IX 0 // not used by PXE client
+#define OP_RESERVED62_IX 0 // not used by PXE client
+#define OP_RESERVED63_IX 0 // not used by PXE client
+#define OP_NISPLUS_DOMAIN_NAME_IX 0 // not used by PXE client
+#define OP_NISPLUS_SERVERS_IX 0 // not used by PXE client
+#define OP_DHCP_TFTP_SERVER_NAME_IX 0 // not used by PXE client
+#define OP_DHCP_BOOTFILE_IX 8
+
+#define MAX_OUR_OPT OP_DHCP_BOOTFILE // largest option in which we are interested
+#define MAX_OUR_IX OP_BOOT_FILE_SZ_IX
+
+typedef struct {
+ DHCPV4_OP_STRUCT *PktOptAdds[MAX_OUR_IX];
+ DHCPV4_OP_STRUCT *PxeOptAdds[MAX_OUR_PXE_IX];
+ UINT8 Status;
+} OPTION_POINTERS;
+
+typedef struct DhcpReceiveBufferStruct {
+ union {
+ UINT8 ReceiveBuffer[MAX_DHCP_MSG_SZ];
+ DHCPV4_STRUCT Dhcpv4;
+ } u;
+
+ OPTION_POINTERS OpAdds;
+} DHCP_RECEIVE_BUFFER;
+
+#define PXE_TYPE (1 << 0)
+#define WfM11a_TYPE (1 << 1)
+#define DISCOVER_TYPE (1 << 2)
+#define CREDENTIALS_TYPE (1 << 3)
+#define USE_THREE_BYTE (1 << 4)
+
+#endif // _DHCP_H
+
+/* EOF - dhcp.h */
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Ebc/PxeArch.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Ebc/PxeArch.h
index 0db856b163..89350674b1 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Ebc/PxeArch.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Ebc/PxeArch.h
@@ -1,36 +1,36 @@
-/** @file
-
-Copyright (c) 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:
- PxeArch.h
-
-Abstract:
- Defines PXE Arch type
-
-
-**/
-
-#ifndef _EFI_PXE_ARCH_H_
-#define _EFI_PXE_ARCH_H_
-
-//
-// warning #175: subscript out of range
-//
-#pragma warning (disable: 175)
-
-#define SYS_ARCH GetSysArch()
-
-UINT16
-GetSysArch (
- VOID
- );
-
-#endif
+/** @file
+
+Copyright (c) 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:
+ PxeArch.h
+
+Abstract:
+ Defines PXE Arch type
+
+
+**/
+
+#ifndef _EFI_PXE_ARCH_H_
+#define _EFI_PXE_ARCH_H_
+
+//
+// warning #175: subscript out of range
+//
+#pragma warning (disable: 175)
+
+#define SYS_ARCH GetSysArch()
+
+UINT16
+GetSysArch (
+ VOID
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Hton.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Hton.h
index c4ace49e78..1da5624900 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Hton.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Hton.h
@@ -1,43 +1,43 @@
-/** @file
-
-Copyright (c) 2004, 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:
- hton.h
-
-Abstract:
- Byte swapping macros.
-
-
-**/
-
-#ifndef _HTON_H_
-#define _HTON_H_
-
-//
-// Only Intel order functions are defined at this time.
-//
-#define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
-
-#define HTONL(v) \
- (UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
-
-#define HTONLL(v) swap64 (v)
-
-#define U8PTR(na) ((UINT8 *) &(na))
-
-#define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
-
-#define NTOHL(ns) \
- ((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
-
-#endif /* _HTON_H_ */
-
-/* EOF - hton.h */
+/** @file
+
+Copyright (c) 2004, 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:
+ hton.h
+
+Abstract:
+ Byte swapping macros.
+
+
+**/
+
+#ifndef _HTON_H_
+#define _HTON_H_
+
+//
+// Only Intel order functions are defined at this time.
+//
+#define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
+
+#define HTONL(v) \
+ (UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
+
+#define HTONLL(v) swap64 (v)
+
+#define U8PTR(na) ((UINT8 *) &(na))
+
+#define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
+
+#define NTOHL(ns) \
+ ((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
+
+#endif /* _HTON_H_ */
+
+/* EOF - hton.h */
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Ia32/PxeArch.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Ia32/PxeArch.h
index cc878d8dd7..d032f62a91 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Ia32/PxeArch.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Ia32/PxeArch.h
@@ -1,26 +1,26 @@
-/** @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:
- PxeArch.h
-
-Abstract:
- Defines PXE Arch type
-
-
-**/
-
-#ifndef _EFI_PXE_ARCH_H_
-#define _EFI_PXE_ARCH_H_
-
-#define SYS_ARCH 0x6
-
-#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:
+ PxeArch.h
+
+Abstract:
+ Defines PXE Arch type
+
+
+**/
+
+#ifndef _EFI_PXE_ARCH_H_
+#define _EFI_PXE_ARCH_H_
+
+#define SYS_ARCH 0x6
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Ip.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Ip.h
index a482eb9cd9..84ffd75bd6 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Ip.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Ip.h
@@ -1,736 +1,736 @@
-/** @file
-
-Copyright (c) 2004 - 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.
-
-
-**/
-
-#ifndef _IP_H_
-#define _IP_H_
-
-#include "hton.h"
-
-//
-// portability macros
-//
-#define UDP_FILTER_MASK (EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER \
- )
-
-#define PXE_BOOT_LAYER_MASK 0x7FFF
-#define PXE_BOOT_LAYER_INITIAL 0x0000
-#define PXE_BOOT_LAYER_CREDENTIAL_FLAG 0x8000
-#define MAX_BOOT_SERVERS 32
-
-//
-// macro to evaluate IP address as TRUE if it is a multicast IP address
-//
-#define IS_MULTICAST(ptr) ((*((UINT8 *) ptr) & 0xf0) == 0xe0)
-
-//
-// length macros
-//
-#define IP_ADDRESS_LENGTH(qp) (((qp)->UsingIpv6) ? sizeof (EFI_IPv6_ADDRESS) : sizeof (EFI_IPv4_ADDRESS))
-
-#define MAX_FRAME_DATA_SIZE 1488
-#define ALLOCATE_SIZE(X) (((X) + 7) & 0xfff8)
-#define MODE_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_MODE))
-#define BUFFER_ALLOCATE_SIZE (8192 + 512)
-#define ROUTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ROUTE_ENTRY) * PXE_ROUTER_TABLE_SIZE))
-#define ARP_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ARP_ENTRY) * PXE_ARP_CACHE_SIZE))
-#define FILTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_IP_ADDRESS) * PXE_IP_FILTER_SIZE))
-#define PXE_ARP_CACHE_SIZE 8
-#define PXE_ROUTER_TABLE_SIZE 8
-#define PXE_IP_FILTER_SIZE 8
-#define ICMP_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR))
-#define TFTP_ERR_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_TFTP_ERROR))
-
-//
-// DHCP discover/request packets are sent to this UDP port. ProxyDHCP
-// servers listen on this port for DHCP discover packets that have a
-// class identifier (option 60) with 'PXEClient' in the first 9 bytes.
-// Bootservers also listen on this port for PXE broadcast discover
-// requests from PXE clients.
-//
-#define DHCP_SERVER_PORT 67
-
-//
-// When DHCP, proxyDHCP and Bootservers respond to DHCP and PXE broadcast
-// discover requests by broadcasting the reply packet, the packet is
-// broadcast to this port.
-//
-#define DHCP_CLIENT_PORT 68
-
-//
-// TFTP servers listen for TFTP open requests on this port.
-//
-#define TFTP_OPEN_PORT 69
-
-//
-// proxyDHCP and Bootservers listen on this port for a PXE unicast and/or
-// multicast discover requests from PXE clients. A PXE discover request
-// looks like a DHCP discover or DHCP request packet.
-//
-#define PXE_DISCOVERY_PORT 4011
-
-//
-// This port is used by the PXE client/server protocol tests.
-//
-#define PXE_PORT_PXETEST_PORT 0x8080
-
-//
-// Definitions for Ethertype protocol numbers and interface types
-// Per RFC 1700,
-//
-#define PXE_PROTOCOL_ETHERNET_IP 0x0800
-#define PXE_PROTOCOL_ETHERNET_ARP 0x0806
-#define PXE_PROTOCOL_ETHERNET_RARP 0x8035
-
-#define PXE_IFTYPE_ETHERNET 0x01
-#define PXE_IFTYPE_TOKENRING 0x04
-#define PXE_IFTYPE_FIBRE_CHANNEL 0x12
-
-//
-// Definitions for internet protocol version 4 header
-// Per RFC 791, September 1981.
-//
-#define IPVER4 4
-
-#pragma pack(1) // make network structures packed byte alignment
-typedef union {
- UINT8 B[4];
- UINT32 L;
-} IPV4_ADDR;
-
-#define IPV4_HEADER_LENGTH(IpHeaderPtr) (((IpHeaderPtr)->VersionIhl & 0xf) << 2)
-
-#define SET_IPV4_VER_HDL(IpHeaderPtr, IpHeaderLen) { \
- (IpHeaderPtr)->VersionIhl = (UINT8) ((IPVER4 << 4) | ((IpHeaderLen) >> 2)); \
- }
-
-typedef struct {
- UINT8 VersionIhl;
- UINT8 TypeOfService;
- UINT16 TotalLength;
- UINT16 Id;
- UINT16 FragmentFields;
- UINT8 TimeToLive;
- UINT8 Protocol;
- UINT16 HeaderChecksum;
- IPV4_ADDR SrcAddr;
- IPV4_ADDR DestAddr;
- //
- // options are not implemented
- //
-} IPV4_HEADER;
-
-#define IP_FRAG_RSVD 0x8000 // reserved bit - must be zero
-#define IP_NO_FRAG 0x4000 // do not fragment bit
-#define IP_MORE_FRAG 0x2000 // not last fragment
-#define IP_FRAG_OFF_MSK 0x1fff // fragment offset in 8 byte chunks
-#define DEFAULT_RFC_TTL 64
-
-#define PROT_ICMP 1
-#define PROT_IGMP 2
-#define PROT_TCP 6
-#define PROT_UDP 17
-
-/*
- * Definitions for internet control message protocol version 4 message
- * structure. Per RFC 792, September 1981.
- */
-
-//
-// icmp header for all icmp messages
-//
-typedef struct {
- UINT8 Type; // message type
- UINT8 Code; // type specific - 0 for types we implement
- UINT16 Checksum; // ones complement of ones complement sum of 16 bit words of message
-} ICMPV4_HEADER;
-
-#define ICMP_DEST_UNREACHABLE 3
-#define ICMP_SOURCE_QUENCH 4
-#define ICMP_REDIRECT 5
-#define ICMP_ECHO 8
-#define ICMP_ECHO_REPLY 0
-#define ICMP_ROUTER_ADV 9
-#define ICMP_ROUTER_SOLICIT 10
-#define ICMP_TIME_EXCEEDED 11
-#define ICMP_PARAMETER_PROBLEM 12
-#define ICMP_TIMESTAMP 13
-#define ICMP_TIMESTAMP_REPLY 14
-#define ICMP_INFO_REQ 15
-#define ICMP_INFO_REQ_REPLY 16
-#define ICMP_SUBNET_MASK_REQ 17
-#define ICMP_SUBNET_MASK_REPLY 18
-//
-// other ICMP message types ignored in this implementation
-//
-// icmp general messages
-//
-typedef struct {
- ICMPV4_HEADER Header;
- //
- // generally unused except byte [0] for
- // parameter problem message
- //
- UINT8 GenerallyUnused[4];
- //
- // original message ip header of plus 64
- // bits of data
- //
- IPV4_HEADER IpHeader;
-} ICMPV4_GENERAL_MESSAGE;
-
-//
-// icmp req/rply message header
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT16 Id;
- UINT16 SequenceNumber;
-} ICMPV4_REQUEST_REPLY_HEADER;
-
-//
-// icmp echo message
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
- UINT8 EchoData[1]; // variable length data to be echoed
-} ICMPV4_ECHO_MESSAGE;
-
-//
-// icmp timestamp message - times are milliseconds since midnight UT -
-// if non std, set high order bit
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
- UINT32 OriginalTime; // originating timestamp
- UINT32 ReceiveTime; // receiving timestamp
- UINT32 TransmitTime; // transmitting timestamp
-} ICMPV4_TIMESTAMP_MESSAGE;
-
-//
-// icmp info request structure - fill in source and dest net ip address on reply
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
-} ICMPV4_INFO_MESSAGE;
-
-//
-// Definitions for internet control message protocol version 4 message structure
-// Router discovery
-// Per RFC 1256, September 1991.
-//
-//
-// icmp router advertisement message
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT8 NumberEntries; // number of address entries
- UINT8 EntrySize; // number of 32 bit words per address entry
- UINT16 Lifetime; // seconds to consider info valid
- UINT32 RouterIp;
- UINT32 Preferance;
-} ICMPV4_ROUTER_ADVERTISE_MESSAGE;
-
-//
-// icmp router solicitation message
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT32 Reserved;
-} ICMPV4_ROUTER_SOLICIT_MESSAGE;
-
-#define MAX_SOLICITATION_DELAY 1 // 1 second
-#define SOLICITATION_INTERVAL 3 // 3 seconds
-#define MAX_SOLICITATIONS 3 // 3 transmissions
-#define V1ROUTER_PRESENT_TIMEOUT 400 // 400 second timeout until v2 reports can be sent
-#define UNSOLICITED_REPORT_INTERVAL 10 // 10 seconds between unsolicited reports
-#define BROADCAST_IPv4 0xffffffff
-
-//
-// Definitions for address resolution protocol message structure
-// Per RFC 826, November 1982
-//
-typedef struct {
- UINT16 HwType; // hardware type - e.g. ethernet (1)
- UINT16 ProtType; // protocol type - for ethernet, 0x800 for IP
- UINT8 HwAddLen; // byte length of a hardware address (e.g. 6 for ethernet)
- UINT8 ProtAddLen; // byte length of a protocol address (e.g. 4 for ipv4)
- UINT16 OpCode;
- //
- // source and dest hw and prot addresses follow - see example below
- //
-} ARP_HEADER;
-
-#define ETHERNET_ADD_SPC 1
-
-#define ETHER_TYPE_IP 0x800
-
-#define ARP_REQUEST 1
-#define ARP_REPLY 2
-
-//
-// generic ARP packet
-//
-typedef struct {
- ARP_HEADER ArpHeader;
- EFI_MAC_ADDRESS SrcHardwareAddr;
- EFI_IP_ADDRESS SrcProtocolAddr;
- EFI_MAC_ADDRESS DestHardwareAddr;
- EFI_IP_ADDRESS DestProtocolAddr;
-} ARP_PACKET;
-
-#define ENET_HWADDLEN 6
-#define IPV4_PROTADDLEN 4
-
-//
-// Definitions for user datagram protocol version 4 pseudo header & header
-// Per RFC 768, 28 August 1980
-//
-typedef struct {
- IPV4_ADDR SrcAddr; // source ip address
- IPV4_ADDR DestAddr; // dest ip address
- UINT8 Zero; // 0
- UINT8 Protocol; // protocol
- UINT16 TotalLength; // UDP length - sizeof udpv4hdr + data length
-} UDPV4_PSEUDO_HEADER;
-
-typedef struct {
- UINT16 SrcPort; // source port identifier
- UINT16 DestPort; // destination port identifier
- UINT16 TotalLength; // total length header plus data
- //
- // ones complement of ones complement sum of 16 bit
- // words of pseudo header, UDP header, and data
- // zero checksum is transmitted as -0 (ones comp)
- // zero transmitted means checksum not computed
- // data follows
- //
- UINT16 Checksum;
-} UDPV4_HEADER;
-
-typedef struct {
- UDPV4_PSEUDO_HEADER Udpv4PseudoHeader;
- UDPV4_HEADER Udpv4Header;
-} UDPV4_HEADERS;
-
-//
-// Definitions for transmission control protocol header
-// Per RFC 793, September, 1981
-//
-typedef struct {
- IPV4_ADDR SrcAddr; // source ip address
- IPV4_ADDR DestAddr; // dest ip address
- UINT8 Zero; // 0
- UINT8 Protocol; // protocol
- UINT16 TotalLength; // TCP length - TCP header length + data length
-} TCPV4_PSEUDO_HEADER;
-
-typedef struct {
- UINT16 SrcPort; // source port identifier
- UINT16 DestPort; // destination port identifier
- UINT32 SeqNumber; // Sequence number
- UINT32 AckNumber; // Acknowledgement Number
- //
- // Nibble of HLEN (length of header in 32-bit multiples)
- // 6bits of RESERVED
- // Nibble of Code Bits
- //
- UINT16 HlenResCode;
- UINT16 Window; // Software buffer size (sliding window size) in network-standard byte order
- //
- // ones complement of ones complement sum of 16 bit words of
- // pseudo header, TCP header, and data
- // zero checksum is transmitted as -0 (ones comp)
- // zero transmitted means checksum not computed
- //
- UINT16 Checksum;
- UINT16 UrgentPointer; // pointer to urgent data (allows sender to specify urgent data)
-} TCPV4_HEADER;
-
-typedef struct {
- TCPV4_PSEUDO_HEADER Tcpv4PseudoHeader;
- TCPV4_HEADER Tcpv4Header;
-} TCPV4_HEADERS;
-
-typedef struct {
- UINT8 Kind; // one of the following:
- UINT8 Length; // total option length including Kind and Lth
- UINT8 Data[1]; // length = Lth - 2
-} TCPV4_OPTION;
-
-#define TCP_OP_END 0 // only used to pad to end of TCP header
-#define TCP_NOP 1 // optional - may be used to pad between options to get alignment
-#define TCP_MAX_SEG 2 // maximum receive segment size - only send at initial connection request
-#define MAX_MEDIA_HDR_SIZE 64
-#define MIN_ENET_DATA_SIZE 64
-#define MAX_ENET_DATA_SIZE 1500 // temp def - make a network based var
-#define MAX_IPV4_PKT_SIZE 65535 // maximum IP packet size
-#define MAX_IPV4_DATA_SIZE (MAX_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
-#define MAX_IPV4_FRAME_DATA_SIZE (MAX_FRAME_DATA_SIZE - sizeof (IPV4_HEADER))
-#define REAS_IPV4_PKT_SIZE 576 // minimum IP packet size all IP host can handle
-#define REAS_IPV4_DATA_SIZE (REAS_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
-
-//
-//
-//
-typedef union {
- UINT8 Data[MAX_ENET_DATA_SIZE];
- ICMPV4_HEADER IcmpHeader;
- IGMPV2_MESSAGE IgmpMessage;
- struct {
- UDPV4_HEADER UdpHeader;
- UINT8 Data[1];
- } Udp;
- struct {
- TCPV4_HEADER TcpHeader;
- UINT8 Data[1];
- } Tcp;
-} PROTOCOL_UNION;
-
-//
-// out buffer structure
-//
-typedef struct {
- UINT8 MediaHeader[MAX_MEDIA_HDR_SIZE];
- IPV4_HEADER IpHeader;
- //
- // following union placement only valid if no option IP header
- //
- PROTOCOL_UNION u;
-} IPV4_BUFFER;
-
-typedef struct {
- IPV4_HEADER IpHeader;
- //
- // following union placement only valid if no option IP header
- //
- PROTOCOL_UNION u;
-} IPV4_STRUCT;
-
-#pragma pack() // reset to default
-
- ////////////////////////////////////////////////////////////
-//
-// BC IP Filter Routine
-//
-EFI_STATUS
-IpFilter (
- PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
- )
-;
-
-//
-// //////////////////////////////////////////////////////////////////////
-//
-// Udp Write Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpWrite (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIpPtr,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortptr,
- IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSizePtr,
- IN VOID *BufferPtr
- )
-;
-
-//
-// /////////////////////////////////////////////////////////////////////
-//
-// Udp Read Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpRead (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPorPtrt, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSizePtr,
- IN VOID *BufferPtr,
- IN EFI_EVENT TimeoutEvent
- )
-;
-
-VOID
-IgmpLeaveGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *
- )
-;
-
-VOID
-IgmpJoinGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *
- )
-;
-
-//
-// convert number to zero filled ascii value of length lth
-//
-VOID
-CvtNum (
- UINTN Number,
- UINT8 *BufferPtr,
- INTN BufferLen
- )
-;
-
-//
-// convert number to ascii string at ptr
-//
-VOID
-UtoA10 (
- UINTN Number,
- UINT8 *BufferPtr
- )
-;
-
-//
-// convert ascii numeric string to UINTN
-//
-UINTN
-AtoU (
- UINT8 *BufferPtr
- )
-;
-
-UINT64
-AtoU64 (
- UINT8 *BufferPtr
- )
-;
-
-//
-// calculate the internet checksum (RFC 1071)
-// return 16 bit ones complement of ones complement sum of 16 bit words
-//
-UINT16
-IpChecksum (
- UINT16 *MessagePtr,
- UINTN ByteLength
- )
-;
-
-//
-// do checksum on non contiguous header and data
-//
-UINT16
-IpChecksum2 (
- UINT16 *Header,
- UINTN HeaderLength,
- UINT16 *Message,
- UINTN MessageLength
- )
-;
-
-//
-// update checksum when only a single word changes
-//
-UINT16
-UpdateChecksum (
- UINT16 OldChecksum,
- UINT16 OldWord,
- UINT16 NewWord
- )
-;
-
-VOID
-SeedRandom (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 InitialSeed
- )
-;
-
-UINT16
-Random (
- IN PXE_BASECODE_DEVICE *Private
- )
-;
-
-EFI_STATUS
-SendPacket (
- PXE_BASECODE_DEVICE *Private,
- VOID *HeaderPtr,
- VOID *PacketPtr,
- INTN PacketLength,
- VOID *HardwareAddress,
- UINT16 MediaProtocol,
- IN EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-VOID
-HandleArpReceive (
- PXE_BASECODE_DEVICE *Private,
- ARP_PACKET *ArpPacketPtr,
- VOID *HeaderPtr
- )
-;
-
-VOID
-HandleIgmp (
- PXE_BASECODE_DEVICE *Private,
- IGMPV2_MESSAGE *IgmpMessageptr,
- UINTN IgmpMessageLen
- )
-;
-
-VOID
-IgmpCheckTimers (
- PXE_BASECODE_DEVICE *Private
- )
-; // poll when doing a receive
-// return hw add of IP and TRUE if available, otherwise FALSE
-//
-BOOLEAN
-GetHwAddr (
- IN PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ProtocolAddressPtr,
- EFI_MAC_ADDRESS *HardwareAddressPtr
- )
-;
-
-EFI_STATUS
-DoArp (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *ProtocolAddressPtr,
- OUT EFI_MAC_ADDRESS *HardwareAddressptr
- )
-;
-
-BOOLEAN
-OnSameSubnet (
- UINTN IpAddressLen,
- EFI_IP_ADDRESS *Ip1,
- EFI_IP_ADDRESS *Ip2,
- EFI_IP_ADDRESS *SubnetMask
- )
-;
-
-VOID
-IpAddRouter (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *RouterIp
- )
-;
-
-#define Ip4AddRouter(Private, Ipv4Ptr) IpAddRouter (Private, (EFI_IP_ADDRESS *) Ipv4Ptr)
-
-//
-// routine to send ipv4 packet
-// ipv4 + upper protocol header for length TotHdrLth in xmtbuf, ipv4 header length IpHdrLth
-// routine fills in ipv4hdr Ver_Hdl, TotLth, and Checksum, moves in Data, and gets dest MAC address
-//
-EFI_STATUS
-Ipv4Xmt (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIP,
- UINTN IpHeaderLen,
- UINTN TotalHeaderLen,
- VOID *Data,
- UINTN DataLen,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-//
-// send ipv4 packet with ipv4 option
-//
-EFI_STATUS
-Ipv4SendWOp (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIP,
- UINT8 *MessagePtr,
- UINTN MessageLth,
- UINT8 Protocol,
- UINT8 *Option,
- UINTN OptionLen,
- UINT32 DestIp,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-//
-// send MsgLth message at MsgPtr - higher level protocol header already in xmtbuf, length HdrSize
-//
-EFI_STATUS
-Ip4Send (
- IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
- IN UINTN MayFragment, //
- IN UINT8 Protocol, // protocol
- IN UINT32 SrcIp, // Source IP address
- IN UINT32 DestIp, // Destination IP address
- IN UINT32 GatewayIp, // used if not NULL and needed
- IN UINTN HeaderSize, // protocol header byte length
- IN UINT8 *MsgPtr, // pointer to data
- IN UINTN MsgLength
- )
-; // data byte length
-// receive up to MsgLth message into MsgPtr for protocol Prot
-// return message length, src/dest ips if select any, and pointer to protocol header
-//
-EFI_STATUS
-IpReceive (
- IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
- UINT16 OpFlags, // Flags to determine if filtering on IP addresses
- EFI_IP_ADDRESS *SrcIpPtr, // if filtering, O if accept any
- EFI_IP_ADDRESS *DstIpPtr, // if filtering, O if accept any
- UINT8 Protocol, // protocol
- VOID *HeaderPtr, // address of where to put protocol header
- UINTN HeaderSize, // protocol header byte length
- UINT8 *MsgPtr, // pointer to data buffer
- UINTN *MsgLenPtr, // pointer to data buffer length/ O - returned data length
- IN EFI_EVENT TimeoutEvent
- )
-;
-
-#if 0
-VOID
-WaitForTxComplete (
- IN PXE_BASECODE_DEVICE *Private
- )
-;
-#endif
-//
-// routine to cycle waiting for a receive or timeout
-//
-EFI_STATUS
-WaitForReceive (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_FUNCTION Function,
- IN EFI_EVENT TimeoutEvent,
- IN OUT UINTN *HeaderSizePtr,
- IN OUT UINTN *BufferSizePtr,
- IN OUT UINT16 *ProtocolPtr
- )
-;
-
-#endif /* _IP_H_ */
-
-/* EOF - ip.h */
+/** @file
+
+Copyright (c) 2004 - 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.
+
+
+**/
+
+#ifndef _IP_H_
+#define _IP_H_
+
+#include "hton.h"
+
+//
+// portability macros
+//
+#define UDP_FILTER_MASK (EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | \
+ EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT | \
+ EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP | \
+ EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT | \
+ EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER \
+ )
+
+#define PXE_BOOT_LAYER_MASK 0x7FFF
+#define PXE_BOOT_LAYER_INITIAL 0x0000
+#define PXE_BOOT_LAYER_CREDENTIAL_FLAG 0x8000
+#define MAX_BOOT_SERVERS 32
+
+//
+// macro to evaluate IP address as TRUE if it is a multicast IP address
+//
+#define IS_MULTICAST(ptr) ((*((UINT8 *) ptr) & 0xf0) == 0xe0)
+
+//
+// length macros
+//
+#define IP_ADDRESS_LENGTH(qp) (((qp)->UsingIpv6) ? sizeof (EFI_IPv6_ADDRESS) : sizeof (EFI_IPv4_ADDRESS))
+
+#define MAX_FRAME_DATA_SIZE 1488
+#define ALLOCATE_SIZE(X) (((X) + 7) & 0xfff8)
+#define MODE_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_MODE))
+#define BUFFER_ALLOCATE_SIZE (8192 + 512)
+#define ROUTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ROUTE_ENTRY) * PXE_ROUTER_TABLE_SIZE))
+#define ARP_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ARP_ENTRY) * PXE_ARP_CACHE_SIZE))
+#define FILTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_IP_ADDRESS) * PXE_IP_FILTER_SIZE))
+#define PXE_ARP_CACHE_SIZE 8
+#define PXE_ROUTER_TABLE_SIZE 8
+#define PXE_IP_FILTER_SIZE 8
+#define ICMP_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR))
+#define TFTP_ERR_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_TFTP_ERROR))
+
+//
+// DHCP discover/request packets are sent to this UDP port. ProxyDHCP
+// servers listen on this port for DHCP discover packets that have a
+// class identifier (option 60) with 'PXEClient' in the first 9 bytes.
+// Bootservers also listen on this port for PXE broadcast discover
+// requests from PXE clients.
+//
+#define DHCP_SERVER_PORT 67
+
+//
+// When DHCP, proxyDHCP and Bootservers respond to DHCP and PXE broadcast
+// discover requests by broadcasting the reply packet, the packet is
+// broadcast to this port.
+//
+#define DHCP_CLIENT_PORT 68
+
+//
+// TFTP servers listen for TFTP open requests on this port.
+//
+#define TFTP_OPEN_PORT 69
+
+//
+// proxyDHCP and Bootservers listen on this port for a PXE unicast and/or
+// multicast discover requests from PXE clients. A PXE discover request
+// looks like a DHCP discover or DHCP request packet.
+//
+#define PXE_DISCOVERY_PORT 4011
+
+//
+// This port is used by the PXE client/server protocol tests.
+//
+#define PXE_PORT_PXETEST_PORT 0x8080
+
+//
+// Definitions for Ethertype protocol numbers and interface types
+// Per RFC 1700,
+//
+#define PXE_PROTOCOL_ETHERNET_IP 0x0800
+#define PXE_PROTOCOL_ETHERNET_ARP 0x0806
+#define PXE_PROTOCOL_ETHERNET_RARP 0x8035
+
+#define PXE_IFTYPE_ETHERNET 0x01
+#define PXE_IFTYPE_TOKENRING 0x04
+#define PXE_IFTYPE_FIBRE_CHANNEL 0x12
+
+//
+// Definitions for internet protocol version 4 header
+// Per RFC 791, September 1981.
+//
+#define IPVER4 4
+
+#pragma pack(1) // make network structures packed byte alignment
+typedef union {
+ UINT8 B[4];
+ UINT32 L;
+} IPV4_ADDR;
+
+#define IPV4_HEADER_LENGTH(IpHeaderPtr) (((IpHeaderPtr)->VersionIhl & 0xf) << 2)
+
+#define SET_IPV4_VER_HDL(IpHeaderPtr, IpHeaderLen) { \
+ (IpHeaderPtr)->VersionIhl = (UINT8) ((IPVER4 << 4) | ((IpHeaderLen) >> 2)); \
+ }
+
+typedef struct {
+ UINT8 VersionIhl;
+ UINT8 TypeOfService;
+ UINT16 TotalLength;
+ UINT16 Id;
+ UINT16 FragmentFields;
+ UINT8 TimeToLive;
+ UINT8 Protocol;
+ UINT16 HeaderChecksum;
+ IPV4_ADDR SrcAddr;
+ IPV4_ADDR DestAddr;
+ //
+ // options are not implemented
+ //
+} IPV4_HEADER;
+
+#define IP_FRAG_RSVD 0x8000 // reserved bit - must be zero
+#define IP_NO_FRAG 0x4000 // do not fragment bit
+#define IP_MORE_FRAG 0x2000 // not last fragment
+#define IP_FRAG_OFF_MSK 0x1fff // fragment offset in 8 byte chunks
+#define DEFAULT_RFC_TTL 64
+
+#define PROT_ICMP 1
+#define PROT_IGMP 2
+#define PROT_TCP 6
+#define PROT_UDP 17
+
+/*
+ * Definitions for internet control message protocol version 4 message
+ * structure. Per RFC 792, September 1981.
+ */
+
+//
+// icmp header for all icmp messages
+//
+typedef struct {
+ UINT8 Type; // message type
+ UINT8 Code; // type specific - 0 for types we implement
+ UINT16 Checksum; // ones complement of ones complement sum of 16 bit words of message
+} ICMPV4_HEADER;
+
+#define ICMP_DEST_UNREACHABLE 3
+#define ICMP_SOURCE_QUENCH 4
+#define ICMP_REDIRECT 5
+#define ICMP_ECHO 8
+#define ICMP_ECHO_REPLY 0
+#define ICMP_ROUTER_ADV 9
+#define ICMP_ROUTER_SOLICIT 10
+#define ICMP_TIME_EXCEEDED 11
+#define ICMP_PARAMETER_PROBLEM 12
+#define ICMP_TIMESTAMP 13
+#define ICMP_TIMESTAMP_REPLY 14
+#define ICMP_INFO_REQ 15
+#define ICMP_INFO_REQ_REPLY 16
+#define ICMP_SUBNET_MASK_REQ 17
+#define ICMP_SUBNET_MASK_REPLY 18
+//
+// other ICMP message types ignored in this implementation
+//
+// icmp general messages
+//
+typedef struct {
+ ICMPV4_HEADER Header;
+ //
+ // generally unused except byte [0] for
+ // parameter problem message
+ //
+ UINT8 GenerallyUnused[4];
+ //
+ // original message ip header of plus 64
+ // bits of data
+ //
+ IPV4_HEADER IpHeader;
+} ICMPV4_GENERAL_MESSAGE;
+
+//
+// icmp req/rply message header
+//
+typedef struct {
+ ICMPV4_HEADER Header;
+ UINT16 Id;
+ UINT16 SequenceNumber;
+} ICMPV4_REQUEST_REPLY_HEADER;
+
+//
+// icmp echo message
+//
+typedef struct {
+ ICMPV4_REQUEST_REPLY_HEADER Header;
+ UINT8 EchoData[1]; // variable length data to be echoed
+} ICMPV4_ECHO_MESSAGE;
+
+//
+// icmp timestamp message - times are milliseconds since midnight UT -
+// if non std, set high order bit
+//
+typedef struct {
+ ICMPV4_REQUEST_REPLY_HEADER Header;
+ UINT32 OriginalTime; // originating timestamp
+ UINT32 ReceiveTime; // receiving timestamp
+ UINT32 TransmitTime; // transmitting timestamp
+} ICMPV4_TIMESTAMP_MESSAGE;
+
+//
+// icmp info request structure - fill in source and dest net ip address on reply
+//
+typedef struct {
+ ICMPV4_REQUEST_REPLY_HEADER Header;
+} ICMPV4_INFO_MESSAGE;
+
+//
+// Definitions for internet control message protocol version 4 message structure
+// Router discovery
+// Per RFC 1256, September 1991.
+//
+//
+// icmp router advertisement message
+//
+typedef struct {
+ ICMPV4_HEADER Header;
+ UINT8 NumberEntries; // number of address entries
+ UINT8 EntrySize; // number of 32 bit words per address entry
+ UINT16 Lifetime; // seconds to consider info valid
+ UINT32 RouterIp;
+ UINT32 Preferance;
+} ICMPV4_ROUTER_ADVERTISE_MESSAGE;
+
+//
+// icmp router solicitation message
+//
+typedef struct {
+ ICMPV4_HEADER Header;
+ UINT32 Reserved;
+} ICMPV4_ROUTER_SOLICIT_MESSAGE;
+
+#define MAX_SOLICITATION_DELAY 1 // 1 second
+#define SOLICITATION_INTERVAL 3 // 3 seconds
+#define MAX_SOLICITATIONS 3 // 3 transmissions
+#define V1ROUTER_PRESENT_TIMEOUT 400 // 400 second timeout until v2 reports can be sent
+#define UNSOLICITED_REPORT_INTERVAL 10 // 10 seconds between unsolicited reports
+#define BROADCAST_IPv4 0xffffffff
+
+//
+// Definitions for address resolution protocol message structure
+// Per RFC 826, November 1982
+//
+typedef struct {
+ UINT16 HwType; // hardware type - e.g. ethernet (1)
+ UINT16 ProtType; // protocol type - for ethernet, 0x800 for IP
+ UINT8 HwAddLen; // byte length of a hardware address (e.g. 6 for ethernet)
+ UINT8 ProtAddLen; // byte length of a protocol address (e.g. 4 for ipv4)
+ UINT16 OpCode;
+ //
+ // source and dest hw and prot addresses follow - see example below
+ //
+} ARP_HEADER;
+
+#define ETHERNET_ADD_SPC 1
+
+#define ETHER_TYPE_IP 0x800
+
+#define ARP_REQUEST 1
+#define ARP_REPLY 2
+
+//
+// generic ARP packet
+//
+typedef struct {
+ ARP_HEADER ArpHeader;
+ EFI_MAC_ADDRESS SrcHardwareAddr;
+ EFI_IP_ADDRESS SrcProtocolAddr;
+ EFI_MAC_ADDRESS DestHardwareAddr;
+ EFI_IP_ADDRESS DestProtocolAddr;
+} ARP_PACKET;
+
+#define ENET_HWADDLEN 6
+#define IPV4_PROTADDLEN 4
+
+//
+// Definitions for user datagram protocol version 4 pseudo header & header
+// Per RFC 768, 28 August 1980
+//
+typedef struct {
+ IPV4_ADDR SrcAddr; // source ip address
+ IPV4_ADDR DestAddr; // dest ip address
+ UINT8 Zero; // 0
+ UINT8 Protocol; // protocol
+ UINT16 TotalLength; // UDP length - sizeof udpv4hdr + data length
+} UDPV4_PSEUDO_HEADER;
+
+typedef struct {
+ UINT16 SrcPort; // source port identifier
+ UINT16 DestPort; // destination port identifier
+ UINT16 TotalLength; // total length header plus data
+ //
+ // ones complement of ones complement sum of 16 bit
+ // words of pseudo header, UDP header, and data
+ // zero checksum is transmitted as -0 (ones comp)
+ // zero transmitted means checksum not computed
+ // data follows
+ //
+ UINT16 Checksum;
+} UDPV4_HEADER;
+
+typedef struct {
+ UDPV4_PSEUDO_HEADER Udpv4PseudoHeader;
+ UDPV4_HEADER Udpv4Header;
+} UDPV4_HEADERS;
+
+//
+// Definitions for transmission control protocol header
+// Per RFC 793, September, 1981
+//
+typedef struct {
+ IPV4_ADDR SrcAddr; // source ip address
+ IPV4_ADDR DestAddr; // dest ip address
+ UINT8 Zero; // 0
+ UINT8 Protocol; // protocol
+ UINT16 TotalLength; // TCP length - TCP header length + data length
+} TCPV4_PSEUDO_HEADER;
+
+typedef struct {
+ UINT16 SrcPort; // source port identifier
+ UINT16 DestPort; // destination port identifier
+ UINT32 SeqNumber; // Sequence number
+ UINT32 AckNumber; // Acknowledgement Number
+ //
+ // Nibble of HLEN (length of header in 32-bit multiples)
+ // 6bits of RESERVED
+ // Nibble of Code Bits
+ //
+ UINT16 HlenResCode;
+ UINT16 Window; // Software buffer size (sliding window size) in network-standard byte order
+ //
+ // ones complement of ones complement sum of 16 bit words of
+ // pseudo header, TCP header, and data
+ // zero checksum is transmitted as -0 (ones comp)
+ // zero transmitted means checksum not computed
+ //
+ UINT16 Checksum;
+ UINT16 UrgentPointer; // pointer to urgent data (allows sender to specify urgent data)
+} TCPV4_HEADER;
+
+typedef struct {
+ TCPV4_PSEUDO_HEADER Tcpv4PseudoHeader;
+ TCPV4_HEADER Tcpv4Header;
+} TCPV4_HEADERS;
+
+typedef struct {
+ UINT8 Kind; // one of the following:
+ UINT8 Length; // total option length including Kind and Lth
+ UINT8 Data[1]; // length = Lth - 2
+} TCPV4_OPTION;
+
+#define TCP_OP_END 0 // only used to pad to end of TCP header
+#define TCP_NOP 1 // optional - may be used to pad between options to get alignment
+#define TCP_MAX_SEG 2 // maximum receive segment size - only send at initial connection request
+#define MAX_MEDIA_HDR_SIZE 64
+#define MIN_ENET_DATA_SIZE 64
+#define MAX_ENET_DATA_SIZE 1500 // temp def - make a network based var
+#define MAX_IPV4_PKT_SIZE 65535 // maximum IP packet size
+#define MAX_IPV4_DATA_SIZE (MAX_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
+#define MAX_IPV4_FRAME_DATA_SIZE (MAX_FRAME_DATA_SIZE - sizeof (IPV4_HEADER))
+#define REAS_IPV4_PKT_SIZE 576 // minimum IP packet size all IP host can handle
+#define REAS_IPV4_DATA_SIZE (REAS_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
+
+//
+//
+//
+typedef union {
+ UINT8 Data[MAX_ENET_DATA_SIZE];
+ ICMPV4_HEADER IcmpHeader;
+ IGMPV2_MESSAGE IgmpMessage;
+ struct {
+ UDPV4_HEADER UdpHeader;
+ UINT8 Data[1];
+ } Udp;
+ struct {
+ TCPV4_HEADER TcpHeader;
+ UINT8 Data[1];
+ } Tcp;
+} PROTOCOL_UNION;
+
+//
+// out buffer structure
+//
+typedef struct {
+ UINT8 MediaHeader[MAX_MEDIA_HDR_SIZE];
+ IPV4_HEADER IpHeader;
+ //
+ // following union placement only valid if no option IP header
+ //
+ PROTOCOL_UNION u;
+} IPV4_BUFFER;
+
+typedef struct {
+ IPV4_HEADER IpHeader;
+ //
+ // following union placement only valid if no option IP header
+ //
+ PROTOCOL_UNION u;
+} IPV4_STRUCT;
+
+#pragma pack() // reset to default
+
+ ////////////////////////////////////////////////////////////
+//
+// BC IP Filter Routine
+//
+EFI_STATUS
+IpFilter (
+ PXE_BASECODE_DEVICE *Private,
+ IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
+ )
+;
+
+//
+// //////////////////////////////////////////////////////////////////////
+//
+// Udp Write Routine - called by base code - e.g. TFTP - already locked
+//
+EFI_STATUS
+UdpWrite (
+ IN PXE_BASECODE_DEVICE *Private,
+ IN UINT16 OpFlags,
+ IN EFI_IP_ADDRESS *DestIpPtr,
+ IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortptr,
+ IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
+ IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
+ IN UINTN *HeaderSizePtr, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN UINTN *BufferSizePtr,
+ IN VOID *BufferPtr
+ )
+;
+
+//
+// /////////////////////////////////////////////////////////////////////
+//
+// Udp Read Routine - called by base code - e.g. TFTP - already locked
+//
+EFI_STATUS
+UdpRead (
+ IN PXE_BASECODE_DEVICE *Private,
+ IN UINT16 OpFlags,
+ IN OUT EFI_IP_ADDRESS *DestIpPtr, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPorPtrt, OPTIONAL
+ IN OUT EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
+ IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
+ IN UINTN *HeaderSizePtr, OPTIONAL
+ IN VOID *HeaderPtr, OPTIONAL
+ IN OUT UINTN *BufferSizePtr,
+ IN VOID *BufferPtr,
+ IN EFI_EVENT TimeoutEvent
+ )
+;
+
+VOID
+IgmpLeaveGroup (
+ PXE_BASECODE_DEVICE *Private,
+ EFI_IP_ADDRESS *
+ )
+;
+
+VOID
+IgmpJoinGroup (
+ PXE_BASECODE_DEVICE *Private,
+ EFI_IP_ADDRESS *
+ )
+;
+
+//
+// convert number to zero filled ascii value of length lth
+//
+VOID
+CvtNum (
+ UINTN Number,
+ UINT8 *BufferPtr,
+ INTN BufferLen
+ )
+;
+
+//
+// convert number to ascii string at ptr
+//
+VOID
+UtoA10 (
+ UINTN Number,
+ UINT8 *BufferPtr
+ )
+;
+
+//
+// convert ascii numeric string to UINTN
+//
+UINTN
+AtoU (
+ UINT8 *BufferPtr
+ )
+;
+
+UINT64
+AtoU64 (
+ UINT8 *BufferPtr
+ )
+;
+
+//
+// calculate the internet checksum (RFC 1071)
+// return 16 bit ones complement of ones complement sum of 16 bit words
+//
+UINT16
+IpChecksum (
+ UINT16 *MessagePtr,
+ UINTN ByteLength
+ )
+;
+
+//
+// do checksum on non contiguous header and data
+//
+UINT16
+IpChecksum2 (
+ UINT16 *Header,
+ UINTN HeaderLength,
+ UINT16 *Message,
+ UINTN MessageLength
+ )
+;
+
+//
+// update checksum when only a single word changes
+//
+UINT16
+UpdateChecksum (
+ UINT16 OldChecksum,
+ UINT16 OldWord,
+ UINT16 NewWord
+ )
+;
+
+VOID
+SeedRandom (
+ IN PXE_BASECODE_DEVICE *Private,
+ IN UINT16 InitialSeed
+ )
+;
+
+UINT16
+Random (
+ IN PXE_BASECODE_DEVICE *Private
+ )
+;
+
+EFI_STATUS
+SendPacket (
+ PXE_BASECODE_DEVICE *Private,
+ VOID *HeaderPtr,
+ VOID *PacketPtr,
+ INTN PacketLength,
+ VOID *HardwareAddress,
+ UINT16 MediaProtocol,
+ IN EFI_PXE_BASE_CODE_FUNCTION Function
+ )
+;
+
+VOID
+HandleArpReceive (
+ PXE_BASECODE_DEVICE *Private,
+ ARP_PACKET *ArpPacketPtr,
+ VOID *HeaderPtr
+ )
+;
+
+VOID
+HandleIgmp (
+ PXE_BASECODE_DEVICE *Private,
+ IGMPV2_MESSAGE *IgmpMessageptr,
+ UINTN IgmpMessageLen
+ )
+;
+
+VOID
+IgmpCheckTimers (
+ PXE_BASECODE_DEVICE *Private
+ )
+; // poll when doing a receive
+// return hw add of IP and TRUE if available, otherwise FALSE
+//
+BOOLEAN
+GetHwAddr (
+ IN PXE_BASECODE_DEVICE *Private,
+ EFI_IP_ADDRESS *ProtocolAddressPtr,
+ EFI_MAC_ADDRESS *HardwareAddressPtr
+ )
+;
+
+EFI_STATUS
+DoArp (
+ IN PXE_BASECODE_DEVICE *Private,
+ IN EFI_IP_ADDRESS *ProtocolAddressPtr,
+ OUT EFI_MAC_ADDRESS *HardwareAddressptr
+ )
+;
+
+BOOLEAN
+OnSameSubnet (
+ UINTN IpAddressLen,
+ EFI_IP_ADDRESS *Ip1,
+ EFI_IP_ADDRESS *Ip2,
+ EFI_IP_ADDRESS *SubnetMask
+ )
+;
+
+VOID
+IpAddRouter (
+ PXE_BASECODE_DEVICE *Private,
+ EFI_IP_ADDRESS *RouterIp
+ )
+;
+
+#define Ip4AddRouter(Private, Ipv4Ptr) IpAddRouter (Private, (EFI_IP_ADDRESS *) Ipv4Ptr)
+
+//
+// routine to send ipv4 packet
+// ipv4 + upper protocol header for length TotHdrLth in xmtbuf, ipv4 header length IpHdrLth
+// routine fills in ipv4hdr Ver_Hdl, TotLth, and Checksum, moves in Data, and gets dest MAC address
+//
+EFI_STATUS
+Ipv4Xmt (
+ PXE_BASECODE_DEVICE *Private,
+ UINT32 GatewayIP,
+ UINTN IpHeaderLen,
+ UINTN TotalHeaderLen,
+ VOID *Data,
+ UINTN DataLen,
+ EFI_PXE_BASE_CODE_FUNCTION Function
+ )
+;
+
+//
+// send ipv4 packet with ipv4 option
+//
+EFI_STATUS
+Ipv4SendWOp (
+ PXE_BASECODE_DEVICE *Private,
+ UINT32 GatewayIP,
+ UINT8 *MessagePtr,
+ UINTN MessageLth,
+ UINT8 Protocol,
+ UINT8 *Option,
+ UINTN OptionLen,
+ UINT32 DestIp,
+ EFI_PXE_BASE_CODE_FUNCTION Function
+ )
+;
+
+//
+// send MsgLth message at MsgPtr - higher level protocol header already in xmtbuf, length HdrSize
+//
+EFI_STATUS
+Ip4Send (
+ IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
+ IN UINTN MayFragment, //
+ IN UINT8 Protocol, // protocol
+ IN UINT32 SrcIp, // Source IP address
+ IN UINT32 DestIp, // Destination IP address
+ IN UINT32 GatewayIp, // used if not NULL and needed
+ IN UINTN HeaderSize, // protocol header byte length
+ IN UINT8 *MsgPtr, // pointer to data
+ IN UINTN MsgLength
+ )
+; // data byte length
+// receive up to MsgLth message into MsgPtr for protocol Prot
+// return message length, src/dest ips if select any, and pointer to protocol header
+//
+EFI_STATUS
+IpReceive (
+ IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
+ UINT16 OpFlags, // Flags to determine if filtering on IP addresses
+ EFI_IP_ADDRESS *SrcIpPtr, // if filtering, O if accept any
+ EFI_IP_ADDRESS *DstIpPtr, // if filtering, O if accept any
+ UINT8 Protocol, // protocol
+ VOID *HeaderPtr, // address of where to put protocol header
+ UINTN HeaderSize, // protocol header byte length
+ UINT8 *MsgPtr, // pointer to data buffer
+ UINTN *MsgLenPtr, // pointer to data buffer length/ O - returned data length
+ IN EFI_EVENT TimeoutEvent
+ )
+;
+
+#if 0
+VOID
+WaitForTxComplete (
+ IN PXE_BASECODE_DEVICE *Private
+ )
+;
+#endif
+//
+// routine to cycle waiting for a receive or timeout
+//
+EFI_STATUS
+WaitForReceive (
+ IN PXE_BASECODE_DEVICE *Private,
+ IN EFI_PXE_BASE_CODE_FUNCTION Function,
+ IN EFI_EVENT TimeoutEvent,
+ IN OUT UINTN *HeaderSizePtr,
+ IN OUT UINTN *BufferSizePtr,
+ IN OUT UINT16 *ProtocolPtr
+ )
+;
+
+#endif /* _IP_H_ */
+
+/* EOF - ip.h */
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Ipf/PxeArch.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Ipf/PxeArch.h
index 6d06045df0..866f486226 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Ipf/PxeArch.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Ipf/PxeArch.h
@@ -1,26 +1,26 @@
-/** @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:
- PxeArch.h
-
-Abstract:
- Defines PXE Arch type
-
-
-**/
-
-#ifndef _EFI_PXE_ARCH_H_
-#define _EFI_PXE_ARCH_H_
-
-#define SYS_ARCH 0x2
-
-#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:
+ PxeArch.h
+
+Abstract:
+ Defines PXE Arch type
+
+
+**/
+
+#ifndef _EFI_PXE_ARCH_H_
+#define _EFI_PXE_ARCH_H_
+
+#define SYS_ARCH 0x2
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h b/MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h
index f81d86c163..018af5a400 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Tftp.h
@@ -1,154 +1,154 @@
-/** @file
-
-Copyright (c) 2004, 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:
- tftp.h
-
-Abstract:
-
-
-**/
-
-#ifndef __TFTP_H__
-#define __TFTP_H__
-
-//
-// Definitions for trivial file transfer protocol functionality with IP v4
-// Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
-//
-#pragma pack(1)
-//
-// max and min packet sizes
-// (all data packets in transmission except last)
-//
-#define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
-#define MIN_TFTP_PKT_SIZE 512
-
-//
-// TFTPv4 OpCodes
-//
-#define TFTP_RRQ 1 // read request
-#define TFTP_WRQ 2 // write request
-#define TFTP_DATA 3 // data
-#define TFTP_ACK 4 // acknowledgement
-#define TFTP_ERROR 5 // error packet
-#define TFTP_OACK 6 // option acknowledge
-#define TFTP_DIR 7 // read directory request
-#define TFTP_DATA8 8
-#define TFTP_ACK8 9
-
-//
-// request packet (read or write)
-// Fields shown (except file name) are not to be referenced directly,
-// since their placement is variable within a request packet.
-// All are null terminated case insensitive ascii strings.
-//
-struct Tftpv4Req {
- UINT16 OpCode; // TFTP Op code
- UINT8 FileName[2]; // file name
- UINT8 Mode[2]; // "netascii" or "octet"
- struct { // optionally, one or more option requests
- UINT8 Option[2]; // option name
- UINT8 Value[2]; // value requested
- } OpReq[1];
-};
-
-//
-// modes
-//
-#define MODE_ASCII "netascii"
-#define MODE_BINARY "octet"
-
-//
-// option strings
-//
-#define OP_BLKSIZE "blksize" // block size option
-#define OP_TIMEOUT "timeout" // time to wait before retransmitting
-#define OP_TFRSIZE "tsize" // total transfer size option
-#define OP_OVERWRITE "overwrite" // overwrite file option
-#define OP_BIGBLKNUM "bigblk#" // big block number
-// See RFC 2347, 8, and 9 for more information on TFTP options
-// option acknowledge packet (optional)
-// options not acknowledged are rejected
-//
-struct Tftpv4Oack {
- UINT16 OpCode; // TFTP Op code
- struct { // optionally, one or more option acknowledgements
- UINT8 Option[2]; // option name (of those requested)
- UINT8 Value[2]; // value acknowledged
- } OpAck[1];
-};
-
-//
-// acknowledge packet
-//
-struct Tftpv4Ack {
- UINT16 OpCode; // TFTP Op code
- UINT16 BlockNum;
-};
-
-//
-// data packet
-//
-struct Tftpv4Data {
- struct Tftpv4Ack Header;
- UINT8 Data[512];
-};
-
-//
-// big block number ack packet
-//
-struct Tftpv4Ack8 {
- UINT16 OpCode;
- UINT64 BlockNum;
-};
-
-//
-// big block number data packet
-//
-struct Tftpv4Data8 {
- struct Tftpv4Ack8 Header;
- UINT8 Data[506];
-};
-
-//
-// error packet
-//
-struct Tftpv4Error {
- UINT16 OpCode; // TFTP Op code
- UINT16 ErrCode; // error code
- UINT8 ErrMsg[1]; // error message (nul terminated)
-};
-
-#pragma pack()
-//
-// error codes
-//
-#define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
-#define TFTP_ERR_NOT_FOUND 1 // File not found.
-#define TFTP_ERR_ACCESS 2 // Access violation.
-#define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
-#define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
-#define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
-#define TFTP_ERR_EXISTS 6 // File already exists.
-#define TFTP_ERR_NO_USER 7 // No such user.
-#define TFTP_ERR_OPTION 8 // Option negotiation termination
-//
-// some defines
-//
-#define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
-#define ACK_TIMEOUT 4 // Wait four seconds for ack response.
-#define NUM_ACK_RETRIES 3
-#define NUM_MTFTP_OPEN_RETRIES 3
-
-#endif /* __TFTP_H__ */
-
-/* EOF - tftp.h */
+/** @file
+
+Copyright (c) 2004, 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:
+ tftp.h
+
+Abstract:
+
+
+**/
+
+#ifndef __TFTP_H__
+#define __TFTP_H__
+
+//
+// Definitions for trivial file transfer protocol functionality with IP v4
+// Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
+//
+#pragma pack(1)
+//
+// max and min packet sizes
+// (all data packets in transmission except last)
+//
+#define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
+#define MIN_TFTP_PKT_SIZE 512
+
+//
+// TFTPv4 OpCodes
+//
+#define TFTP_RRQ 1 // read request
+#define TFTP_WRQ 2 // write request
+#define TFTP_DATA 3 // data
+#define TFTP_ACK 4 // acknowledgement
+#define TFTP_ERROR 5 // error packet
+#define TFTP_OACK 6 // option acknowledge
+#define TFTP_DIR 7 // read directory request
+#define TFTP_DATA8 8
+#define TFTP_ACK8 9
+
+//
+// request packet (read or write)
+// Fields shown (except file name) are not to be referenced directly,
+// since their placement is variable within a request packet.
+// All are null terminated case insensitive ascii strings.
+//
+struct Tftpv4Req {
+ UINT16 OpCode; // TFTP Op code
+ UINT8 FileName[2]; // file name
+ UINT8 Mode[2]; // "netascii" or "octet"
+ struct { // optionally, one or more option requests
+ UINT8 Option[2]; // option name
+ UINT8 Value[2]; // value requested
+ } OpReq[1];
+};
+
+//
+// modes
+//
+#define MODE_ASCII "netascii"
+#define MODE_BINARY "octet"
+
+//
+// option strings
+//
+#define OP_BLKSIZE "blksize" // block size option
+#define OP_TIMEOUT "timeout" // time to wait before retransmitting
+#define OP_TFRSIZE "tsize" // total transfer size option
+#define OP_OVERWRITE "overwrite" // overwrite file option
+#define OP_BIGBLKNUM "bigblk#" // big block number
+// See RFC 2347, 8, and 9 for more information on TFTP options
+// option acknowledge packet (optional)
+// options not acknowledged are rejected
+//
+struct Tftpv4Oack {
+ UINT16 OpCode; // TFTP Op code
+ struct { // optionally, one or more option acknowledgements
+ UINT8 Option[2]; // option name (of those requested)
+ UINT8 Value[2]; // value acknowledged
+ } OpAck[1];
+};
+
+//
+// acknowledge packet
+//
+struct Tftpv4Ack {
+ UINT16 OpCode; // TFTP Op code
+ UINT16 BlockNum;
+};
+
+//
+// data packet
+//
+struct Tftpv4Data {
+ struct Tftpv4Ack Header;
+ UINT8 Data[512];
+};
+
+//
+// big block number ack packet
+//
+struct Tftpv4Ack8 {
+ UINT16 OpCode;
+ UINT64 BlockNum;
+};
+
+//
+// big block number data packet
+//
+struct Tftpv4Data8 {
+ struct Tftpv4Ack8 Header;
+ UINT8 Data[506];
+};
+
+//
+// error packet
+//
+struct Tftpv4Error {
+ UINT16 OpCode; // TFTP Op code
+ UINT16 ErrCode; // error code
+ UINT8 ErrMsg[1]; // error message (nul terminated)
+};
+
+#pragma pack()
+//
+// error codes
+//
+#define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
+#define TFTP_ERR_NOT_FOUND 1 // File not found.
+#define TFTP_ERR_ACCESS 2 // Access violation.
+#define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
+#define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
+#define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
+#define TFTP_ERR_EXISTS 6 // File already exists.
+#define TFTP_ERR_NO_USER 7 // No such user.
+#define TFTP_ERR_OPTION 8 // Option negotiation termination
+//
+// some defines
+//
+#define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
+#define ACK_TIMEOUT 4 // Wait four seconds for ack response.
+#define NUM_ACK_RETRIES 3
+#define NUM_MTFTP_OPEN_RETRIES 3
+
+#endif /* __TFTP_H__ */
+
+/* EOF - tftp.h */
diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/X64/PxeArch.h b/MdeModulePkg/Universal/Network/PxeBcDxe/X64/PxeArch.h
index a8fa293a16..33a7b2696f 100644
--- a/MdeModulePkg/Universal/Network/PxeBcDxe/X64/PxeArch.h
+++ b/MdeModulePkg/Universal/Network/PxeBcDxe/X64/PxeArch.h
@@ -1,26 +1,26 @@
-/** @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:
- PxeArch.h
-
-Abstract:
- Defines PXE Arch type
-
-
-**/
-
-#ifndef _EFI_PXE_ARCH_H_
-#define _EFI_PXE_ARCH_H_
-
-#define SYS_ARCH 0x7
-
-#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:
+ PxeArch.h
+
+Abstract:
+ Defines PXE Arch type
+
+
+**/
+
+#ifndef _EFI_PXE_ARCH_H_
+#define _EFI_PXE_ARCH_H_
+
+#define SYS_ARCH 0x7
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/ComponentName.c
index 7186a9f159..6eae594c4d 100644
--- a/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/ComponentName.c
@@ -25,6 +25,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
PxeDhcp4ComponentNameGetDriverName (
@@ -33,6 +72,75 @@ PxeDhcp4ComponentNameGetDriverName (
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
PxeDhcp4ComponentNameGetControllerName (
@@ -43,20 +151,31 @@ PxeDhcp4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
PxeDhcp4ComponentNameGetDriverName,
PxeDhcp4ComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeDhcp4ComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeDhcp4ComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"PXE DHCPv4 Driver"
},
{
@@ -65,7 +184,45 @@ static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
}
};
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/**
+ 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
PxeDhcp4ComponentNameGetDriverName (
@@ -73,42 +230,84 @@ PxeDhcp4ComponentNameGetDriverName (
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_SUCCESS - 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,
- gPxeDhcp4ComponentName.SupportedLanguages,
- mPxeDhcp4DriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mPxeDhcp4DriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gPxeDhcp4ComponentName)
+ );
}
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/**
+ 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
PxeDhcp4ComponentNameGetControllerName (
@@ -118,50 +317,6 @@ PxeDhcp4ComponentNameGetControllerName (
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/PxeDhcp4Dxe/PxeDhcp4.c b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.c
index 7fcd7c2c17..05a0738794 100644
--- a/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.c
+++ b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.c
@@ -94,15 +94,14 @@ PxeDhcp4DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- return EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &gPxeDhcp4DriverBinding,
- NULL,
- &gPxeDhcp4ComponentName,
- NULL,
- NULL
- );
+ return EfiLibInstallDriverBindingComponentName2 (
+ ImageHandle,
+ SystemTable,
+ &gPxeDhcp4DriverBinding,
+ NULL,
+ &gPxeDhcp4ComponentName,
+ &gPxeDhcp4ComponentName2
+ );
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
diff --git a/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.h b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.h
index 7e971d49c9..81021c79b8 100644
--- a/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.h
+++ b/MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4.h
@@ -1,345 +1,346 @@
-/** @file
-
-Copyright (c) 2004 - 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:
- PxeDhcp4.h
-
-Abstract:
- Common header for PxeDhcp4 protocol driver
-
-
-**/
-#ifndef _PXEDHCP4_H
-#define _PXEDHCP4_H
-
+/** @file
+
+Copyright (c) 2004 - 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:
+ PxeDhcp4.h
+
+Abstract:
+ Common header for PxeDhcp4 protocol driver
+
+
+**/
+#ifndef _PXEDHCP4_H
+#define _PXEDHCP4_H
+
#include <PiDxe.h>
#include <Protocol/PxeBaseCode.h>
-#include <Protocol/SimpleNetwork.h>
-#include <Protocol/PxeDhcp4.h>
+#include <Protocol/SimpleNetwork.h>
+#include <Protocol/PxeDhcp4.h>
#include <Protocol/PxeDhcp4Callback.h>
#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// PxeDhcp4 protocol instance data
-//
-typedef struct {
- //
- // Signature field used to locate beginning of containment record.
- //
- UINTN Signature;
-
-#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
- //
- // Device handle the protocol is bound to.
- //
- EFI_HANDLE Handle;
-
- //
- // Public PxeDhcp4 protocol interface.
- //
- EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
-
- //
- // Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
- //
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
-
- //
- // PxeDhcp4 called function for PxeDhcp4Callback.
- //
- EFI_PXE_DHCP4_FUNCTION function;
-
- //
- // Timeout event and flag for PxeDhcp4Callback.
- //
- EFI_EVENT TimeoutEvent;
- BOOLEAN TimeoutOccurred;
-
- //
- // Periodic event and flag for PxeDhcp4Callback.
- //
- EFI_EVENT PeriodicEvent;
- BOOLEAN PeriodicOccurred;
-
- //
- // DHCP server IP address.
- //
- UINT32 ServerIp;
-
- //
- // DHCP renewal and rebinding times, in seconds.
- //
- UINT32 RenewTime;
- UINT32 RebindTime;
- UINT32 LeaseTime;
-
- //
- // Number of offers received & allocated offer list.
- //
- UINTN offers;
- DHCP4_PACKET *offer_list;
-
- //
- //
- //
- BOOLEAN StopPxeBc;
-
-} PXE_DHCP4_PRIVATE_DATA;
-
-#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Protocol function prototypes.
-//
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Run (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN OPTIONAL UINTN OpLen,
- IN OPTIONAL VOID *OpList
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Setup (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN EFI_PXE_DHCP4_DATA *Data
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Init (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- OUT UINTN *offer_list_entries,
- OUT DHCP4_PACKET **offer_list
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Select (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- IN DHCP4_PACKET *offer_list
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Renew (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Rebind (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Release (
- IN EFI_PXE_DHCP4_PROTOCOL *This
- )
-;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Support function prototypes.
-//
-extern
-UINT16
-htons (
- UINTN n
- )
-;
-
-extern
-UINT32
-htonl (
- UINTN n
- )
-;
-
-extern
-VOID
-EFIAPI
-timeout_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-extern
-VOID
-EFIAPI
-periodic_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-extern
-EFI_STATUS
-find_opt (
- IN DHCP4_PACKET *Packet,
- IN UINT8 OpCode,
- IN UINTN Skip,
- OUT DHCP4_OP **OpPtr
- )
-;
-
-extern
-EFI_STATUS
-add_opt (
- IN DHCP4_PACKET *Packet,
- IN DHCP4_OP *OpPtr
- )
-;
-
-extern
-EFI_STATUS
-start_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OPTIONAL EFI_IP_ADDRESS *station_ip,
- IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
- )
-;
-
-extern
-VOID
-stop_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-;
-
-extern
-EFI_STATUS
-start_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN UINTN seconds_timeout
- )
-;
-
-extern
-VOID
-stop_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-;
-
-extern
-EFI_STATUS
-tx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN EFI_IP_ADDRESS *dest_ip,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN EFI_IP_ADDRESS *src_ip,
- IN VOID *buffer,
- IN UINTN BufferSize
- )
-;
-
-extern
-EFI_STATUS
-rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- OUT VOID *buffer,
- OUT UINTN *BufferSize,
- IN OUT EFI_IP_ADDRESS *dest_ip,
- IN OUT EFI_IP_ADDRESS *src_ip,
- IN UINT16 op_flags
- )
-;
-
-extern
-EFI_STATUS
-tx_rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OUT EFI_IP_ADDRESS *ServerIp,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN OPTIONAL EFI_IP_ADDRESS *client_ip,
- IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
- IN DHCP4_PACKET *tx_pkt,
- OUT DHCP4_PACKET *rx_pkt,
- IN INTN
- (
- *rx_vfy)
- (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- ),
- IN UINTN seconds_timeout
- )
-;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Global variable definitions.
-//
-extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
-
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Register Driver Binding protocol for this driver.
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
- EFI_SUCCESS - Driver loaded.
- other - Driver not loaded.
-
---*/
-;
-
-#endif /* _PXEDHCP4_H */
-
-/* EOF - PxeDhcp4.h */
+#include <Library/UefiLib.h>
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+//
+// PxeDhcp4 protocol instance data
+//
+typedef struct {
+ //
+ // Signature field used to locate beginning of containment record.
+ //
+ UINTN Signature;
+
+#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
+ //
+ // Device handle the protocol is bound to.
+ //
+ EFI_HANDLE Handle;
+
+ //
+ // Public PxeDhcp4 protocol interface.
+ //
+ EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
+
+ //
+ // Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
+ //
+ EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
+ EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
+ EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
+
+ //
+ // PxeDhcp4 called function for PxeDhcp4Callback.
+ //
+ EFI_PXE_DHCP4_FUNCTION function;
+
+ //
+ // Timeout event and flag for PxeDhcp4Callback.
+ //
+ EFI_EVENT TimeoutEvent;
+ BOOLEAN TimeoutOccurred;
+
+ //
+ // Periodic event and flag for PxeDhcp4Callback.
+ //
+ EFI_EVENT PeriodicEvent;
+ BOOLEAN PeriodicOccurred;
+
+ //
+ // DHCP server IP address.
+ //
+ UINT32 ServerIp;
+
+ //
+ // DHCP renewal and rebinding times, in seconds.
+ //
+ UINT32 RenewTime;
+ UINT32 RebindTime;
+ UINT32 LeaseTime;
+
+ //
+ // Number of offers received & allocated offer list.
+ //
+ UINTN offers;
+ DHCP4_PACKET *offer_list;
+
+ //
+ //
+ //
+ BOOLEAN StopPxeBc;
+
+} PXE_DHCP4_PRIVATE_DATA;
+
+#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+//
+// Protocol function prototypes.
+//
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Run (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ IN OPTIONAL UINTN OpLen,
+ IN OPTIONAL VOID *OpList
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Setup (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ IN EFI_PXE_DHCP4_DATA *Data
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Init (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ IN UINTN seconds_timeout,
+ OUT UINTN *offer_list_entries,
+ OUT DHCP4_PACKET **offer_list
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Select (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ IN UINTN seconds_timeout,
+ IN DHCP4_PACKET *offer_list
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Renew (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ UINTN seconds_timeout
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Rebind (
+ IN EFI_PXE_DHCP4_PROTOCOL *This,
+ UINTN seconds_timeout
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+PxeDhcp4Release (
+ IN EFI_PXE_DHCP4_PROTOCOL *This
+ )
+;
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+//
+// Support function prototypes.
+//
+extern
+UINT16
+htons (
+ UINTN n
+ )
+;
+
+extern
+UINT32
+htonl (
+ UINTN n
+ )
+;
+
+extern
+VOID
+EFIAPI
+timeout_notify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+extern
+VOID
+EFIAPI
+periodic_notify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+extern
+EFI_STATUS
+find_opt (
+ IN DHCP4_PACKET *Packet,
+ IN UINT8 OpCode,
+ IN UINTN Skip,
+ OUT DHCP4_OP **OpPtr
+ )
+;
+
+extern
+EFI_STATUS
+add_opt (
+ IN DHCP4_PACKET *Packet,
+ IN DHCP4_OP *OpPtr
+ )
+;
+
+extern
+EFI_STATUS
+start_udp (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ IN OPTIONAL EFI_IP_ADDRESS *station_ip,
+ IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
+ )
+;
+
+extern
+VOID
+stop_udp (
+ IN PXE_DHCP4_PRIVATE_DATA *Private
+ )
+;
+
+extern
+EFI_STATUS
+start_receive_events (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ IN UINTN seconds_timeout
+ )
+;
+
+extern
+VOID
+stop_receive_events (
+ IN PXE_DHCP4_PRIVATE_DATA *Private
+ )
+;
+
+extern
+EFI_STATUS
+tx_udp (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ IN EFI_IP_ADDRESS *dest_ip,
+ IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
+ IN EFI_IP_ADDRESS *src_ip,
+ IN VOID *buffer,
+ IN UINTN BufferSize
+ )
+;
+
+extern
+EFI_STATUS
+rx_udp (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ OUT VOID *buffer,
+ OUT UINTN *BufferSize,
+ IN OUT EFI_IP_ADDRESS *dest_ip,
+ IN OUT EFI_IP_ADDRESS *src_ip,
+ IN UINT16 op_flags
+ )
+;
+
+extern
+EFI_STATUS
+tx_rx_udp (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ IN OUT EFI_IP_ADDRESS *ServerIp,
+ IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
+ IN OPTIONAL EFI_IP_ADDRESS *client_ip,
+ IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
+ IN DHCP4_PACKET *tx_pkt,
+ OUT DHCP4_PACKET *rx_pkt,
+ IN INTN
+ (
+ *rx_vfy)
+ (
+ IN PXE_DHCP4_PRIVATE_DATA *Private,
+ IN DHCP4_PACKET *tx_pkt,
+ IN DHCP4_PACKET *rx_pkt,
+ IN UINTN rx_pkt_size
+ ),
+ IN UINTN seconds_timeout
+ )
+;
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+//
+// Global variable definitions.
+//
+extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2;
+
+EFI_STATUS
+EFIAPI
+PxeDhcp4DriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+ Register Driver Binding protocol for this driver.
+
+Arguments:
+ (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
+
+Returns:
+ EFI_SUCCESS - Driver loaded.
+ other - Driver not loaded.
+
+--*/
+;
+
+#endif /* _PXEDHCP4_H */
+
+/* EOF - PxeDhcp4.h */
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c b/MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c
index 6da17a3633..a2dc8e75af 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c
@@ -25,6 +25,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
SimpleNetworkComponentNameGetDriverName (
@@ -33,6 +72,75 @@ SimpleNetworkComponentNameGetDriverName (
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
SimpleNetworkComponentNameGetControllerName (
@@ -43,18 +151,29 @@ SimpleNetworkComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
SimpleNetworkComponentNameGetDriverName,
SimpleNetworkComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SimpleNetworkComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SimpleNetworkComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"Simple Network Protocol Driver"
},
{
@@ -63,6 +182,45 @@ static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
}
};
+/**
+ 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
SimpleNetworkComponentNameGetDriverName (
@@ -70,41 +228,84 @@ SimpleNetworkComponentNameGetDriverName (
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_SUCCESS - 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,
- gSimpleNetworkComponentName.SupportedLanguages,
- mSimpleNetworkDriverNameTable,
- DriverName
- );
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mSimpleNetworkDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gSimpleNetworkComponentName)
+ );
}
+/**
+ 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
SimpleNetworkComponentNameGetControllerName (
@@ -114,50 +315,6 @@ SimpleNetworkComponentNameGetControllerName (
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/SnpDxe/snp.c b/MdeModulePkg/Universal/Network/SnpDxe/snp.c
index d5055e7642..2f88c71ae8 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/snp.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/snp.c
@@ -1257,13 +1257,12 @@ InitializeSnpNiiDriver (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- return EfiLibInstallAllDriverProtocols (
- ImageHandle,
- SystemTable,
- &mSimpleNetworkDriverBinding,
- NULL,
- &gSimpleNetworkComponentName,
- NULL,
- NULL
- );
+ return EfiLibInstallDriverBindingComponentName2 (
+ ImageHandle,
+ SystemTable,
+ &mSimpleNetworkDriverBinding,
+ NULL,
+ &gSimpleNetworkComponentName,
+ &gSimpleNetworkComponentName2
+ );
}
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/snp.h b/MdeModulePkg/Universal/Network/SnpDxe/snp.h
index 08c4f4d8df..01f428d2f1 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/snp.h
+++ b/MdeModulePkg/Universal/Network/SnpDxe/snp.h
@@ -1,27 +1,27 @@
-/** @file
-
-Copyright (c) 2004 - 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:
- snp.h
-
-Abstract:
-
-Revision history:
-
-
-**/
-#ifndef _SNP_H
-#define _SNP_H
-
-
+/** @file
+
+Copyright (c) 2004 - 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:
+ snp.h
+
+Abstract:
+
+Revision history:
+
+
+**/
+#ifndef _SNP_H
+#define _SNP_H
+
+
#include <PiDxe.h>
#include <Protocol/SimpleNetwork.h>
@@ -34,399 +34,400 @@ Revision history:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include <IndustryStandard/Pci22.h>
-
-#define FOUR_GIGABYTES (UINT64) 0x100000000ULL
-
-
-#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
-#define MAX_MAP_LENGTH 100
-
-#define PCI_BAR_IO_MASK 0x00000003
-#define PCI_BAR_IO_MODE 0x00000001
-
-#define PCI_BAR_MEM_MASK 0x0000000F
-#define PCI_BAR_MEM_MODE 0x00000000
-#define PCI_BAR_MEM_64BIT 0x00000004
-
-typedef struct {
- UINT32 Signature;
- EFI_LOCK lock;
-
- EFI_SIMPLE_NETWORK_PROTOCOL snp;
- EFI_SIMPLE_NETWORK_MODE mode;
-
- EFI_HANDLE device_handle;
- EFI_DEVICE_PATH_PROTOCOL *device_path;
-
- //
- // Local instance data needed by SNP driver
- //
- // Pointer to S/W UNDI API entry point
- // This will be NULL for H/W UNDI
- //
- EFI_STATUS (*issue_undi32_command) (UINT64 cdb);
-
- BOOLEAN is_swundi;
-
- //
- // undi interface number, if one undi manages more nics
- //
- PXE_IFNUM if_num;
-
- //
- // Allocated tx/rx buffer that was passed to UNDI Initialize.
- //
- UINT32 tx_rx_bufsize;
- VOID *tx_rx_buffer;
- //
- // mappable buffers for receive and fill header for undi3.0
- // these will be used if the user buffers are above 4GB limit (instead of
- // mapping the user buffers)
- //
- UINT8 *receive_buf;
- VOID *ReceiveBufUnmap;
- UINT8 *fill_hdr_buf;
- VOID *FillHdrBufUnmap;
-
- EFI_PCI_IO_PROTOCOL *IoFncs;
- UINT8 IoBarIndex;
- UINT8 MemoryBarIndex;
- BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
- //
- // Buffers for command descriptor block, command parameter block
- // and data block.
- //
- PXE_CDB cdb;
- VOID *cpb;
- VOID *CpbUnmap;
- VOID *db;
-
- //
- // UNDI structure, we need to remember the init info for a long time!
- //
- PXE_DB_GET_INIT_INFO init_info;
-
- VOID *SnpDriverUnmap;
- //
- // when ever we map an address, we must remember it's address and the un-map
- // cookie so that we can unmap later
- //
- struct s_map_list {
- EFI_PHYSICAL_ADDRESS virt;
- VOID *map_cookie;
- } map_list[MAX_MAP_LENGTH];
-}
-SNP_DRIVER;
-
-#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
-
-//
-// Virtual to physical mapping for all UNDI 3.0s.
-//
-extern struct s_v2p {
- struct s_v2p *next;
- VOID *vaddr;
- UINTN bsize;
- EFI_PHYSICAL_ADDRESS paddr;
- VOID *unmap;
-}
-*_v2p;
-
-EFI_STATUS
-add_v2p (
- struct s_v2p **v2p,
- EFI_PCI_IO_PROTOCOL_OPERATION type,
- VOID *vaddr,
- UINTN bsize
- )
-;
-
-EFI_STATUS
-find_v2p (
- struct s_v2p **v2p,
- VOID *vaddr
- )
-;
-
-EFI_STATUS
-del_v2p (
- VOID *vaddr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_block_30 (
- IN UINT32 Enable
- )
-;
-
-extern
-VOID
-snp_undi32_callback_delay_30 (
- IN UINT64 MicroSeconds
- )
-;
-
-extern
-VOID
-snp_undi32_callback_memio_30 (
- IN UINT8 ReadOrWrite,
- IN UINT8 NumBytes,
- IN UINT64 MemOrPortAddress,
- IN OUT UINT64 BufferPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_v2p_30 (
- IN UINT64 CpuAddr,
- IN OUT UINT64 DeviceAddrPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_block (
- IN UINT64 UniqueId,
- IN UINT32 Enable
- )
-;
-
-extern
-VOID
-snp_undi32_callback_delay (
- IN UINT64 UniqueId,
- IN UINT64 MicroSeconds
- )
-;
-
-extern
-VOID
-snp_undi32_callback_memio (
- IN UINT64 UniqueId,
- IN UINT8 ReadOrWrite,
- IN UINT8 NumBytes,
- IN UINT64 MemOrPortAddr,
- IN OUT UINT64 BufferPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_map (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN OUT UINT64 DeviceAddrPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_unmap (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN UINT64 DeviceAddr // not a pointer to device address
- )
-;
-
-extern
-VOID
-snp_undi32_callback_sync (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN UINT64 DeviceAddr // not a pointer to device address
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_start (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_stop (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_initialize (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN UINTN extra_rx_buffer_size OPTIONAL,
- IN UINTN extra_tx_buffer_size OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_reset (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_shutdown (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_receive_filters (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINT32 enable,
- IN UINT32 disable,
- IN BOOLEAN reset_mcast_filter,
- IN UINTN mcast_filter_count OPTIONAL,
- IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_station_address (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN reset,
- IN EFI_MAC_ADDRESS *new OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_statistics (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN reset,
- IN OUT UINTN *statistics_size OPTIONAL,
- IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_mcast_ip_to_mac (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_nvdata (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN read_write,
- IN UINTN offset,
- IN UINTN buffer_size,
- IN OUT VOID *buffer
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_get_status (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINT32 *interrupt_status OPTIONAL,
- OUT VOID **tx_buffer OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_transmit (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINTN header_size,
- IN UINTN buffer_size,
- IN VOID *buffer,
- IN EFI_MAC_ADDRESS * src_addr OPTIONAL,
- IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,
- IN UINT16 *protocol OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_receive (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINTN *header_size OPTIONAL,
- IN OUT UINTN *buffer_size,
- OUT VOID *buffer,
- OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,
- OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,
- OUT UINT16 *protocol OPTIONAL
- )
-;
-
-typedef
-EFI_STATUS
-(*issue_undi32_command) (
- UINT64 cdb
- );
-typedef
-VOID
-(*ptr) (
- VOID
- );
-
-
-/**
- Install all the driver protocol
-
- @param ImageHandle Driver image handle
- @param SystemTable System services table
-
- @retval EFI_SUCEESS Initialization routine has found UNDI hardware, loaded it's
- ROM, and installed a notify event for the Network
- Indentifier Interface Protocol successfully.
- @retval Other Return value from HandleProtocol for DeviceIoProtocol or
- LoadedImageProtocol
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeSnpNiiDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
-
-
-#endif /* _SNP_H */
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+#include <IndustryStandard/Pci22.h>
+
+#define FOUR_GIGABYTES (UINT64) 0x100000000ULL
+
+
+#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
+#define MAX_MAP_LENGTH 100
+
+#define PCI_BAR_IO_MASK 0x00000003
+#define PCI_BAR_IO_MODE 0x00000001
+
+#define PCI_BAR_MEM_MASK 0x0000000F
+#define PCI_BAR_MEM_MODE 0x00000000
+#define PCI_BAR_MEM_64BIT 0x00000004
+
+typedef struct {
+ UINT32 Signature;
+ EFI_LOCK lock;
+
+ EFI_SIMPLE_NETWORK_PROTOCOL snp;
+ EFI_SIMPLE_NETWORK_MODE mode;
+
+ EFI_HANDLE device_handle;
+ EFI_DEVICE_PATH_PROTOCOL *device_path;
+
+ //
+ // Local instance data needed by SNP driver
+ //
+ // Pointer to S/W UNDI API entry point
+ // This will be NULL for H/W UNDI
+ //
+ EFI_STATUS (*issue_undi32_command) (UINT64 cdb);
+
+ BOOLEAN is_swundi;
+
+ //
+ // undi interface number, if one undi manages more nics
+ //
+ PXE_IFNUM if_num;
+
+ //
+ // Allocated tx/rx buffer that was passed to UNDI Initialize.
+ //
+ UINT32 tx_rx_bufsize;
+ VOID *tx_rx_buffer;
+ //
+ // mappable buffers for receive and fill header for undi3.0
+ // these will be used if the user buffers are above 4GB limit (instead of
+ // mapping the user buffers)
+ //
+ UINT8 *receive_buf;
+ VOID *ReceiveBufUnmap;
+ UINT8 *fill_hdr_buf;
+ VOID *FillHdrBufUnmap;
+
+ EFI_PCI_IO_PROTOCOL *IoFncs;
+ UINT8 IoBarIndex;
+ UINT8 MemoryBarIndex;
+ BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
+ //
+ // Buffers for command descriptor block, command parameter block
+ // and data block.
+ //
+ PXE_CDB cdb;
+ VOID *cpb;
+ VOID *CpbUnmap;
+ VOID *db;
+
+ //
+ // UNDI structure, we need to remember the init info for a long time!
+ //
+ PXE_DB_GET_INIT_INFO init_info;
+
+ VOID *SnpDriverUnmap;
+ //
+ // when ever we map an address, we must remember it's address and the un-map
+ // cookie so that we can unmap later
+ //
+ struct s_map_list {
+ EFI_PHYSICAL_ADDRESS virt;
+ VOID *map_cookie;
+ } map_list[MAX_MAP_LENGTH];
+}
+SNP_DRIVER;
+
+#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)
+
+//
+// Global Variables
+//
+extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2;
+
+//
+// Virtual to physical mapping for all UNDI 3.0s.
+//
+extern struct s_v2p {
+ struct s_v2p *next;
+ VOID *vaddr;
+ UINTN bsize;
+ EFI_PHYSICAL_ADDRESS paddr;
+ VOID *unmap;
+}
+*_v2p;
+
+EFI_STATUS
+add_v2p (
+ struct s_v2p **v2p,
+ EFI_PCI_IO_PROTOCOL_OPERATION type,
+ VOID *vaddr,
+ UINTN bsize
+ )
+;
+
+EFI_STATUS
+find_v2p (
+ struct s_v2p **v2p,
+ VOID *vaddr
+ )
+;
+
+EFI_STATUS
+del_v2p (
+ VOID *vaddr
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_block_30 (
+ IN UINT32 Enable
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_delay_30 (
+ IN UINT64 MicroSeconds
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_memio_30 (
+ IN UINT8 ReadOrWrite,
+ IN UINT8 NumBytes,
+ IN UINT64 MemOrPortAddress,
+ IN OUT UINT64 BufferPtr
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_v2p_30 (
+ IN UINT64 CpuAddr,
+ IN OUT UINT64 DeviceAddrPtr
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_block (
+ IN UINT64 UniqueId,
+ IN UINT32 Enable
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_delay (
+ IN UINT64 UniqueId,
+ IN UINT64 MicroSeconds
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_memio (
+ IN UINT64 UniqueId,
+ IN UINT8 ReadOrWrite,
+ IN UINT8 NumBytes,
+ IN UINT64 MemOrPortAddr,
+ IN OUT UINT64 BufferPtr
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_map (
+ IN UINT64 UniqueId,
+ IN UINT64 CpuAddr,
+ IN UINT32 NumBytes,
+ IN UINT32 Direction,
+ IN OUT UINT64 DeviceAddrPtr
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_unmap (
+ IN UINT64 UniqueId,
+ IN UINT64 CpuAddr,
+ IN UINT32 NumBytes,
+ IN UINT32 Direction,
+ IN UINT64 DeviceAddr // not a pointer to device address
+ )
+;
+
+extern
+VOID
+snp_undi32_callback_sync (
+ IN UINT64 UniqueId,
+ IN UINT64 CpuAddr,
+ IN UINT32 NumBytes,
+ IN UINT32 Direction,
+ IN UINT64 DeviceAddr // not a pointer to device address
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_start (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_stop (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_initialize (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
+ IN UINTN extra_rx_buffer_size OPTIONAL,
+ IN UINTN extra_tx_buffer_size OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_reset (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
+ IN BOOLEAN ExtendedVerification
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_shutdown (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_receive_filters (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ IN UINT32 enable,
+ IN UINT32 disable,
+ IN BOOLEAN reset_mcast_filter,
+ IN UINTN mcast_filter_count OPTIONAL,
+ IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_station_address (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ IN BOOLEAN reset,
+ IN EFI_MAC_ADDRESS *new OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_statistics (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ IN BOOLEAN reset,
+ IN OUT UINTN *statistics_size OPTIONAL,
+ IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_mcast_ip_to_mac (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
+ IN BOOLEAN IPv6,
+ IN EFI_IP_ADDRESS *IP,
+ OUT EFI_MAC_ADDRESS *MAC
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_nvdata (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
+ IN BOOLEAN read_write,
+ IN UINTN offset,
+ IN UINTN buffer_size,
+ IN OUT VOID *buffer
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_get_status (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ OUT UINT32 *interrupt_status OPTIONAL,
+ OUT VOID **tx_buffer OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_transmit (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ IN UINTN header_size,
+ IN UINTN buffer_size,
+ IN VOID *buffer,
+ IN EFI_MAC_ADDRESS * src_addr OPTIONAL,
+ IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,
+ IN UINT16 *protocol OPTIONAL
+ )
+;
+
+extern
+EFI_STATUS
+EFIAPI
+snp_undi32_receive (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
+ OUT UINTN *header_size OPTIONAL,
+ IN OUT UINTN *buffer_size,
+ OUT VOID *buffer,
+ OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,
+ OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,
+ OUT UINT16 *protocol OPTIONAL
+ )
+;
+
+typedef
+EFI_STATUS
+(*issue_undi32_command) (
+ UINT64 cdb
+ );
+typedef
+VOID
+(*ptr) (
+ VOID
+ );
+
+
+/**
+ Install all the driver protocol
+
+ @param ImageHandle Driver image handle
+ @param SystemTable System services table
+
+ @retval EFI_SUCEESS Initialization routine has found UNDI hardware, loaded it's
+ ROM, and installed a notify event for the Network
+ Indentifier Interface Protocol successfully.
+ @retval Other Return value from HandleProtocol for DeviceIoProtocol or
+ LoadedImageProtocol
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeSnpNiiDriver (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
+
+
+#endif /* _SNP_H */
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/ComponentName.c
index 477af22e1e..fae269fa16 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/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
TcpComponentNameGetDriverName (
@@ -31,28 +70,108 @@ TcpComponentNameGetDriverName (
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
TcpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {
TcpComponentNameGetDriverName,
TcpComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gTcp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TcpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TcpComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"Tcp Network Service Driver"
},
{
@@ -61,6 +180,45 @@ static EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
}
};
+/**
+ 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
TcpComponentNameGetDriverName (
@@ -68,102 +226,93 @@ TcpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
-/*++
+{
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mTcpDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gTcp4ComponentName)
+ );
+}
-Routine Description:
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
- Retrieves a Unicode string that is the user readable name of the EFI 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.
-Arguments:
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
- 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.
+ @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.
-Returns:
+ @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.
- 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.
+ @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.
---*/
-{
- return LookupUnicodeString (
- Language,
- gTcp4ComponentName.SupportedLanguages,
- mTcpDriverNameTable,
- DriverName
- );
-}
+ @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
TcpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ 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 supported
- languages. 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/Tcp4Dxe/SockImpl.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
index 69a1ac6222..13feea18fa 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
@@ -1,84 +1,84 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- SockImpl.h
-
-Abstract:
-
-
-**/
-
-#ifndef _SOCK_IMPL_H_
-#define _SOCK_IMPL_H_
-
-#include "Socket.h"
-
-#define SOCK_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR("Sock", PrintArg)
-#define SOCK_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING("Sock", PrintArg)
-#define SOCK_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE("Sock", PrintArg)
-
-#define SOCK_TRIM_RCV_BUFF(Sock, Len) \
- (NetbufQueTrim ((Sock)->RcvBuffer.DataQueue, (Len)))
-
-#define SIGNAL_TOKEN(Token, TokenStatus) \
- do { \
- (Token)->Status = (TokenStatus); \
- gBS->SignalEvent ((Token)->Event); \
- } while (0)
-
-#define SOCK_HEADER_SPACE (60 + 60 + 72)
-
-//
-// Supporting function for both SockImpl and SockInterface
-//
-VOID
-SockFreeFoo (
- IN EFI_EVENT Event
- );
-
-EFI_STATUS
-SockProcessTcpSndData (
- IN SOCKET *Sock,
- IN VOID *TcpTxData
- );
-
-VOID
-SockSetTcpRxData (
- IN SOCKET *Sock,
- IN VOID *TcpRxData,
- IN UINT32 RcvdBytes,
- IN BOOLEAN IsOOB
- );
-
-UINT32
-SockProcessRcvToken (
- IN SOCKET *Sock,
- IN SOCK_IO_TOKEN *RcvToken
- );
-
-VOID
-SockConnFlush (
- IN SOCKET *Sock
- );
-
-SOCKET *
-SockCreate (
- IN SOCK_INIT_DATA *SockInitData
- );
-
-VOID
-SockDestroy (
- IN SOCKET *Sock
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ SockImpl.h
+
+Abstract:
+
+
+**/
+
+#ifndef _SOCK_IMPL_H_
+#define _SOCK_IMPL_H_
+
+#include "Socket.h"
+
+#define SOCK_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR("Sock", PrintArg)
+#define SOCK_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING("Sock", PrintArg)
+#define SOCK_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE("Sock", PrintArg)
+
+#define SOCK_TRIM_RCV_BUFF(Sock, Len) \
+ (NetbufQueTrim ((Sock)->RcvBuffer.DataQueue, (Len)))
+
+#define SIGNAL_TOKEN(Token, TokenStatus) \
+ do { \
+ (Token)->Status = (TokenStatus); \
+ gBS->SignalEvent ((Token)->Event); \
+ } while (0)
+
+#define SOCK_HEADER_SPACE (60 + 60 + 72)
+
+//
+// Supporting function for both SockImpl and SockInterface
+//
+VOID
+SockFreeFoo (
+ IN EFI_EVENT Event
+ );
+
+EFI_STATUS
+SockProcessTcpSndData (
+ IN SOCKET *Sock,
+ IN VOID *TcpTxData
+ );
+
+VOID
+SockSetTcpRxData (
+ IN SOCKET *Sock,
+ IN VOID *TcpRxData,
+ IN UINT32 RcvdBytes,
+ IN BOOLEAN IsOOB
+ );
+
+UINT32
+SockProcessRcvToken (
+ IN SOCKET *Sock,
+ IN SOCK_IO_TOKEN *RcvToken
+ );
+
+VOID
+SockConnFlush (
+ IN SOCKET *Sock
+ );
+
+SOCKET *
+SockCreate (
+ IN SOCK_INIT_DATA *SockInitData
+ );
+
+VOID
+SockDestroy (
+ IN SOCKET *Sock
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
index 75efa045b1..34b098bcde 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h
@@ -1,520 +1,520 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Socket.h
-
-Abstract:
-
-
-**/
-
-#ifndef _SOCKET_H_
-#define _SOCKET_H_
-
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Socket.h
+
+Abstract:
+
+
+**/
+
+#ifndef _SOCKET_H_
+#define _SOCKET_H_
+
#include <PiDxe.h>
#include <Protocol/IP4.h>
-#include <Protocol/Tcp4.h>
+#include <Protocol/Tcp4.h>
#include <Protocol/Udp4.h>
-
+
#include <Library/NetLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/BaseMemoryLib.h>
-
-#define SOCK_SND_BUF 0
-#define SOCK_RCV_BUF 1
-
-#define SOCK_BUFF_LOW_WATER 2 * 1024
-#define SOCK_RCV_BUFF_SIZE 8 * 1024
-#define SOCK_SND_BUFF_SIZE 8 * 1024
-#define SOCK_BACKLOG 5
-
-#define PROTO_RESERVED_LEN 20
-
-#define SO_NO_MORE_DATA 0x0001
-
-//
-//
-//
-// When a socket is created it enters into SO_UNCONFIGURED,
-// no actions can be taken on this socket, only after calling
-// SockConfigure. The state transition diagram of socket is
-// as following:
-//
-// SO_UNCONFIGURED --- SO_CONFIGURED --- SO_CONNECTING
-// ^ | |
-// | ---> SO_LISTENING |
-// | |
-// |------------------SO_DISCONNECTING<-- SO_CONNECTED
-//
-// A passive socket can only go into SO_LISTENING and
-// SO_UNCONFIGURED state. SO_XXXING state is a middle state
-// when a socket is undergoing a protocol procedure such
-// as requesting a TCP connection.
-//
-//
-//
-typedef enum {
- SO_CLOSED = 0,
- SO_LISTENING,
- SO_CONNECTING,
- SO_CONNECTED,
- SO_DISCONNECTING
-} SOCK_STATE;
-
-typedef enum {
- SO_UNCONFIGURED = 0,
- SO_CONFIGURED_ACTIVE,
- SO_CONFIGURED_PASSIVE,
- SO_NO_MAPPING
-} SOCK_CONFIGURE_STATE;
-
-#define SOCK_NO_MORE_DATA(Sock) ((Sock)->Flag |= SO_NO_MORE_DATA)
-
-#define SOCK_IS_UNCONFIGURED(Sock) ((Sock)->ConfigureState == SO_UNCONFIGURED)
-
-#define SOCK_IS_CONFIGURED(Sock) \
- (((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE) || \
- ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE))
-
-#define SOCK_IS_CONFIGURED_ACTIVE(Sock) \
- ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
-
-#define SOCK_IS_CONNECTED_PASSIVE(Sock) \
- ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
-
-#define SOCK_IS_NO_MAPPING(Sock) \
- ((Sock)->ConfigureState == SO_NO_MAPPING)
-
-#define SOCK_IS_CLOSED(Sock) ((Sock)->State == SO_CLOSED)
-
-#define SOCK_IS_LISTENING(Sock) ((Sock)->State == SO_LISTENING)
-
-#define SOCK_IS_CONNECTING(Sock) ((Sock)->State == SO_CONNECTING)
-
-#define SOCK_IS_CONNECTED(Sock) ((Sock)->State == SO_CONNECTED)
-
-#define SOCK_IS_DISCONNECTING(Sock) ((Sock)->State == SO_DISCONNECTING)
-
-#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
-
-#define SOCK_SIGNATURE EFI_SIGNATURE_32 ('S', 'O', 'C', 'K')
-
-#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
-
-#define SET_RCV_BUFFSIZE(Sock, Size) ((Sock)->RcvBuffer.HighWater = (Size))
-
-#define GET_RCV_BUFFSIZE(Sock) ((Sock)->RcvBuffer.HighWater)
-
-#define GET_RCV_DATASIZE(Sock) (((Sock)->RcvBuffer.DataQueue)->BufSize)
-
-#define SET_SND_BUFFSIZE(Sock, Size) ((Sock)->SndBuffer.HighWater = (Size))
-
-#define GET_SND_BUFFSIZE(Sock) ((Sock)->SndBuffer.HighWater)
-
-#define GET_SND_DATASIZE(Sock) (((Sock)->SndBuffer.DataQueue)->BufSize)
-
-#define SET_BACKLOG(Sock, Value) ((Sock)->BackLog = (Value))
-
-#define GET_BACKLOG(Sock) ((Sock)->BackLog)
-
-#define SOCK_ERROR(Sock, Error) ((Sock)->SockError = (Error))
-
-#define SND_BUF_HDR_LEN(Sock) \
- ((SockBufFirst (&((Sock)->SndBuffer)))->TotalSize)
-
-#define RCV_BUF_HDR_LEN(Sock) \
- ((SockBufFirst (&((Sock)->RcvBuffer)))->TotalSize)
-
-#define SOCK_FROM_TOKEN(Token) (((SOCK_TOKEN *) (Token))->Sock)
-
-#define PROTO_TOKEN_FORM_SOCK(SockToken, Type) \
- ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))
-
-typedef struct _SOCKET SOCKET;
-
-typedef struct _SOCK_COMPLETION_TOKEN {
- EFI_EVENT Event;
- EFI_STATUS Status;
-} SOCK_COMPLETION_TOKEN;
-
-typedef struct _SOCK_IO_TOKEN {
- SOCK_COMPLETION_TOKEN Token;
- union {
- VOID *RxData;
- VOID *TxData;
- } Packet;
-} SOCK_IO_TOKEN;
-
-//
-// the request issued from socket layer to protocol layer
-//
-typedef enum {
- SOCK_ATTACH, // attach current socket to a new PCB
- SOCK_DETACH, // detach current socket from the PCB
- SOCK_CONFIGURE, // configure attached PCB
- SOCK_FLUSH, // flush attached PCB
- SOCK_SND, // need protocol to send something
- SOCK_SNDPUSH, // need protocol to send pushed data
- SOCK_SNDURG, // need protocol to send urgent data
- SOCK_CONSUMED, // application has retrieved data from socket
- SOCK_CONNECT, // need to connect to a peer
- SOCK_CLOSE, // need to close the protocol process
- SOCK_ABORT, // need to reset the protocol process
- SOCK_POLL, // need to poll to the protocol layer
- SOCK_ROUTE, // need to add a route information
- SOCK_MODE, // need to get the mode data of the protocol
- SOCK_GROUP // need to join a mcast group
-} SOCK_REQUEST;
-
-//
-// the socket type
-//
-typedef enum {
- SOCK_DGRAM, // this socket providing datagram service
- SOCK_STREAM // this socket providing stream service
-} SOCK_TYPE;
-
-//
-// the handler of protocol for request from socket
-//
-typedef
-EFI_STATUS
-(*SOCK_PROTO_HANDLER) (
- IN SOCKET * Socket, // the socket issuing the request to protocol
- IN SOCK_REQUEST Request, // the request issued by socket
- IN VOID *RequestData // the request related data
- );
-
-//
-// the buffer structure of rcvd data and send data used by socket
-//
-typedef struct _SOCK_BUFFER {
- UINT32 HighWater; // the buffersize upper limit of sock_buffer
- UINT32 LowWater; // the low warter mark of sock_buffer
- NET_BUF_QUEUE *DataQueue; // the queue to buffer data
-} SOCK_BUFFER;
-
-//
-// the initialize data for create a new socket
-//
-typedef struct _SOCK_INIT_DATA {
- SOCK_TYPE Type;
- SOCK_STATE State;
-
- SOCKET *Parent; // the parent of this socket
- UINT32 BackLog; // the connection limit for listening socket
- UINT32 SndBufferSize; // the high warter mark of send buffer
- UINT32 RcvBufferSize; // the high warter mark of receive buffer
- VOID *Protocol; // the pointer to protocol function template
- // wanted to install on socket
-
- SOCK_PROTO_HANDLER ProtoHandler;
-
- EFI_HANDLE DriverBinding; // the driver binding handle
-} SOCK_INIT_DATA;
-
-//
-// socket provided oprerations for low layer protocol
-//
-
-//
-// socket provided operations for user interface
-//
-VOID
-SockSetState (
- IN SOCKET *Sock,
- IN SOCK_STATE State
- );
-
-//
-// when the connection establishment process for a Sock
-// is finished low layer protocol calling this function
-// to notify socket layer
-//
-VOID
-SockConnEstablished (
- IN SOCKET *Sock
- );
-
-VOID
-SockConnClosed (
- IN SOCKET *Sock
- );
-
-//
-// called by low layer protocol to trim send buffer of
-// Sock, when Count data is sent out completely
-//
-VOID
-SockDataSent (
- IN SOCKET *Sock,
- IN UINT32 Count
- );
-
-//
-// called by low layer protocol to get Len of data from
-// socket to send and copy it in Dest
-//
-UINT32
-SockGetDataToSend (
- IN SOCKET *Sock,
- IN UINT32 Offset,
- IN UINT32 Len,
- IN UINT8 *Dest
- );
-
-//
-// called by low layer protocol to notify socket no more data can be
-// received
-//
-VOID
-SockNoMoreData (
- IN SOCKET *Sock
- );
-
-//
-// called by low layer protocol to append a NetBuffer
-// to rcv buffer of sock
-//
-VOID
-SockDataRcvd (
- IN SOCKET *Sock,
- IN NET_BUF *NetBuffer,
- IN UINT32 UrgLen
- );
-
-UINT32
-SockGetFreeSpace (
- IN SOCKET *Sock,
- IN UINT32 Which
- );
-
-SOCKET *
-SockClone (
- IN SOCKET *Sock
- );
-
-VOID
-SockRcvdErr (
- IN SOCKET *Sock,
- IN EFI_STATUS Error
- );
-
-//
-// the socket structure representing a network service access point
-//
-struct _SOCKET {
-
- //
- // socket description information
- //
- UINT32 Signature;
- EFI_HANDLE SockHandle; // the virtual handle of the socket
- EFI_HANDLE DriverBinding; // socket't driver binding protocol
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- SOCK_CONFIGURE_STATE ConfigureState;
- SOCK_TYPE Type;
- SOCK_STATE State;
- UINT16 Flag;
- NET_LOCK Lock; // the lock of socket
- SOCK_BUFFER SndBuffer; // send buffer of application's data
- SOCK_BUFFER RcvBuffer; // receive buffer of received data
- EFI_STATUS SockError; // the error returned by low layer protocol
- BOOLEAN IsDestroyed;
-
- //
- // fields used to manage the connection request
- //
- UINT32 BackLog; // the limit of connection to this socket
- UINT32 ConnCnt; // the current count of connections to it
- SOCKET *Parent; // listening parent that accept the connection
- NET_LIST_ENTRY ConnectionList; // the connections maintained by this socket
- //
- // the queue to buffer application's asynchronous token
- //
- NET_LIST_ENTRY ListenTokenList;
- NET_LIST_ENTRY RcvTokenList;
- NET_LIST_ENTRY SndTokenList;
- NET_LIST_ENTRY ProcessingSndTokenList;
-
- SOCK_COMPLETION_TOKEN *ConnectionToken; // app's token to signal if connected
- SOCK_COMPLETION_TOKEN *CloseToken; // app's token to signal if closed
-
- //
- // interface for low level protocol
- //
- SOCK_PROTO_HANDLER ProtoHandler; // the request handler of protocol
- UINT8 ProtoReserved[PROTO_RESERVED_LEN]; // Data fields reserved for protocol
- union {
- EFI_TCP4_PROTOCOL TcpProtocol;
- EFI_UDP4_PROTOCOL UdpProtocol;
- } NetProtocol;
-};
-
-//
-// the token structure buffered in socket layer
-//
-typedef struct _SOCK_TOKEN {
- NET_LIST_ENTRY TokenList; // the entry to add in the token list
- SOCK_COMPLETION_TOKEN *Token; // The application's token
- UINT32 RemainDataLen; // unprocessed data length
- SOCKET *Sock; // the poninter to the socket this token
- // belongs to
-} SOCK_TOKEN;
-
-//
-// reserved data to access the NET_BUF delivered by UDP driver
-//
-typedef struct _UDP_RSV_DATA {
- EFI_TIME TimeStamp;
- EFI_UDP4_SESSION_DATA Session;
-} UDP_RSV_DATA;
-
-//
-// reserved data to access the NET_BUF delivered by TCP driver
-//
-typedef struct _TCP_RSV_DATA {
- UINT32 UrgLen;
-} TCP_RSV_DATA;
-
-//
-// call it to creat a socket and attach it to a PCB
-//
-SOCKET *
-SockCreateChild (
- IN SOCK_INIT_DATA *SockInitData,
- IN VOID *ProtoData,
- IN UINT32 Len
- );
-
-//
-// call it to destroy a socket and its related PCB
-//
-EFI_STATUS
-SockDestroyChild (
- IN SOCKET *Sock
- );
-
-//
-// call it to configure a socket and its related PCB
-//
-EFI_STATUS
-SockConfigure (
- IN SOCKET *Sock,
- IN VOID *ConfigData
- );
-
-//
-// call it to connect a socket to the peer
-//
-EFI_STATUS
-SockConnect (
- IN SOCKET *Sock,
- IN VOID *Token
- );
-
-//
-// call it to issue an asynchronous listen token to the socket
-//
-EFI_STATUS
-SockAccept (
- IN SOCKET *Sock,
- IN VOID *Token
- );
-
-//
-// Call it to send data using this socket
-//
-EFI_STATUS
-SockSend (
- IN SOCKET *Sock,
- IN VOID *Token
- );
-
-//
-// Call it to receive data from this socket
-//
-EFI_STATUS
-SockRcv (
- IN SOCKET *Sock,
- IN VOID *Token
- );
-
-//
-// Call it to flush a socket
-//
-EFI_STATUS
-SockFlush (
- IN SOCKET *Sock
- );
-
-//
-// Call it to close a socket in the light of policy in Token
-//
-EFI_STATUS
-SockClose (
- IN SOCKET *Sock,
- IN VOID *Token,
- IN BOOLEAN OnAbort
- );
-
-//
-// Call it to get the mode data of low layer protocol
-//
-EFI_STATUS
-SockGetMode (
- IN SOCKET *Sock,
- IN VOID *Mode
- );
-
-//
-// call it to add this socket instance into a group
-//
-EFI_STATUS
-SockGroup (
- IN SOCKET *Sock,
- IN VOID *GroupInfo
- );
-
-//
-// call it to add a route entry for this socket instance
-//
-EFI_STATUS
-SockRoute (
- IN SOCKET *Sock,
- IN VOID *RouteInfo
- );
-
-//
-// Supporting function to operate on socket buffer
-//
-NET_BUF *
-SockBufFirst (
- IN SOCK_BUFFER *Sockbuf
- );
-
-NET_BUF *
-SockBufNext (
- IN SOCK_BUFFER *Sockbuf,
- IN NET_BUF *SockEntry
- );
-
-#endif
+#include <Library/UefiLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+
+#define SOCK_SND_BUF 0
+#define SOCK_RCV_BUF 1
+
+#define SOCK_BUFF_LOW_WATER 2 * 1024
+#define SOCK_RCV_BUFF_SIZE 8 * 1024
+#define SOCK_SND_BUFF_SIZE 8 * 1024
+#define SOCK_BACKLOG 5
+
+#define PROTO_RESERVED_LEN 20
+
+#define SO_NO_MORE_DATA 0x0001
+
+//
+//
+//
+// When a socket is created it enters into SO_UNCONFIGURED,
+// no actions can be taken on this socket, only after calling
+// SockConfigure. The state transition diagram of socket is
+// as following:
+//
+// SO_UNCONFIGURED --- SO_CONFIGURED --- SO_CONNECTING
+// ^ | |
+// | ---> SO_LISTENING |
+// | |
+// |------------------SO_DISCONNECTING<-- SO_CONNECTED
+//
+// A passive socket can only go into SO_LISTENING and
+// SO_UNCONFIGURED state. SO_XXXING state is a middle state
+// when a socket is undergoing a protocol procedure such
+// as requesting a TCP connection.
+//
+//
+//
+typedef enum {
+ SO_CLOSED = 0,
+ SO_LISTENING,
+ SO_CONNECTING,
+ SO_CONNECTED,
+ SO_DISCONNECTING
+} SOCK_STATE;
+
+typedef enum {
+ SO_UNCONFIGURED = 0,
+ SO_CONFIGURED_ACTIVE,
+ SO_CONFIGURED_PASSIVE,
+ SO_NO_MAPPING
+} SOCK_CONFIGURE_STATE;
+
+#define SOCK_NO_MORE_DATA(Sock) ((Sock)->Flag |= SO_NO_MORE_DATA)
+
+#define SOCK_IS_UNCONFIGURED(Sock) ((Sock)->ConfigureState == SO_UNCONFIGURED)
+
+#define SOCK_IS_CONFIGURED(Sock) \
+ (((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE) || \
+ ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE))
+
+#define SOCK_IS_CONFIGURED_ACTIVE(Sock) \
+ ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
+
+#define SOCK_IS_CONNECTED_PASSIVE(Sock) \
+ ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
+
+#define SOCK_IS_NO_MAPPING(Sock) \
+ ((Sock)->ConfigureState == SO_NO_MAPPING)
+
+#define SOCK_IS_CLOSED(Sock) ((Sock)->State == SO_CLOSED)
+
+#define SOCK_IS_LISTENING(Sock) ((Sock)->State == SO_LISTENING)
+
+#define SOCK_IS_CONNECTING(Sock) ((Sock)->State == SO_CONNECTING)
+
+#define SOCK_IS_CONNECTED(Sock) ((Sock)->State == SO_CONNECTED)
+
+#define SOCK_IS_DISCONNECTING(Sock) ((Sock)->State == SO_DISCONNECTING)
+
+#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
+
+#define SOCK_SIGNATURE EFI_SIGNATURE_32 ('S', 'O', 'C', 'K')
+
+#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
+
+#define SET_RCV_BUFFSIZE(Sock, Size) ((Sock)->RcvBuffer.HighWater = (Size))
+
+#define GET_RCV_BUFFSIZE(Sock) ((Sock)->RcvBuffer.HighWater)
+
+#define GET_RCV_DATASIZE(Sock) (((Sock)->RcvBuffer.DataQueue)->BufSize)
+
+#define SET_SND_BUFFSIZE(Sock, Size) ((Sock)->SndBuffer.HighWater = (Size))
+
+#define GET_SND_BUFFSIZE(Sock) ((Sock)->SndBuffer.HighWater)
+
+#define GET_SND_DATASIZE(Sock) (((Sock)->SndBuffer.DataQueue)->BufSize)
+
+#define SET_BACKLOG(Sock, Value) ((Sock)->BackLog = (Value))
+
+#define GET_BACKLOG(Sock) ((Sock)->BackLog)
+
+#define SOCK_ERROR(Sock, Error) ((Sock)->SockError = (Error))
+
+#define SND_BUF_HDR_LEN(Sock) \
+ ((SockBufFirst (&((Sock)->SndBuffer)))->TotalSize)
+
+#define RCV_BUF_HDR_LEN(Sock) \
+ ((SockBufFirst (&((Sock)->RcvBuffer)))->TotalSize)
+
+#define SOCK_FROM_TOKEN(Token) (((SOCK_TOKEN *) (Token))->Sock)
+
+#define PROTO_TOKEN_FORM_SOCK(SockToken, Type) \
+ ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))
+
+typedef struct _SOCKET SOCKET;
+
+typedef struct _SOCK_COMPLETION_TOKEN {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+} SOCK_COMPLETION_TOKEN;
+
+typedef struct _SOCK_IO_TOKEN {
+ SOCK_COMPLETION_TOKEN Token;
+ union {
+ VOID *RxData;
+ VOID *TxData;
+ } Packet;
+} SOCK_IO_TOKEN;
+
+//
+// the request issued from socket layer to protocol layer
+//
+typedef enum {
+ SOCK_ATTACH, // attach current socket to a new PCB
+ SOCK_DETACH, // detach current socket from the PCB
+ SOCK_CONFIGURE, // configure attached PCB
+ SOCK_FLUSH, // flush attached PCB
+ SOCK_SND, // need protocol to send something
+ SOCK_SNDPUSH, // need protocol to send pushed data
+ SOCK_SNDURG, // need protocol to send urgent data
+ SOCK_CONSUMED, // application has retrieved data from socket
+ SOCK_CONNECT, // need to connect to a peer
+ SOCK_CLOSE, // need to close the protocol process
+ SOCK_ABORT, // need to reset the protocol process
+ SOCK_POLL, // need to poll to the protocol layer
+ SOCK_ROUTE, // need to add a route information
+ SOCK_MODE, // need to get the mode data of the protocol
+ SOCK_GROUP // need to join a mcast group
+} SOCK_REQUEST;
+
+//
+// the socket type
+//
+typedef enum {
+ SOCK_DGRAM, // this socket providing datagram service
+ SOCK_STREAM // this socket providing stream service
+} SOCK_TYPE;
+
+//
+// the handler of protocol for request from socket
+//
+typedef
+EFI_STATUS
+(*SOCK_PROTO_HANDLER) (
+ IN SOCKET * Socket, // the socket issuing the request to protocol
+ IN SOCK_REQUEST Request, // the request issued by socket
+ IN VOID *RequestData // the request related data
+ );
+
+//
+// the buffer structure of rcvd data and send data used by socket
+//
+typedef struct _SOCK_BUFFER {
+ UINT32 HighWater; // the buffersize upper limit of sock_buffer
+ UINT32 LowWater; // the low warter mark of sock_buffer
+ NET_BUF_QUEUE *DataQueue; // the queue to buffer data
+} SOCK_BUFFER;
+
+//
+// the initialize data for create a new socket
+//
+typedef struct _SOCK_INIT_DATA {
+ SOCK_TYPE Type;
+ SOCK_STATE State;
+
+ SOCKET *Parent; // the parent of this socket
+ UINT32 BackLog; // the connection limit for listening socket
+ UINT32 SndBufferSize; // the high warter mark of send buffer
+ UINT32 RcvBufferSize; // the high warter mark of receive buffer
+ VOID *Protocol; // the pointer to protocol function template
+ // wanted to install on socket
+
+ SOCK_PROTO_HANDLER ProtoHandler;
+
+ EFI_HANDLE DriverBinding; // the driver binding handle
+} SOCK_INIT_DATA;
+
+//
+// socket provided oprerations for low layer protocol
+//
+
+//
+// socket provided operations for user interface
+//
+VOID
+SockSetState (
+ IN SOCKET *Sock,
+ IN SOCK_STATE State
+ );
+
+//
+// when the connection establishment process for a Sock
+// is finished low layer protocol calling this function
+// to notify socket layer
+//
+VOID
+SockConnEstablished (
+ IN SOCKET *Sock
+ );
+
+VOID
+SockConnClosed (
+ IN SOCKET *Sock
+ );
+
+//
+// called by low layer protocol to trim send buffer of
+// Sock, when Count data is sent out completely
+//
+VOID
+SockDataSent (
+ IN SOCKET *Sock,
+ IN UINT32 Count
+ );
+
+//
+// called by low layer protocol to get Len of data from
+// socket to send and copy it in Dest
+//
+UINT32
+SockGetDataToSend (
+ IN SOCKET *Sock,
+ IN UINT32 Offset,
+ IN UINT32 Len,
+ IN UINT8 *Dest
+ );
+
+//
+// called by low layer protocol to notify socket no more data can be
+// received
+//
+VOID
+SockNoMoreData (
+ IN SOCKET *Sock
+ );
+
+//
+// called by low layer protocol to append a NetBuffer
+// to rcv buffer of sock
+//
+VOID
+SockDataRcvd (
+ IN SOCKET *Sock,
+ IN NET_BUF *NetBuffer,
+ IN UINT32 UrgLen
+ );
+
+UINT32
+SockGetFreeSpace (
+ IN SOCKET *Sock,
+ IN UINT32 Which
+ );
+
+SOCKET *
+SockClone (
+ IN SOCKET *Sock
+ );
+
+VOID
+SockRcvdErr (
+ IN SOCKET *Sock,
+ IN EFI_STATUS Error
+ );
+
+//
+// the socket structure representing a network service access point
+//
+struct _SOCKET {
+
+ //
+ // socket description information
+ //
+ UINT32 Signature;
+ EFI_HANDLE SockHandle; // the virtual handle of the socket
+ EFI_HANDLE DriverBinding; // socket't driver binding protocol
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ SOCK_CONFIGURE_STATE ConfigureState;
+ SOCK_TYPE Type;
+ SOCK_STATE State;
+ UINT16 Flag;
+ NET_LOCK Lock; // the lock of socket
+ SOCK_BUFFER SndBuffer; // send buffer of application's data
+ SOCK_BUFFER RcvBuffer; // receive buffer of received data
+ EFI_STATUS SockError; // the error returned by low layer protocol
+ BOOLEAN IsDestroyed;
+
+ //
+ // fields used to manage the connection request
+ //
+ UINT32 BackLog; // the limit of connection to this socket
+ UINT32 ConnCnt; // the current count of connections to it
+ SOCKET *Parent; // listening parent that accept the connection
+ NET_LIST_ENTRY ConnectionList; // the connections maintained by this socket
+ //
+ // the queue to buffer application's asynchronous token
+ //
+ NET_LIST_ENTRY ListenTokenList;
+ NET_LIST_ENTRY RcvTokenList;
+ NET_LIST_ENTRY SndTokenList;
+ NET_LIST_ENTRY ProcessingSndTokenList;
+
+ SOCK_COMPLETION_TOKEN *ConnectionToken; // app's token to signal if connected
+ SOCK_COMPLETION_TOKEN *CloseToken; // app's token to signal if closed
+
+ //
+ // interface for low level protocol
+ //
+ SOCK_PROTO_HANDLER ProtoHandler; // the request handler of protocol
+ UINT8 ProtoReserved[PROTO_RESERVED_LEN]; // Data fields reserved for protocol
+ union {
+ EFI_TCP4_PROTOCOL TcpProtocol;
+ EFI_UDP4_PROTOCOL UdpProtocol;
+ } NetProtocol;
+};
+
+//
+// the token structure buffered in socket layer
+//
+typedef struct _SOCK_TOKEN {
+ NET_LIST_ENTRY TokenList; // the entry to add in the token list
+ SOCK_COMPLETION_TOKEN *Token; // The application's token
+ UINT32 RemainDataLen; // unprocessed data length
+ SOCKET *Sock; // the poninter to the socket this token
+ // belongs to
+} SOCK_TOKEN;
+
+//
+// reserved data to access the NET_BUF delivered by UDP driver
+//
+typedef struct _UDP_RSV_DATA {
+ EFI_TIME TimeStamp;
+ EFI_UDP4_SESSION_DATA Session;
+} UDP_RSV_DATA;
+
+//
+// reserved data to access the NET_BUF delivered by TCP driver
+//
+typedef struct _TCP_RSV_DATA {
+ UINT32 UrgLen;
+} TCP_RSV_DATA;
+
+//
+// call it to creat a socket and attach it to a PCB
+//
+SOCKET *
+SockCreateChild (
+ IN SOCK_INIT_DATA *SockInitData,
+ IN VOID *ProtoData,
+ IN UINT32 Len
+ );
+
+//
+// call it to destroy a socket and its related PCB
+//
+EFI_STATUS
+SockDestroyChild (
+ IN SOCKET *Sock
+ );
+
+//
+// call it to configure a socket and its related PCB
+//
+EFI_STATUS
+SockConfigure (
+ IN SOCKET *Sock,
+ IN VOID *ConfigData
+ );
+
+//
+// call it to connect a socket to the peer
+//
+EFI_STATUS
+SockConnect (
+ IN SOCKET *Sock,
+ IN VOID *Token
+ );
+
+//
+// call it to issue an asynchronous listen token to the socket
+//
+EFI_STATUS
+SockAccept (
+ IN SOCKET *Sock,
+ IN VOID *Token
+ );
+
+//
+// Call it to send data using this socket
+//
+EFI_STATUS
+SockSend (
+ IN SOCKET *Sock,
+ IN VOID *Token
+ );
+
+//
+// Call it to receive data from this socket
+//
+EFI_STATUS
+SockRcv (
+ IN SOCKET *Sock,
+ IN VOID *Token
+ );
+
+//
+// Call it to flush a socket
+//
+EFI_STATUS
+SockFlush (
+ IN SOCKET *Sock
+ );
+
+//
+// Call it to close a socket in the light of policy in Token
+//
+EFI_STATUS
+SockClose (
+ IN SOCKET *Sock,
+ IN VOID *Token,
+ IN BOOLEAN OnAbort
+ );
+
+//
+// Call it to get the mode data of low layer protocol
+//
+EFI_STATUS
+SockGetMode (
+ IN SOCKET *Sock,
+ IN VOID *Mode
+ );
+
+//
+// call it to add this socket instance into a group
+//
+EFI_STATUS
+SockGroup (
+ IN SOCKET *Sock,
+ IN VOID *GroupInfo
+ );
+
+//
+// call it to add a route entry for this socket instance
+//
+EFI_STATUS
+SockRoute (
+ IN SOCKET *Sock,
+ IN VOID *RouteInfo
+ );
+
+//
+// Supporting function to operate on socket buffer
+//
+NET_BUF *
+SockBufFirst (
+ IN SOCK_BUFFER *Sockbuf
+ );
+
+NET_BUF *
+SockBufNext (
+ IN SOCK_BUFFER *Sockbuf,
+ IN NET_BUF *SockEntry
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
index bbd5a30a7b..a8185b0b92 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
@@ -22,7 +22,8 @@ Abstract:
UINT16 mTcp4RandomPort;
-extern EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName;
+extern EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gTcp4ComponentName2;
TCP4_HEARTBEAT_TIMER mTcp4Timer = {
NULL,
@@ -176,14 +177,13 @@ Returns:
//
// Install the TCP4 Driver Binding Protocol
//
- Status = EfiLibInstallAllDriverProtocols (
+ Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&mTcp4DriverBinding,
ImageHandle,
&gTcp4ComponentName,
- NULL,
- NULL
+ &gTcp4ComponentName2
);
ASSERT_EFI_ERROR (Status);
//
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h
index af3444ef58..28fe53dc5a 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h
@@ -1,141 +1,141 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Tcp4Driver.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_DRIVER_H_
-#define _TCP4_DRIVER_H_
-
-#include <Protocol/ServiceBinding.h>
-#include <Library/IpIoLib.h>
-
-#define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
-
-#define TCP4_PORT_KNOWN 1024
-#define TCP4_PORT_USER_RESERVED 65535
-
-typedef struct _TCP4_HEARTBEAT_TIMER {
- EFI_EVENT TimerEvent;
- INTN RefCnt;
-} TCP4_HEARTBEAT_TIMER;
-
-typedef struct _TCP4_SERVICE_DATA {
- UINT32 Signature;
- EFI_HANDLE ControllerHandle;
- IP_IO *IpIo; // IP Io consumed by TCP4
- EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
- EFI_HANDLE DriverBindingHandle;
- CHAR16 *MacString;
-} TCP4_SERVICE_DATA;
-
-//
-// Prototype for TCP4 driver Rcv callback function registered to IP_IO
-//
-VOID
-Tcp4RxCallback (
- IN EFI_STATUS Status,
- IN ICMP_ERROR IcmpErr,
- IN EFI_NET_SESSION_DATA *NetSession,
- IN NET_BUF *Pkt,
- IN VOID *Context OPTIONAL
- );
-
-INTN
-TcpSendIpPacket (
- IN TCP_CB *Tcb,
- IN NET_BUF *Nbuf,
- IN UINT32 Src,
- IN UINT32 Dest
- );
-
-EFI_STATUS
-Tcp4Dispatcher (
- IN SOCKET *Sock,
- IN SOCK_REQUEST Request,
- IN VOID *Data OPTIONAL
- );
-
-typedef struct _TCP4_PROTO_DATA {
- TCP4_SERVICE_DATA *TcpService;
- TCP_CB *TcpPcb;
-} TCP4_PROTO_DATA;
-
-#define TCP4_FROM_THIS(a) \
- CR ( \
- (a), \
- TCP4_SERVICE_DATA, \
- Tcp4ServiceBinding, \
- TCP4_DRIVER_SIGNATURE \
- )
-
-//
-// Function prototype for the driver's entry point
-//
-EFI_STATUS
-EFIAPI
-Tcp4DriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-//
-// Function prototypes for the Drivr Binding Protocol
-//
-EFI_STATUS
-EFIAPI
-Tcp4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Tcp4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Tcp4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// Function ptototypes for the ServiceBinding Prococol
-//
-EFI_STATUS
-EFIAPI
-Tcp4ServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-Tcp4ServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Tcp4Driver.h
+
+Abstract:
+
+
+**/
+
+#ifndef _TCP4_DRIVER_H_
+#define _TCP4_DRIVER_H_
+
+#include <Protocol/ServiceBinding.h>
+#include <Library/IpIoLib.h>
+
+#define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
+
+#define TCP4_PORT_KNOWN 1024
+#define TCP4_PORT_USER_RESERVED 65535
+
+typedef struct _TCP4_HEARTBEAT_TIMER {
+ EFI_EVENT TimerEvent;
+ INTN RefCnt;
+} TCP4_HEARTBEAT_TIMER;
+
+typedef struct _TCP4_SERVICE_DATA {
+ UINT32 Signature;
+ EFI_HANDLE ControllerHandle;
+ IP_IO *IpIo; // IP Io consumed by TCP4
+ EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
+ EFI_HANDLE DriverBindingHandle;
+ CHAR16 *MacString;
+} TCP4_SERVICE_DATA;
+
+//
+// Prototype for TCP4 driver Rcv callback function registered to IP_IO
+//
+VOID
+Tcp4RxCallback (
+ IN EFI_STATUS Status,
+ IN ICMP_ERROR IcmpErr,
+ IN EFI_NET_SESSION_DATA *NetSession,
+ IN NET_BUF *Pkt,
+ IN VOID *Context OPTIONAL
+ );
+
+INTN
+TcpSendIpPacket (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Nbuf,
+ IN UINT32 Src,
+ IN UINT32 Dest
+ );
+
+EFI_STATUS
+Tcp4Dispatcher (
+ IN SOCKET *Sock,
+ IN SOCK_REQUEST Request,
+ IN VOID *Data OPTIONAL
+ );
+
+typedef struct _TCP4_PROTO_DATA {
+ TCP4_SERVICE_DATA *TcpService;
+ TCP_CB *TcpPcb;
+} TCP4_PROTO_DATA;
+
+#define TCP4_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ TCP4_SERVICE_DATA, \
+ Tcp4ServiceBinding, \
+ TCP4_DRIVER_SIGNATURE \
+ )
+
+//
+// Function prototype for the driver's entry point
+//
+EFI_STATUS
+EFIAPI
+Tcp4DriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+//
+// Function prototypes for the Drivr Binding Protocol
+//
+EFI_STATUS
+EFIAPI
+Tcp4DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Tcp4DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Tcp4DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+//
+// Function ptototypes for the ServiceBinding Prococol
+//
+EFI_STATUS
+EFIAPI
+Tcp4ServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+Tcp4ServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
index be99f3bf47..5bfdf2612d 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
@@ -1,358 +1,358 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Tcp4Func.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_FUNC_H_
-#define _TCP4_FUNC_H_
-
-//
-// Declaration of all the functions in TCP
-// protocol. It is intended to keep tcp.h
-// clear.
-//
-
-//
-// Functions in tcp.c
-//
-BOOLEAN
-TcpFindTcbByPeer (
- IN EFI_IPv4_ADDRESS *Addr,
- IN TCP_PORTNO Port
- );
-
-TCP_CB *
-TcpLocateTcb (
- IN TCP_PORTNO LocalPort,
- IN UINT32 LocalIp,
- IN TCP_PORTNO RemotePort,
- IN UINT32 RemoteIp,
- IN BOOLEAN Syn
- );
-
-INTN
-TcpInsertTcb (
- IN TCP_CB *Tcb
- );
-
-TCP_CB *
-TcpCloneTcb (
- IN TCP_CB *Tcb
- );
-
-TCP_SEQNO
-TcpGetIss (
- VOID
- );
-
-VOID
-TcpInitTcbLocal (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpInitTcbPeer (
- IN TCP_CB *Tcb,
- IN TCP_SEG *Seg,
- IN TCP_OPTION *Opt
- );
-
-UINT16
-TcpGetRcvMss (
- IN SOCKET *Sock
- );
-
-VOID
-TcpSetState (
- IN TCP_CB *Tcb,
- IN UINT8 State
- );
-
-//
-// Functions in Tcp4Output.c
-//
-INTN
-TcpSendIpPacket (
- IN TCP_CB *Tcb,
- IN NET_BUF *Nbuf,
- IN UINT32 Src,
- IN UINT32 Dst
- );
-
-INTN
-TcpToSendData (
- IN TCP_CB *Tcb,
- IN INTN Force
- );
-
-VOID
-TcpToSendAck (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpSendAck (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpSendZeroProbe (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpDeliverData (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpSendReset (
- IN TCP_CB *Tcb,
- IN TCP_HEAD *Head,
- IN INT32 Len,
- IN UINT32 Local,
- IN UINT32 Remote
- );
-
-UINT32
-TcpRcvWinOld (
- IN TCP_CB *Tcb
- );
-
-UINT32
-TcpRcvWinNow (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpRetransmit (
- IN TCP_CB *Tcb,
- IN TCP_SEQNO Seq
- );
-
-UINT32
-TcpDataToSend (
- IN TCP_CB *Tcb,
- IN INTN Force
- );
-
-INTN
-TcpVerifySegment (
- IN NET_BUF *Nbuf
- );
-
-INTN
-TcpCheckSndQue (
- IN NET_LIST_ENTRY *Head
- );
-
-NET_BUF *
-TcpGetSegmentSndQue (
- IN TCP_CB *Tcb,
- IN TCP_SEQNO Seq,
- IN UINT32 Len
- );
-
-NET_BUF *
-TcpGetSegmentSock (
- IN TCP_CB *Tcb,
- IN TCP_SEQNO Seq,
- IN UINT32 Len
- );
-
-NET_BUF *
-TcpGetSegment (
- IN TCP_CB *Tcb,
- IN TCP_SEQNO Seq,
- IN UINT32 Len
- );
-
-TCP_SEQNO
-TcpGetMaxSndNxt (
- IN TCP_CB *Tcb
- );
-
-//
-// Functions from Tcp4Input.c
-//
-VOID
-TcpIcmpInput (
- IN NET_BUF *Nbuf,
- IN ICMP_ERROR IcmpErr,
- IN UINT32 Src,
- IN UINT32 Dst
- );
-
-INTN
-TcpInput (
- IN NET_BUF *Nbuf,
- IN UINT32 Src,
- IN UINT32 Dst
- );
-
-INTN
-TcpSeqAcceptable (
- IN TCP_CB *Tcb,
- IN TCP_SEG *Seg
- );
-
-VOID
-TcpFastRecover (
- IN TCP_CB *Tcb,
- IN TCP_SEG *Seg
- );
-
-VOID
-TcpFastLossRecover (
- IN TCP_CB *Tcb,
- IN TCP_SEG *Seg
- );
-
-VOID
-TcpComputeRtt (
- IN TCP_CB *Tcb,
- IN UINT32 Measure
- );
-
-INTN
-TcpTrimInWnd (
- IN TCP_CB *Tcb,
- IN NET_BUF *Buf
- );
-
-VOID
-TcpQueueData (
- IN TCP_CB *Tcb,
- IN NET_BUF *Nbuf
- );
-
-VOID
-TcpAdjustSndQue (
- IN TCP_CB *Tcb,
- IN TCP_SEQNO Ack
- );
-
-//
-// Functions from Tcp4Misc.c
-//
-UINT16
-TcpChecksum (
- IN NET_BUF *Buf,
- IN UINT16 HeadChecksum
- );
-
-TCP_SEG *
-TcpFormatNetbuf (
- IN TCP_CB *Tcb,
- IN NET_BUF *Nbuf
- );
-
-VOID
-TcpOnAppConnect (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpOnAppConsume (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpOnAppClose (
- IN TCP_CB *Tcb
- );
-
-INTN
-TcpOnAppSend (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpOnAppAbort (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpResetConnection (
- IN TCP_CB *Tcb
- );
-
-//
-// Functions in Tcp4Timer.c
-//
-VOID
-TcpClose (
- IN TCP_CB *Tcb
- );
-
-VOID
-EFIAPI
-TcpTicking (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-VOID
-TcpSetTimer (
- IN TCP_CB *Tcb,
- IN UINT16 Timer,
- IN UINT32 TimeOut
- );
-
-VOID
-TcpClearTimer (
- IN TCP_CB *Tcb,
- IN UINT16 Timer
- );
-
-VOID
-TcpClearAllTimer (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpSetProbeTimer (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpSetKeepaliveTimer (
- IN TCP_CB *Tcb
- );
-
-VOID
-TcpBackoffRto (
- IN TCP_CB *Tcb
- );
-
-EFI_STATUS
-TcpSetVariableData (
- IN TCP4_SERVICE_DATA *Tcp4Service
- );
-
-VOID
-TcpClearVariableData (
- IN TCP4_SERVICE_DATA *Tcp4Service
- );
-
-EFI_STATUS
-TcpInstallDevicePath (
- IN SOCKET *Sock
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Tcp4Func.h
+
+Abstract:
+
+
+**/
+
+#ifndef _TCP4_FUNC_H_
+#define _TCP4_FUNC_H_
+
+//
+// Declaration of all the functions in TCP
+// protocol. It is intended to keep tcp.h
+// clear.
+//
+
+//
+// Functions in tcp.c
+//
+BOOLEAN
+TcpFindTcbByPeer (
+ IN EFI_IPv4_ADDRESS *Addr,
+ IN TCP_PORTNO Port
+ );
+
+TCP_CB *
+TcpLocateTcb (
+ IN TCP_PORTNO LocalPort,
+ IN UINT32 LocalIp,
+ IN TCP_PORTNO RemotePort,
+ IN UINT32 RemoteIp,
+ IN BOOLEAN Syn
+ );
+
+INTN
+TcpInsertTcb (
+ IN TCP_CB *Tcb
+ );
+
+TCP_CB *
+TcpCloneTcb (
+ IN TCP_CB *Tcb
+ );
+
+TCP_SEQNO
+TcpGetIss (
+ VOID
+ );
+
+VOID
+TcpInitTcbLocal (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpInitTcbPeer (
+ IN TCP_CB *Tcb,
+ IN TCP_SEG *Seg,
+ IN TCP_OPTION *Opt
+ );
+
+UINT16
+TcpGetRcvMss (
+ IN SOCKET *Sock
+ );
+
+VOID
+TcpSetState (
+ IN TCP_CB *Tcb,
+ IN UINT8 State
+ );
+
+//
+// Functions in Tcp4Output.c
+//
+INTN
+TcpSendIpPacket (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Nbuf,
+ IN UINT32 Src,
+ IN UINT32 Dst
+ );
+
+INTN
+TcpToSendData (
+ IN TCP_CB *Tcb,
+ IN INTN Force
+ );
+
+VOID
+TcpToSendAck (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpSendAck (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpSendZeroProbe (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpDeliverData (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpSendReset (
+ IN TCP_CB *Tcb,
+ IN TCP_HEAD *Head,
+ IN INT32 Len,
+ IN UINT32 Local,
+ IN UINT32 Remote
+ );
+
+UINT32
+TcpRcvWinOld (
+ IN TCP_CB *Tcb
+ );
+
+UINT32
+TcpRcvWinNow (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpRetransmit (
+ IN TCP_CB *Tcb,
+ IN TCP_SEQNO Seq
+ );
+
+UINT32
+TcpDataToSend (
+ IN TCP_CB *Tcb,
+ IN INTN Force
+ );
+
+INTN
+TcpVerifySegment (
+ IN NET_BUF *Nbuf
+ );
+
+INTN
+TcpCheckSndQue (
+ IN NET_LIST_ENTRY *Head
+ );
+
+NET_BUF *
+TcpGetSegmentSndQue (
+ IN TCP_CB *Tcb,
+ IN TCP_SEQNO Seq,
+ IN UINT32 Len
+ );
+
+NET_BUF *
+TcpGetSegmentSock (
+ IN TCP_CB *Tcb,
+ IN TCP_SEQNO Seq,
+ IN UINT32 Len
+ );
+
+NET_BUF *
+TcpGetSegment (
+ IN TCP_CB *Tcb,
+ IN TCP_SEQNO Seq,
+ IN UINT32 Len
+ );
+
+TCP_SEQNO
+TcpGetMaxSndNxt (
+ IN TCP_CB *Tcb
+ );
+
+//
+// Functions from Tcp4Input.c
+//
+VOID
+TcpIcmpInput (
+ IN NET_BUF *Nbuf,
+ IN ICMP_ERROR IcmpErr,
+ IN UINT32 Src,
+ IN UINT32 Dst
+ );
+
+INTN
+TcpInput (
+ IN NET_BUF *Nbuf,
+ IN UINT32 Src,
+ IN UINT32 Dst
+ );
+
+INTN
+TcpSeqAcceptable (
+ IN TCP_CB *Tcb,
+ IN TCP_SEG *Seg
+ );
+
+VOID
+TcpFastRecover (
+ IN TCP_CB *Tcb,
+ IN TCP_SEG *Seg
+ );
+
+VOID
+TcpFastLossRecover (
+ IN TCP_CB *Tcb,
+ IN TCP_SEG *Seg
+ );
+
+VOID
+TcpComputeRtt (
+ IN TCP_CB *Tcb,
+ IN UINT32 Measure
+ );
+
+INTN
+TcpTrimInWnd (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Buf
+ );
+
+VOID
+TcpQueueData (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Nbuf
+ );
+
+VOID
+TcpAdjustSndQue (
+ IN TCP_CB *Tcb,
+ IN TCP_SEQNO Ack
+ );
+
+//
+// Functions from Tcp4Misc.c
+//
+UINT16
+TcpChecksum (
+ IN NET_BUF *Buf,
+ IN UINT16 HeadChecksum
+ );
+
+TCP_SEG *
+TcpFormatNetbuf (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Nbuf
+ );
+
+VOID
+TcpOnAppConnect (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpOnAppConsume (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpOnAppClose (
+ IN TCP_CB *Tcb
+ );
+
+INTN
+TcpOnAppSend (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpOnAppAbort (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpResetConnection (
+ IN TCP_CB *Tcb
+ );
+
+//
+// Functions in Tcp4Timer.c
+//
+VOID
+TcpClose (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+EFIAPI
+TcpTicking (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+TcpSetTimer (
+ IN TCP_CB *Tcb,
+ IN UINT16 Timer,
+ IN UINT32 TimeOut
+ );
+
+VOID
+TcpClearTimer (
+ IN TCP_CB *Tcb,
+ IN UINT16 Timer
+ );
+
+VOID
+TcpClearAllTimer (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpSetProbeTimer (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpSetKeepaliveTimer (
+ IN TCP_CB *Tcb
+ );
+
+VOID
+TcpBackoffRto (
+ IN TCP_CB *Tcb
+ );
+
+EFI_STATUS
+TcpSetVariableData (
+ IN TCP4_SERVICE_DATA *Tcp4Service
+ );
+
+VOID
+TcpClearVariableData (
+ IN TCP4_SERVICE_DATA *Tcp4Service
+ );
+
+EFI_STATUS
+TcpInstallDevicePath (
+ IN SOCKET *Sock
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.h
index 3e6575be92..3e0b9db498 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.h
@@ -1,175 +1,175 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Tcp4Main.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_MAIN_H_
-#define _TCP4_MAIN_H_
-
-#include "Socket.h"
-
-#include "Tcp4Proto.h"
-#include "Tcp4Driver.h"
-
-
-extern UINT16 mTcp4RandomPort;
-
-//
-// Driver Produced Protocol Prototypes
-//
-
-#define TCP4_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Tcp", PrintArg)
-#define TCP4_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Tcp", PrintArg)
-#define TCP4_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Tcp", PrintArg)
-
-//
-// Function prototype for the Tcp4 socket request handler
-//
-EFI_STATUS
-Tcp4Dispatcher (
- IN SOCKET *Sock,
- IN SOCK_REQUEST Request,
- IN VOID *Data OPTIONAL
- );
-
-typedef struct _TCP4_MODE_DATA {
- EFI_TCP4_CONNECTION_STATE *Tcp4State;
- EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
- EFI_IP4_MODE_DATA *Ip4ModeData;
- EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
- EFI_SIMPLE_NETWORK_MODE *SnpModeData;
-} TCP4_MODE_DATA;
-
-typedef struct _TCP4_ROUTE_INFO {
- BOOLEAN DeleteRoute;
- EFI_IPv4_ADDRESS *SubnetAddress;
- EFI_IPv4_ADDRESS *SubnetMask;
- EFI_IPv4_ADDRESS *GatewayAddress;
-} TCP4_ROUTE_INFO;
-
-//
-// Get the mode data of a TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4GetModeData (
- IN CONST EFI_TCP4_PROTOCOL * This,
- OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
- OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
- OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
- OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
- OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
- );
-
-//
-// Initialize or reset a TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Configure (
- IN EFI_TCP4_PROTOCOL * This,
- IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
- );
-
-//
-// Add a route entry to the route table
-//
-EFI_STATUS
-EFIAPI
-Tcp4Routes (
- IN EFI_TCP4_PROTOCOL *This,
- IN BOOLEAN DeleteRoute,
- IN EFI_IPv4_ADDRESS *SubnetAddress,
- IN EFI_IPv4_ADDRESS *SubnetMask,
- IN EFI_IPv4_ADDRESS *GatewayAddress
- );
-
-//
-// Issue an asynchronous connection establishment
-// request to the peer
-//
-EFI_STATUS
-EFIAPI
-Tcp4Connect (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
- );
-
-//
-// Issue an asynchronous listent token to accept an
-// incoming connection reques
-//
-EFI_STATUS
-EFIAPI
-Tcp4Accept (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_LISTEN_TOKEN *ListenToken
- );
-
-//
-// Issue an asynchronous IO token to transmit some data
-// through this TCP instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Transmit (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_IO_TOKEN *Token
- );
-
-//
-// Issue an asynchronous IO token to receive some data
-// through this TCP instance
-//
-EFI_STATUS
-Tcp4Receive (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_IO_TOKEN *Token
- );
-
-//
-// Issue an asynchronous CloseToken to close a TCP
-// connection represented by instance
-//
-EFI_STATUS
-EFIAPI
-Tcp4Close (
- IN EFI_TCP4_PROTOCOL *This,
- IN EFI_TCP4_CLOSE_TOKEN *CloseToken
- );
-
-//
-// cancle an connect, listent or IO token
-//
-EFI_STATUS
-EFIAPI
-Tcp4Cancel (
- IN EFI_TCP4_PROTOCOL * This,
- IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
- );
-
-//
-// poll data from NIC for receive
-//
-EFI_STATUS
-EFIAPI
-Tcp4Poll (
- IN EFI_TCP4_PROTOCOL *This
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Tcp4Main.h
+
+Abstract:
+
+
+**/
+
+#ifndef _TCP4_MAIN_H_
+#define _TCP4_MAIN_H_
+
+#include "Socket.h"
+
+#include "Tcp4Proto.h"
+#include "Tcp4Driver.h"
+
+
+extern UINT16 mTcp4RandomPort;
+
+//
+// Driver Produced Protocol Prototypes
+//
+
+#define TCP4_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Tcp", PrintArg)
+#define TCP4_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Tcp", PrintArg)
+#define TCP4_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Tcp", PrintArg)
+
+//
+// Function prototype for the Tcp4 socket request handler
+//
+EFI_STATUS
+Tcp4Dispatcher (
+ IN SOCKET *Sock,
+ IN SOCK_REQUEST Request,
+ IN VOID *Data OPTIONAL
+ );
+
+typedef struct _TCP4_MODE_DATA {
+ EFI_TCP4_CONNECTION_STATE *Tcp4State;
+ EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
+ EFI_IP4_MODE_DATA *Ip4ModeData;
+ EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
+ EFI_SIMPLE_NETWORK_MODE *SnpModeData;
+} TCP4_MODE_DATA;
+
+typedef struct _TCP4_ROUTE_INFO {
+ BOOLEAN DeleteRoute;
+ EFI_IPv4_ADDRESS *SubnetAddress;
+ EFI_IPv4_ADDRESS *SubnetMask;
+ EFI_IPv4_ADDRESS *GatewayAddress;
+} TCP4_ROUTE_INFO;
+
+//
+// Get the mode data of a TCP instance
+//
+EFI_STATUS
+EFIAPI
+Tcp4GetModeData (
+ IN CONST EFI_TCP4_PROTOCOL * This,
+ OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
+ OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
+ OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
+ );
+
+//
+// Initialize or reset a TCP instance
+//
+EFI_STATUS
+EFIAPI
+Tcp4Configure (
+ IN EFI_TCP4_PROTOCOL * This,
+ IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
+ );
+
+//
+// Add a route entry to the route table
+//
+EFI_STATUS
+EFIAPI
+Tcp4Routes (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv4_ADDRESS *SubnetAddress,
+ IN EFI_IPv4_ADDRESS *SubnetMask,
+ IN EFI_IPv4_ADDRESS *GatewayAddress
+ );
+
+//
+// Issue an asynchronous connection establishment
+// request to the peer
+//
+EFI_STATUS
+EFIAPI
+Tcp4Connect (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
+ );
+
+//
+// Issue an asynchronous listent token to accept an
+// incoming connection reques
+//
+EFI_STATUS
+EFIAPI
+Tcp4Accept (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN EFI_TCP4_LISTEN_TOKEN *ListenToken
+ );
+
+//
+// Issue an asynchronous IO token to transmit some data
+// through this TCP instance
+//
+EFI_STATUS
+EFIAPI
+Tcp4Transmit (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN EFI_TCP4_IO_TOKEN *Token
+ );
+
+//
+// Issue an asynchronous IO token to receive some data
+// through this TCP instance
+//
+EFI_STATUS
+Tcp4Receive (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN EFI_TCP4_IO_TOKEN *Token
+ );
+
+//
+// Issue an asynchronous CloseToken to close a TCP
+// connection represented by instance
+//
+EFI_STATUS
+EFIAPI
+Tcp4Close (
+ IN EFI_TCP4_PROTOCOL *This,
+ IN EFI_TCP4_CLOSE_TOKEN *CloseToken
+ );
+
+//
+// cancle an connect, listent or IO token
+//
+EFI_STATUS
+EFIAPI
+Tcp4Cancel (
+ IN EFI_TCP4_PROTOCOL * This,
+ IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
+ );
+
+//
+// poll data from NIC for receive
+//
+EFI_STATUS
+EFIAPI
+Tcp4Poll (
+ IN EFI_TCP4_PROTOCOL *This
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h
index cae0e885cf..ad856c777a 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h
@@ -1,107 +1,107 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Tcp4Option.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_OPTION_H_
-#define _TCP4_OPTION_H_
-
-//
-// The structure to store the parse option value.
-// ParseOption only parse the options, don't process them.
-//
-typedef struct s_TCP_OPTION {
- UINT8 Flag; // flag such as TCP_OPTION_RCVD_MSS
- UINT8 WndScale; // the WndScale received
- UINT16 Mss; // the Mss received
- UINT32 TSVal; // the TSVal field in a timestamp option
- UINT32 TSEcr; // the TSEcr field in a timestamp option
-} TCP_OPTION;
-
-enum {
-
- //
- // supported TCP option type and their length
- //
- TCP_OPTION_EOP = 0, // End Of oPtion
- TCP_OPTION_NOP = 1, // No-Option.
- TCP_OPTION_MSS = 2, // Maximum Segment Size
- TCP_OPTION_WS = 3, // Window scale
- TCP_OPTION_TS = 8, // Timestamp
- TCP_OPTION_MSS_LEN = 4, // length of MSS option
- TCP_OPTION_WS_LEN = 3, // length of window scale option
- TCP_OPTION_TS_LEN = 10, // length of timestamp option
- TCP_OPTION_WS_ALIGNED_LEN = 4, // length of window scale option, aligned
- TCP_OPTION_TS_ALIGNED_LEN = 12, // length of timestamp option, aligned
-
- //
- // recommend format of timestamp window scale
- // option for fast process.
- //
- TCP_OPTION_TS_FAST = ((TCP_OPTION_NOP << 24) |
- (TCP_OPTION_NOP << 16) |
- (TCP_OPTION_TS << 8) |
- TCP_OPTION_TS_LEN),
-
- TCP_OPTION_WS_FAST = ((TCP_OPTION_NOP << 24) |
- (TCP_OPTION_WS << 16) |
- (TCP_OPTION_WS_LEN << 8)),
-
- TCP_OPTION_MSS_FAST = ((TCP_OPTION_MSS << 24) |
- (TCP_OPTION_MSS_LEN << 16)),
-
- //
- // Other misc definations
- //
- TCP_OPTION_MAX_WS = 14, // Maxium window scale value
- TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header
- TCP_OPTION_RCVD_MSS = 0x01,
- TCP_OPTION_RCVD_WS = 0x02,
- TCP_OPTION_RCVD_TS = 0x04
-};
-
-UINT8
-TcpComputeScale (
- IN TCP_CB *Tcb
- );
-
-UINT16
-TcpSynBuildOption (
- IN TCP_CB *Tcb,
- IN NET_BUF *Buf
- );
-
-UINT16
-TcpBuildOption (
- IN TCP_CB *Tcb,
- IN NET_BUF *Buf
- );
-
-INTN
-TcpParseOption (
- IN TCP_HEAD *Tcp,
- IN TCP_OPTION *Option
- );
-
-UINT32
-TcpPawsOK (
- IN TCP_CB *Tcb,
- IN UINT32 TSVal
- );
-
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Tcp4Option.h
+
+Abstract:
+
+
+**/
+
+#ifndef _TCP4_OPTION_H_
+#define _TCP4_OPTION_H_
+
+//
+// The structure to store the parse option value.
+// ParseOption only parse the options, don't process them.
+//
+typedef struct s_TCP_OPTION {
+ UINT8 Flag; // flag such as TCP_OPTION_RCVD_MSS
+ UINT8 WndScale; // the WndScale received
+ UINT16 Mss; // the Mss received
+ UINT32 TSVal; // the TSVal field in a timestamp option
+ UINT32 TSEcr; // the TSEcr field in a timestamp option
+} TCP_OPTION;
+
+enum {
+
+ //
+ // supported TCP option type and their length
+ //
+ TCP_OPTION_EOP = 0, // End Of oPtion
+ TCP_OPTION_NOP = 1, // No-Option.
+ TCP_OPTION_MSS = 2, // Maximum Segment Size
+ TCP_OPTION_WS = 3, // Window scale
+ TCP_OPTION_TS = 8, // Timestamp
+ TCP_OPTION_MSS_LEN = 4, // length of MSS option
+ TCP_OPTION_WS_LEN = 3, // length of window scale option
+ TCP_OPTION_TS_LEN = 10, // length of timestamp option
+ TCP_OPTION_WS_ALIGNED_LEN = 4, // length of window scale option, aligned
+ TCP_OPTION_TS_ALIGNED_LEN = 12, // length of timestamp option, aligned
+
+ //
+ // recommend format of timestamp window scale
+ // option for fast process.
+ //
+ TCP_OPTION_TS_FAST = ((TCP_OPTION_NOP << 24) |
+ (TCP_OPTION_NOP << 16) |
+ (TCP_OPTION_TS << 8) |
+ TCP_OPTION_TS_LEN),
+
+ TCP_OPTION_WS_FAST = ((TCP_OPTION_NOP << 24) |
+ (TCP_OPTION_WS << 16) |
+ (TCP_OPTION_WS_LEN << 8)),
+
+ TCP_OPTION_MSS_FAST = ((TCP_OPTION_MSS << 24) |
+ (TCP_OPTION_MSS_LEN << 16)),
+
+ //
+ // Other misc definations
+ //
+ TCP_OPTION_MAX_WS = 14, // Maxium window scale value
+ TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header
+ TCP_OPTION_RCVD_MSS = 0x01,
+ TCP_OPTION_RCVD_WS = 0x02,
+ TCP_OPTION_RCVD_TS = 0x04
+};
+
+UINT8
+TcpComputeScale (
+ IN TCP_CB *Tcb
+ );
+
+UINT16
+TcpSynBuildOption (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Buf
+ );
+
+UINT16
+TcpBuildOption (
+ IN TCP_CB *Tcb,
+ IN NET_BUF *Buf
+ );
+
+INTN
+TcpParseOption (
+ IN TCP_HEAD *Tcp,
+ IN TCP_OPTION *Option
+ );
+
+UINT32
+TcpPawsOK (
+ IN TCP_CB *Tcb,
+ IN UINT32 TSVal
+ );
+
+#endif
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h
index a35a51b3cc..cfefdf2ea3 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h
@@ -1,355 +1,355 @@
-/** @file
-
-Copyright (c) 2005 - 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:
-
- Tcp4Proto.h
-
-Abstract:
-
-
-**/
-
-#ifndef _TCP4_PROTO_H_
-#define _TCP4_PROTO_H_
-
-typedef struct _TCP_CB TCP_CB;
-
-#include "Tcp4Driver.h"
-#include "Socket.h"
-#include "Tcp4Option.h"
-
-//
-// tcp states, Don't change their order, it is used as
-// index to mTcpOutFlag and other macros
-//
-enum {
- TCP_CLOSED = 0,
- TCP_LISTEN,
- TCP_SYN_SENT,
- TCP_SYN_RCVD,
- TCP_ESTABLISHED,
- TCP_FIN_WAIT_1,
- TCP_FIN_WAIT_2,
- TCP_CLOSING,
- TCP_TIME_WAIT,
- TCP_CLOSE_WAIT,
- TCP_LAST_ACK
-};
-
-//
-// flags in the TCP header
-//
-enum {
-
- TCP_FLG_FIN = 0x01,
- TCP_FLG_SYN = 0x02,
- TCP_FLG_RST = 0x04,
- TCP_FLG_PSH = 0x08,
- TCP_FLG_ACK = 0x10,
- TCP_FLG_URG = 0x20,
- TCP_FLG_FLAG = 0x3F // mask for all the flags
-};
-
-enum {
-
- //
- // TCP error status
- //
- TCP_CONNECT_REFUSED = -1,
- TCP_CONNECT_RESET = -2,
- TCP_CONNECT_CLOSED = -3,
-
- //
- // Current congestion status as suggested by RFC3782.
- //
- TCP_CONGEST_RECOVER = 1, // during the NewReno fast recovery
- TCP_CONGEST_LOSS = 2, // retxmit because of retxmit time out
- TCP_CONGEST_OPEN = 3, // TCP is opening its congestion window
-
- //
- // TCP control flags
- //
- TCP_CTRL_NO_NAGLE = 0x0001, // disable Nagle algorithm
- TCP_CTRL_NO_KEEPALIVE = 0x0002, // disable keepalive timer
- TCP_CTRL_NO_WS = 0x0004, // disable window scale option
- TCP_CTRL_RCVD_WS = 0x0008, // rcvd a wnd scale option in syn
- TCP_CTRL_NO_TS = 0x0010, // disable Timestamp option
- TCP_CTRL_RCVD_TS = 0x0020, // rcvd a Timestamp option in syn
- TCP_CTRL_SND_TS = 0x0040, // Send Timestamp option to remote
- TCP_CTRL_SND_URG = 0x0080, // in urgent send mode
- TCP_CTRL_RCVD_URG = 0x0100, // in urgent receive mode
- TCP_CTRL_SND_PSH = 0x0200, // in PUSH send mode
- TCP_CTRL_FIN_SENT = 0x0400, // FIN is sent
- TCP_CTRL_FIN_ACKED = 0x0800, // FIN is ACKed.
- TCP_CTRL_TIMER_ON = 0x1000, // At least one of the timer is on
- TCP_CTRL_RTT_ON = 0x2000, // The RTT measurement is on
- TCP_CTRL_ACK_NOW = 0x4000, // Send the ACK now, don't delay
-
- //
- // Timer related values
- //
- TCP_TIMER_CONNECT = 0, // Connection establishment timer
- TCP_TIMER_REXMIT = 1, // retransmit timer
- TCP_TIMER_PROBE = 2, // Window probe timer
- TCP_TIMER_KEEPALIVE = 3, // Keepalive timer
- TCP_TIMER_FINWAIT2 = 4, // FIN_WAIT_2 timer
- TCP_TIMER_2MSL = 5, // TIME_WAIT tiemr
- TCP_TIMER_NUMBER = 6, // the total number of TCP timer.
- TCP_TICK = 200, // every TCP tick is 200ms
- TCP_TICK_HZ = 5, // the frequence of TCP tick
- TCP_RTT_SHIFT = 3, // SRTT & RTTVAR scaled by 8
- TCP_RTO_MIN = TCP_TICK_HZ, // the minium value of RTO
- TCP_RTO_MAX = TCP_TICK_HZ *60, // the maxium value of RTO
- TCP_FOLD_RTT = 4, // timeout threshod to fold RTT
-
- //
- // default values for some timers
- //
- TCP_MAX_LOSS = 12, // default max times to retxmit
- TCP_KEEPALIVE_IDLE_MIN = TCP_TICK_HZ *60 *60 *2, // First keep alive
- TCP_KEEPALIVE_PERIOD = TCP_TICK_HZ *60,
- TCP_MAX_KEEPALIVE = 8,
- TCP_FIN_WAIT2_TIME = 2 *TCP_TICK_HZ, // * 60,
- TCP_TIME_WAIT_TIME = 2 *TCP_TICK_HZ,
- TCP_PAWS_24DAY = 24 *24 *60 *60 *TCP_TICK_HZ,
- TCP_CONNECT_TIME = 75 *TCP_TICK_HZ,
-
- //
- // The header space to be reserved before TCP data to accomodate :
- // 60byte IP head + 60byte TCP head + link layer head
- //
- TCP_MAX_HEAD = 192,
-
- //
- // value ranges for some control option
- //
- TCP_RCV_BUF_SIZE = 2 *1024 *1024,
- TCP_RCV_BUF_SIZE_MIN = 8 *1024,
- TCP_SND_BUF_SIZE = 2 *1024 *1024,
- TCP_SND_BUF_SIZE_MIN = 8 *1024,
- TCP_BACKLOG = 10,
- TCP_BACKLOG_MIN = 5,
- TCP_MAX_LOSS_MIN = 6,
- TCP_CONNECT_TIME_MIN = 60 *TCP_TICK_HZ,
- TCP_MAX_KEEPALIVE_MIN = 4,
- TCP_KEEPALIVE_IDLE_MAX = TCP_TICK_HZ *60 *60 *4,
- TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
- TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
- TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
-};
-
-typedef struct _TCP_SEG {
- TCP_SEQNO Seq; // Starting sequence number
- TCP_SEQNO End; // The sequence of the last byte + 1,
- // include SYN/FIN. End-Seq = SEG.LEN
- TCP_SEQNO Ack; // ACK fild in the segment
- UINT8 Flag; // TCP header flags
- UINT16 Urg; // Valid if URG flag is set.
- UINT32 Wnd; // TCP window size field
-} TCP_SEG;
-
-typedef struct _TCP_PEER {
- UINT32 Ip; // Network byte order
- TCP_PORTNO Port; // Network byte order
-} TCP_PEER;
-
-//
-// tcp control block, it includes various states
-//
-struct _TCP_CB {
- NET_LIST_ENTRY List;
- TCP_CB *Parent;
-
- SOCKET *Sk;
- TCP_PEER LocalEnd;
- TCP_PEER RemoteEnd;
-
- NET_LIST_ENTRY SndQue; // retxmission queue
- NET_LIST_ENTRY RcvQue; // reassemble queue
- UINT32 CtrlFlag; // control flags, such as NO_NAGLE
- INT32 Error; // soft error status,TCP_CONNECT_RESET...
-
- //
- // RFC793 and RFC1122 defined variables
- //
- UINT8 State; // TCP state, such as SYN_SENT, LISTEN
- UINT8 DelayedAck; // number of delayed ACKs
- UINT16 HeadSum; // checksum of the fixed parts of pesudo
- // header: Src IP, Dst IP, 0, Protocol,
- // not include the TCP length.
-
- TCP_SEQNO Iss; // Initial Sending Sequence
- TCP_SEQNO SndUna; // first unacknowledged data
- TCP_SEQNO SndNxt; // next data sequence to send.
- TCP_SEQNO SndPsh; // Send PUSH point
- TCP_SEQNO SndUp; // Send urgent point
- UINT32 SndWnd; // Window advertised by the remote peer
- UINT32 SndWndMax; // max send window advertised by the peer
- TCP_SEQNO SndWl1; // Seq number used for last window update
- TCP_SEQNO SndWl2; // ack no of last window update
- UINT16 SndMss; // Max send segment size
- TCP_SEQNO RcvNxt; // Next sequence no to receive
- UINT32 RcvWnd; // Window advertised by the local peer
- TCP_SEQNO RcvWl2; // The RcvNxt (or ACK) of last window update.
- // It is necessary because of delayed ACK
-
- TCP_SEQNO RcvUp; // urgent point;
- TCP_SEQNO Irs; // Initial Receiving Sequence
- UINT16 RcvMss; // Max receive segment size
- UINT16 EnabledTimer; // which timer is currently enabled
- UINT32 Timer[TCP_TIMER_NUMBER]; // when the timer will expire
- INT32 NextExpire; // count down offset for the nearest timer
- UINT32 Idle; // How long the connection is in idle
- UINT32 ProbeTime; // the time out value for current window prober
-
- //
- // RFC1323 defined variables, about window scale,
- // timestamp and PAWS
- //
- UINT8 SndWndScale; // Wndscale received from the peer
- UINT8 RcvWndScale; // Wndscale used to scale local buffer
- UINT32 TsRecent; // TsRecent to echo to the remote peer
- UINT32 TsRecentAge; // When this TsRecent is updated
-
- // TCP_SEQNO LastAckSent;
- // It isn't necessary to add LastAckSent here,
- // since it is the same as RcvWl2
-
- //
- // RFC2988 defined variables. about RTT measurement
- //
- TCP_SEQNO RttSeq; // the seq of measured segment now
- UINT32 RttMeasure; // currently measured RTT in heart beats
- UINT32 SRtt; // Smoothed RTT, scaled by 8
- UINT32 RttVar; // RTT variance, scaled by 8
- UINT32 Rto; // Current RTO, not scaled
-
- //
- // RFC2581, and 3782 variables.
- // Congestion control + NewReno fast recovery.
- //
- UINT32 CWnd; // Sender's congestion window
- UINT32 Ssthresh; // Slow start threshold.
- TCP_SEQNO Recover; // recover point for NewReno
- UINT16 DupAck; // number of duplicate ACKs
- UINT8 CongestState; // the current congestion state(RFC3782)
- UINT8 LossTimes; // number of retxmit timeouts in a row
- TCP_SEQNO LossRecover; // recover point for retxmit
-
- //
- // configuration parameters, for EFI_TCP4_PROTOCOL specification
- //
- UINT32 KeepAliveIdle; // idle time before sending first probe
- UINT32 KeepAlivePeriod; // interval for subsequent keep alive probe
- UINT8 MaxKeepAlive; // Maxium keep alive probe times.
- UINT8 KeepAliveProbes; // the number of keep alive probe.
- UINT16 MaxRexmit; // The maxium number of retxmit before abort
- UINT32 FinWait2Timeout; // The FIN_WAIT_2 time out
- UINT32 TimeWaitTimeout; // The TIME_WAIT time out
- UINT32 ConnectTimeout;
-
- //
- // configuration for tcp provided by user
- //
- BOOLEAN UseDefaultAddr;
- UINT8 TOS;
- UINT8 TTL;
- EFI_IPv4_ADDRESS SubnetMask;
-
- //
- // pointer reference to Ip used to send pkt
- //
- IP_IO_IP_INFO *IpInfo;
-};
-
-extern NET_LIST_ENTRY mTcpRunQue;
-extern NET_LIST_ENTRY mTcpListenQue;
-extern TCP_SEQNO mTcpGlobalIss;
-extern UINT32 mTcpTick;
-
-//
-// TCP_CONNECTED: both ends have synchronized their ISN.
-//
-#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
-
-#define TCP_FIN_RCVD(State) \
- (((State) == TCP_CLOSE_WAIT) || \
- ((State) == TCP_LAST_ACK) || \
- ((State) == TCP_CLOSING) || \
- ((State) == TCP_TIME_WAIT))
-
-#define TCP_LOCAL_CLOSED(State) \
- (((State) == TCP_FIN_WAIT_1) || \
- ((State) == TCP_FIN_WAIT_2) || \
- ((State) == TCP_CLOSING) || \
- ((State) == TCP_TIME_WAIT) || \
- ((State) == TCP_LAST_ACK))
-
-//
-// Get the TCP_SEG point from a net buffer's ProtoData
-//
-#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
-
-//
-// macros to compare sequence no
-//
-#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
-#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
-#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
-#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
-
-//
-// TCP_SEQ_BETWEEN return whether b <= m <= e
-//
-#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
-
-//
-// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
-//
-#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
-
-#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
-#define TCP_SET_FLG(Value, Flag) ((Value) |= (Flag))
-#define TCP_CLEAR_FLG(Value, Flag) ((Value) &= ~(Flag))
-
-//
-// test whether two peers are equal
-//
-#define TCP_PEER_EQUAL(Pa, Pb) \
- (((Pa)->Ip == (Pb)->Ip) && ((Pa)->Port == (Pb)->Port))
-
-//
-// test whether Pa matches Pb, or Pa is more specific
-// than pb. Zero means wildcard.
-//
-#define TCP_PEER_MATCH(Pa, Pb) \
- ((((Pb)->Ip == 0) || ((Pb)->Ip == (Pa)->Ip)) && \
- (((Pb)->Port == 0) || ((Pb)->Port == (Pa)->Port)))
-
-#define TCP_TIMER_ON(Flag, Timer) ((Flag) & (1 << (Timer)))
-#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer))))
-#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer)))))
-
-#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
-#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
-#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
-
-#define TCP_MAX_WIN 0xFFFFU
-
-typedef
-VOID
-(*TCP_TIMER_HANDLER) (
- IN TCP_CB * Tcb
- );
-
-#include "Tcp4Func.h"
-#endif
+/** @file
+
+Copyright (c) 2005 - 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:
+
+ Tcp4Proto.h
+
+Abstract:
+
+
+**/
+
+#ifndef _TCP4_PROTO_H_
+#define _TCP4_PROTO_H_
+
+typedef struct _TCP_CB TCP_CB;
+
+#include "Tcp4Driver.h"
+#include "Socket.h"
+#include "Tcp4Option.h"
+
+//
+// tcp states, Don't change their order, it is used as
+// index to mTcpOutFlag and other macros
+//
+enum {
+ TCP_CLOSED = 0,
+ TCP_LISTEN,
+ TCP_SYN_SENT,
+ TCP_SYN_RCVD,
+ TCP_ESTABLISHED,
+ TCP_FIN_WAIT_1,
+ TCP_FIN_WAIT_2,
+ TCP_CLOSING,
+ TCP_TIME_WAIT,
+ TCP_CLOSE_WAIT,
+ TCP_LAST_ACK
+};
+
+//
+// flags in the TCP header
+//
+enum {
+
+ TCP_FLG_FIN = 0x01,
+ TCP_FLG_SYN = 0x02,
+ TCP_FLG_RST = 0x04,
+ TCP_FLG_PSH = 0x08,
+ TCP_FLG_ACK = 0x10,
+ TCP_FLG_URG = 0x20,
+ TCP_FLG_FLAG = 0x3F // mask for all the flags
+};
+
+enum {
+
+ //
+ // TCP error status
+ //
+ TCP_CONNECT_REFUSED = -1,
+ TCP_CONNECT_RESET = -2,
+ TCP_CONNECT_CLOSED = -3,
+
+ //
+ // Current congestion status as suggested by RFC3782.
+ //
+ TCP_CONGEST_RECOVER = 1, // during the NewReno fast recovery
+ TCP_CONGEST_LOSS = 2, // retxmit because of retxmit time out
+ TCP_CONGEST_OPEN = 3, // TCP is opening its congestion window
+
+ //
+ // TCP control flags
+ //
+ TCP_CTRL_NO_NAGLE = 0x0001, // disable Nagle algorithm
+ TCP_CTRL_NO_KEEPALIVE = 0x0002, // disable keepalive timer
+ TCP_CTRL_NO_WS = 0x0004, // disable window scale option
+ TCP_CTRL_RCVD_WS = 0x0008, // rcvd a wnd scale option in syn
+ TCP_CTRL_NO_TS = 0x0010, // disable Timestamp option
+ TCP_CTRL_RCVD_TS = 0x0020, // rcvd a Timestamp option in syn
+ TCP_CTRL_SND_TS = 0x0040, // Send Timestamp option to remote
+ TCP_CTRL_SND_URG = 0x0080, // in urgent send mode
+ TCP_CTRL_RCVD_URG = 0x0100, // in urgent receive mode
+ TCP_CTRL_SND_PSH = 0x0200, // in PUSH send mode
+ TCP_CTRL_FIN_SENT = 0x0400, // FIN is sent
+ TCP_CTRL_FIN_ACKED = 0x0800, // FIN is ACKed.
+ TCP_CTRL_TIMER_ON = 0x1000, // At least one of the timer is on
+ TCP_CTRL_RTT_ON = 0x2000, // The RTT measurement is on
+ TCP_CTRL_ACK_NOW = 0x4000, // Send the ACK now, don't delay
+
+ //
+ // Timer related values
+ //
+ TCP_TIMER_CONNECT = 0, // Connection establishment timer
+ TCP_TIMER_REXMIT = 1, // retransmit timer
+ TCP_TIMER_PROBE = 2, // Window probe timer
+ TCP_TIMER_KEEPALIVE = 3, // Keepalive timer
+ TCP_TIMER_FINWAIT2 = 4, // FIN_WAIT_2 timer
+ TCP_TIMER_2MSL = 5, // TIME_WAIT tiemr
+ TCP_TIMER_NUMBER = 6, // the total number of TCP timer.
+ TCP_TICK = 200, // every TCP tick is 200ms
+ TCP_TICK_HZ = 5, // the frequence of TCP tick
+ TCP_RTT_SHIFT = 3, // SRTT & RTTVAR scaled by 8
+ TCP_RTO_MIN = TCP_TICK_HZ, // the minium value of RTO
+ TCP_RTO_MAX = TCP_TICK_HZ *60, // the maxium value of RTO
+ TCP_FOLD_RTT = 4, // timeout threshod to fold RTT
+
+ //
+ // default values for some timers
+ //
+ TCP_MAX_LOSS = 12, // default max times to retxmit
+ TCP_KEEPALIVE_IDLE_MIN = TCP_TICK_HZ *60 *60 *2, // First keep alive
+ TCP_KEEPALIVE_PERIOD = TCP_TICK_HZ *60,
+ TCP_MAX_KEEPALIVE = 8,
+ TCP_FIN_WAIT2_TIME = 2 *TCP_TICK_HZ, // * 60,
+ TCP_TIME_WAIT_TIME = 2 *TCP_TICK_HZ,
+ TCP_PAWS_24DAY = 24 *24 *60 *60 *TCP_TICK_HZ,
+ TCP_CONNECT_TIME = 75 *TCP_TICK_HZ,
+
+ //
+ // The header space to be reserved before TCP data to accomodate :
+ // 60byte IP head + 60byte TCP head + link layer head
+ //
+ TCP_MAX_HEAD = 192,
+
+ //
+ // value ranges for some control option
+ //
+ TCP_RCV_BUF_SIZE = 2 *1024 *1024,
+ TCP_RCV_BUF_SIZE_MIN = 8 *1024,
+ TCP_SND_BUF_SIZE = 2 *1024 *1024,
+ TCP_SND_BUF_SIZE_MIN = 8 *1024,
+ TCP_BACKLOG = 10,
+ TCP_BACKLOG_MIN = 5,
+ TCP_MAX_LOSS_MIN = 6,
+ TCP_CONNECT_TIME_MIN = 60 *TCP_TICK_HZ,
+ TCP_MAX_KEEPALIVE_MIN = 4,
+ TCP_KEEPALIVE_IDLE_MAX = TCP_TICK_HZ *60 *60 *4,
+ TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
+ TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
+ TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
+};
+
+typedef struct _TCP_SEG {
+ TCP_SEQNO Seq; // Starting sequence number
+ TCP_SEQNO End; // The sequence of the last byte + 1,
+ // include SYN/FIN. End-Seq = SEG.LEN
+ TCP_SEQNO Ack; // ACK fild in the segment
+ UINT8 Flag; // TCP header flags
+ UINT16 Urg; // Valid if URG flag is set.
+ UINT32 Wnd; // TCP window size field
+} TCP_SEG;
+
+typedef struct _TCP_PEER {
+ UINT32 Ip; // Network byte order
+ TCP_PORTNO Port; // Network byte order
+} TCP_PEER;
+
+//
+// tcp control block, it includes various states
+//
+struct _TCP_CB {
+ NET_LIST_ENTRY List;
+ TCP_CB *Parent;
+
+ SOCKET *Sk;
+ TCP_PEER LocalEnd;
+ TCP_PEER RemoteEnd;
+
+ NET_LIST_ENTRY SndQue; // retxmission queue
+ NET_LIST_ENTRY RcvQue; // reassemble queue
+ UINT32 CtrlFlag; // control flags, such as NO_NAGLE
+ INT32 Error; // soft error status,TCP_CONNECT_RESET...
+
+ //
+ // RFC793 and RFC1122 defined variables
+ //
+ UINT8 State; // TCP state, such as SYN_SENT, LISTEN
+ UINT8 DelayedAck; // number of delayed ACKs
+ UINT16 HeadSum; // checksum of the fixed parts of pesudo
+ // header: Src IP, Dst IP, 0, Protocol,
+ // not include the TCP length.
+
+ TCP_SEQNO Iss; // Initial Sending Sequence
+ TCP_SEQNO SndUna; // first unacknowledged data
+ TCP_SEQNO SndNxt; // next data sequence to send.
+ TCP_SEQNO SndPsh; // Send PUSH point
+ TCP_SEQNO SndUp; // Send urgent point
+ UINT32 SndWnd; // Window advertised by the remote peer
+ UINT32 SndWndMax; // max send window advertised by the peer
+ TCP_SEQNO SndWl1; // Seq number used for last window update
+ TCP_SEQNO SndWl2; // ack no of last window update
+ UINT16 SndMss; // Max send segment size
+ TCP_SEQNO RcvNxt; // Next sequence no to receive
+ UINT32 RcvWnd; // Window advertised by the local peer
+ TCP_SEQNO RcvWl2; // The RcvNxt (or ACK) of last window update.
+ // It is necessary because of delayed ACK
+
+ TCP_SEQNO RcvUp; // urgent point;
+ TCP_SEQNO Irs; // Initial Receiving Sequence
+ UINT16 RcvMss; // Max receive segment size
+ UINT16 EnabledTimer; // which timer is currently enabled
+ UINT32 Timer[TCP_TIMER_NUMBER]; // when the timer will expire
+ INT32 NextExpire; // count down offset for the nearest timer
+ UINT32 Idle; // How long the connection is in idle
+ UINT32 ProbeTime; // the time out value for current window prober
+
+ //
+ // RFC1323 defined variables, about window scale,
+ // timestamp and PAWS
+ //
+ UINT8 SndWndScale; // Wndscale received from the peer
+ UINT8 RcvWndScale; // Wndscale used to scale local buffer
+ UINT32 TsRecent; // TsRecent to echo to the remote peer
+ UINT32 TsRecentAge; // When this TsRecent is updated
+
+ // TCP_SEQNO LastAckSent;
+ // It isn't necessary to add LastAckSent here,
+ // since it is the same as RcvWl2
+
+ //
+ // RFC2988 defined variables. about RTT measurement
+ //
+ TCP_SEQNO RttSeq; // the seq of measured segment now
+ UINT32 RttMeasure; // currently measured RTT in heart beats
+ UINT32 SRtt; // Smoothed RTT, scaled by 8
+ UINT32 RttVar; // RTT variance, scaled by 8
+ UINT32 Rto; // Current RTO, not scaled
+
+ //
+ // RFC2581, and 3782 variables.
+ // Congestion control + NewReno fast recovery.
+ //
+ UINT32 CWnd; // Sender's congestion window
+ UINT32 Ssthresh; // Slow start threshold.
+ TCP_SEQNO Recover; // recover point for NewReno
+ UINT16 DupAck; // number of duplicate ACKs
+ UINT8 CongestState; // the current congestion state(RFC3782)
+ UINT8 LossTimes; // number of retxmit timeouts in a row
+ TCP_SEQNO LossRecover; // recover point for retxmit
+
+ //
+ // configuration parameters, for EFI_TCP4_PROTOCOL specification
+ //
+ UINT32 KeepAliveIdle; // idle time before sending first probe
+ UINT32 KeepAlivePeriod; // interval for subsequent keep alive probe
+ UINT8 MaxKeepAlive; // Maxium keep alive probe times.
+ UINT8 KeepAliveProbes; // the number of keep alive probe.
+ UINT16 MaxRexmit; // The maxium number of retxmit before abort
+ UINT32 FinWait2Timeout; // The FIN_WAIT_2 time out
+ UINT32 TimeWaitTimeout; // The TIME_WAIT time out
+ UINT32 ConnectTimeout;
+
+ //
+ // configuration for tcp provided by user
+ //
+ BOOLEAN UseDefaultAddr;
+ UINT8 TOS;
+ UINT8 TTL;
+ EFI_IPv4_ADDRESS SubnetMask;
+
+ //
+ // pointer reference to Ip used to send pkt
+ //
+ IP_IO_IP_INFO *IpInfo;
+};
+
+extern NET_LIST_ENTRY mTcpRunQue;
+extern NET_LIST_ENTRY mTcpListenQue;
+extern TCP_SEQNO mTcpGlobalIss;
+extern UINT32 mTcpTick;
+
+//
+// TCP_CONNECTED: both ends have synchronized their ISN.
+//
+#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
+
+#define TCP_FIN_RCVD(State) \
+ (((State) == TCP_CLOSE_WAIT) || \
+ ((State) == TCP_LAST_ACK) || \
+ ((State) == TCP_CLOSING) || \
+ ((State) == TCP_TIME_WAIT))
+
+#define TCP_LOCAL_CLOSED(State) \
+ (((State) == TCP_FIN_WAIT_1) || \
+ ((State) == TCP_FIN_WAIT_2) || \
+ ((State) == TCP_CLOSING) || \
+ ((State) == TCP_TIME_WAIT) || \
+ ((State) == TCP_LAST_ACK))
+
+//
+// Get the TCP_SEG point from a net buffer's ProtoData
+//
+#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
+
+//
+// macros to compare sequence no
+//
+#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
+#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
+#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
+#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
+
+//
+// TCP_SEQ_BETWEEN return whether b <= m <= e
+//
+#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
+
+//
+// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
+//
+#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
+
+#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
+#define TCP_SET_FLG(Value, Flag) ((Value) |= (Flag))
+#define TCP_CLEAR_FLG(Value, Flag) ((Value) &= ~(Flag))
+
+//
+// test whether two peers are equal
+//
+#define TCP_PEER_EQUAL(Pa, Pb) \
+ (((Pa)->Ip == (Pb)->Ip) && ((Pa)->Port == (Pb)->Port))
+
+//
+// test whether Pa matches Pb, or Pa is more specific
+// than pb. Zero means wildcard.
+//
+#define TCP_PEER_MATCH(Pa, Pb) \
+ ((((Pb)->Ip == 0) || ((Pb)->Ip == (Pa)->Ip)) && \
+ (((Pb)->Port == 0) || ((Pb)->Port == (Pa)->Port)))
+
+#define TCP_TIMER_ON(Flag, Timer) ((Flag) & (1 << (Timer)))
+#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer))))
+#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer)))))
+
+#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
+#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
+#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
+
+#define TCP_MAX_WIN 0xFFFFU
+
+typedef
+VOID
+(*TCP_TIMER_HANDLER) (
+ IN TCP_CB * Tcb
+ );
+
+#include "Tcp4Func.h"
+#endif
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/ComponentName.c b/MdeModulePkg/Universal/Network/Udp4Dxe/ComponentName.c
index b934765207..7fb1ce9bd7 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/ComponentName.c
@@ -24,6 +24,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
UdpComponentNameGetDriverName (
@@ -32,28 +71,108 @@ UdpComponentNameGetDriverName (
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
UdpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
+
//
// EFI Component Name Protocol
//
-EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = {
+EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = {
UdpComponentNameGetDriverName,
UdpComponentNameGetControllerName,
"eng"
-};
+ };
+
+//
+// EFI Component Name 2 Protocol
+//
+EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UdpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UdpComponentNameGetControllerName,
+ "en"
+ };
+
static EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
{
- "eng",
+ "eng;en",
L"UDP Network Service Driver"
},
{
@@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
}
};
+/**
+ 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
UdpComponentNameGetDriverName (
@@ -69,100 +227,93 @@ UdpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
-/*++
+{
+ return LookupUnicodeString2 (
+ Language,
+ This->SupportedLanguages,
+ mUdpDriverNameTable,
+ DriverName,
+ (BOOLEAN)(This == &gUdp4ComponentName)
+ );
+}
-Routine Description:
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by a driver.
- Retrieves a Unicode string that is the user readable name of the EFI 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.
-Arguments:
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
+ EFI_COMPONENT_NAME_PROTOCOL instance.
- 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.
+ @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.
-Returns:
+ @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.
- 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.
+ @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.
---*/
-{
- return LookupUnicodeString (
- Language,
- gUdp4ComponentName.SupportedLanguages,
- mUdpDriverNameTable,
- DriverName
- );
-}
+ @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
UdpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ 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/Udp4Dxe/Udp4Driver.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.c
index dc6fd48ebf..7e2bc451ae 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.c
@@ -504,14 +504,13 @@ Returns:
//
// Install the Udp4DriverBinding and Udp4ComponentName protocols.
//
- Status = EfiLibInstallAllDriverProtocols (
+ Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gUdp4DriverBinding,
ImageHandle,
&gUdp4ComponentName,
- NULL,
- NULL
+ &gUdp4ComponentName2
);
if (!EFI_ERROR (Status)) {
//
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.h b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.h
index 59acb44452..2e0b7f33c8 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.h
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Driver.h
@@ -1,70 +1,70 @@
-/** @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:
-
- Udp4Driver.h
-
-Abstract:
-
-
-**/
-
-#ifndef _UDP4_DRIVER_H_
-#define _UDP4_DRIVER_H_
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/NetLib.h>
-#include <Protocol/DriverBinding.h>
-#include <Protocol/ServiceBinding.h>
-
-EFI_STATUS
-EFIAPI
-Udp4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-Udp4ServiceBindingCreateChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE *ChildHandle
- );
-
-EFI_STATUS
-EFIAPI
-Udp4ServiceBindingDestroyChild (
- IN EFI_SERVICE_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ChildHandle
- );
-
-#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:
+
+ Udp4Driver.h
+
+Abstract:
+
+
+**/
+
+#ifndef _UDP4_DRIVER_H_
+#define _UDP4_DRIVER_H_
+
+#include <PiDxe.h>
+#include <Library/BaseLib.h>
+#include <Library/NetLib.h>
+#include <Protocol/DriverBinding.h>
+#include <Protocol/ServiceBinding.h>
+
+EFI_STATUS
+EFIAPI
+Udp4DriverBindingSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4DriverBindingStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4DriverBindingStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4ServiceBindingCreateChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE *ChildHandle
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4ServiceBindingDestroyChild (
+ IN EFI_SERVICE_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ChildHandle
+ );
+
+#endif
+
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
index 7825624090..bdc855b52c 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
@@ -1,299 +1,300 @@
-/** @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:
-
- Udp4Impl.h
-
-Abstract:
-
- EFI UDPv4 protocol implementation
-
-
-**/
-
-#ifndef _UDP4_IMPL_H_
-#define _UDP4_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:
+
+ Udp4Impl.h
+
+Abstract:
+
+ EFI UDPv4 protocol implementation
+
+
+**/
+
+#ifndef _UDP4_IMPL_H_
+#define _UDP4_IMPL_H_
+
#include <PiDxe.h>
#include <Protocol/IP4.h>
#include <Protocol/Udp4.h>
-
+
#include <Library/IpIoLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "Udp4Driver.h"
-
-
-extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
-extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
-extern EFI_UDP4_PROTOCOL mUdp4Protocol;
-extern UINT16 mUdp4RandomPort;
-
-#define ICMP_ERROR_PACKET_LENGTH 8
-
-#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
-
-#define UDP4_HEADER_SIZE sizeof (EFI_UDP4_HEADER)
-#define UDP4_MAX_DATA_SIZE 65507
-
-#define UDP4_PORT_KNOWN 1024
-
-#define UDP4_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', '4')
-
-#define UDP4_SERVICE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- UDP4_SERVICE_DATA, \
- ServiceBinding, \
- UDP4_SERVICE_DATA_SIGNATURE \
- )
-
-typedef struct _UDP4_SERVICE_DATA_ {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- EFI_HANDLE ImageHandle;
- EFI_HANDLE ControllerHandle;
- NET_LIST_ENTRY ChildrenList;
- UINTN ChildrenNumber;
- IP_IO *IpIo;
-
- EFI_EVENT TimeoutEvent;
-
- CHAR16 *MacString;
-} UDP4_SERVICE_DATA;
-
-#define UDP4_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', 'I')
-
-#define UDP4_INSTANCE_DATA_FROM_THIS(a) \
- CR ( \
- (a), \
- UDP4_INSTANCE_DATA, \
- Udp4Proto, \
- UDP4_INSTANCE_DATA_SIGNATURE \
- )
-
-typedef struct _UDP4_INSTANCE_DATA_ {
- UINT32 Signature;
- NET_LIST_ENTRY Link;
-
- UDP4_SERVICE_DATA *Udp4Service;
- EFI_UDP4_PROTOCOL Udp4Proto;
- EFI_UDP4_CONFIG_DATA ConfigData;
- EFI_HANDLE ChildHandle;
- BOOLEAN Configured;
- BOOLEAN IsNoMapping;
-
- NET_MAP TxTokens;
- NET_MAP RxTokens;
-
- NET_MAP McastIps;
-
- NET_LIST_ENTRY RcvdDgramQue;
- NET_LIST_ENTRY DeliveredDgramQue;
-
- UINT16 HeadSum;
-
- EFI_STATUS IcmpError;
-
- IP_IO_IP_INFO *IpInfo;
-
- BOOLEAN Destroyed;
-} UDP4_INSTANCE_DATA;
-
-typedef struct _UDP4_RXDATA_WRAP_ {
- NET_LIST_ENTRY Link;
- NET_BUF *Packet;
- UINT32 TimeoutTick;
- EFI_UDP4_RECEIVE_DATA RxData;
-} UDP4_RXDATA_WRAP;
-
-EFI_STATUS
-EFIAPI
-Udp4GetModeData (
- IN EFI_UDP4_PROTOCOL *This,
- OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
- OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
- OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
- OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Configure (
- IN EFI_UDP4_PROTOCOL *This,
- IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Groups (
- IN EFI_UDP4_PROTOCOL *This,
- IN BOOLEAN JoinFlag,
- IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Routes (
- IN EFI_UDP4_PROTOCOL *This,
- IN BOOLEAN DeleteRoute,
- IN EFI_IPv4_ADDRESS *SubnetAddress,
- IN EFI_IPv4_ADDRESS *SubnetMask,
- IN EFI_IPv4_ADDRESS *GatewayAddress
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Transmit (
- IN EFI_UDP4_PROTOCOL *This,
- IN EFI_UDP4_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Receive (
- IN EFI_UDP4_PROTOCOL *This,
- IN EFI_UDP4_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Cancel (
- IN EFI_UDP4_PROTOCOL *This,
- IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-Udp4Poll (
- IN EFI_UDP4_PROTOCOL *This
- );
-
-EFI_STATUS
-Udp4CreateService (
- IN UDP4_SERVICE_DATA *Udp4Service,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE ControllerHandle
- );
-
-VOID
-Udp4CleanService (
- IN UDP4_SERVICE_DATA *Udp4Service
- );
-
-VOID
-Udp4InitInstance (
- IN UDP4_SERVICE_DATA *Udp4Service,
- IN UDP4_INSTANCE_DATA *Instance
- );
-
-VOID
-Udp4CleanInstance (
- IN UDP4_INSTANCE_DATA *Instance
- );
-
-EFI_STATUS
-Udp4Bind (
- IN NET_LIST_ENTRY *InstanceList,
- IN EFI_UDP4_CONFIG_DATA *ConfigData
- );
-
-BOOLEAN
-Udp4IsReconfigurable (
- IN EFI_UDP4_CONFIG_DATA *OldConfigData,
- IN EFI_UDP4_CONFIG_DATA *NewConfigData
- );
-
-VOID
-Udp4BuildIp4ConfigData (
- IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,
- IN EFI_IP4_CONFIG_DATA *Ip4ConfigData
- );
-
-EFI_STATUS
-Udp4ValidateTxToken (
- IN UDP4_INSTANCE_DATA *Instance,
- IN EFI_UDP4_COMPLETION_TOKEN *TxToken
- );
-
-EFI_STATUS
-Udp4TokenExist (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Context
- );
-
-UINT16
-Udp4Checksum (
- IN NET_BUF *Packet,
- IN UINT16 HeadSum
- );
-
-EFI_STATUS
-Udp4RemoveToken (
- IN NET_MAP *TokenMap,
- IN EFI_UDP4_COMPLETION_TOKEN *Token
- );
-
-EFI_STATUS
-Udp4LeaveGroup (
- IN NET_MAP *Map,
- IN NET_MAP_ITEM *Item,
- IN VOID *Arg OPTIONAL
- );
-
-VOID
-Udp4FlushRxData (
- IN NET_LIST_ENTRY *RcvdDgramQue
- );
-
-EFI_STATUS
-Udp4InstanceCancelToken (
- IN UDP4_INSTANCE_DATA *Instance,
- IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
- );
-
-VOID
-Udp4InstanceDeliverDgram (
- IN UDP4_INSTANCE_DATA *Instance
- );
-
-VOID
-Udp4ReportIcmpError (
- IN UDP4_INSTANCE_DATA *Instance
- );
-
-VOID
-Udp4NetVectorExtFree (
- VOID *Context
- );
-
-EFI_STATUS
-Udp4SetVariableData (
- IN UDP4_SERVICE_DATA *Udp4Service
- );
-
-VOID
-Udp4ClearVariableData (
- IN UDP4_SERVICE_DATA *Udp4Service
- );
-
-#endif
-
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+#include "Udp4Driver.h"
+
+
+extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2;
+extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
+extern EFI_UDP4_PROTOCOL mUdp4Protocol;
+extern UINT16 mUdp4RandomPort;
+
+#define ICMP_ERROR_PACKET_LENGTH 8
+
+#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
+
+#define UDP4_HEADER_SIZE sizeof (EFI_UDP4_HEADER)
+#define UDP4_MAX_DATA_SIZE 65507
+
+#define UDP4_PORT_KNOWN 1024
+
+#define UDP4_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', '4')
+
+#define UDP4_SERVICE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ UDP4_SERVICE_DATA, \
+ ServiceBinding, \
+ UDP4_SERVICE_DATA_SIGNATURE \
+ )
+
+typedef struct _UDP4_SERVICE_DATA_ {
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ EFI_HANDLE ImageHandle;
+ EFI_HANDLE ControllerHandle;
+ NET_LIST_ENTRY ChildrenList;
+ UINTN ChildrenNumber;
+ IP_IO *IpIo;
+
+ EFI_EVENT TimeoutEvent;
+
+ CHAR16 *MacString;
+} UDP4_SERVICE_DATA;
+
+#define UDP4_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', 'I')
+
+#define UDP4_INSTANCE_DATA_FROM_THIS(a) \
+ CR ( \
+ (a), \
+ UDP4_INSTANCE_DATA, \
+ Udp4Proto, \
+ UDP4_INSTANCE_DATA_SIGNATURE \
+ )
+
+typedef struct _UDP4_INSTANCE_DATA_ {
+ UINT32 Signature;
+ NET_LIST_ENTRY Link;
+
+ UDP4_SERVICE_DATA *Udp4Service;
+ EFI_UDP4_PROTOCOL Udp4Proto;
+ EFI_UDP4_CONFIG_DATA ConfigData;
+ EFI_HANDLE ChildHandle;
+ BOOLEAN Configured;
+ BOOLEAN IsNoMapping;
+
+ NET_MAP TxTokens;
+ NET_MAP RxTokens;
+
+ NET_MAP McastIps;
+
+ NET_LIST_ENTRY RcvdDgramQue;
+ NET_LIST_ENTRY DeliveredDgramQue;
+
+ UINT16 HeadSum;
+
+ EFI_STATUS IcmpError;
+
+ IP_IO_IP_INFO *IpInfo;
+
+ BOOLEAN Destroyed;
+} UDP4_INSTANCE_DATA;
+
+typedef struct _UDP4_RXDATA_WRAP_ {
+ NET_LIST_ENTRY Link;
+ NET_BUF *Packet;
+ UINT32 TimeoutTick;
+ EFI_UDP4_RECEIVE_DATA RxData;
+} UDP4_RXDATA_WRAP;
+
+EFI_STATUS
+EFIAPI
+Udp4GetModeData (
+ IN EFI_UDP4_PROTOCOL *This,
+ OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Configure (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Groups (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN BOOLEAN JoinFlag,
+ IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Routes (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN BOOLEAN DeleteRoute,
+ IN EFI_IPv4_ADDRESS *SubnetAddress,
+ IN EFI_IPv4_ADDRESS *SubnetMask,
+ IN EFI_IPv4_ADDRESS *GatewayAddress
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Transmit (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Receive (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Cancel (
+ IN EFI_UDP4_PROTOCOL *This,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+Udp4Poll (
+ IN EFI_UDP4_PROTOCOL *This
+ );
+
+EFI_STATUS
+Udp4CreateService (
+ IN UDP4_SERVICE_DATA *Udp4Service,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_HANDLE ControllerHandle
+ );
+
+VOID
+Udp4CleanService (
+ IN UDP4_SERVICE_DATA *Udp4Service
+ );
+
+VOID
+Udp4InitInstance (
+ IN UDP4_SERVICE_DATA *Udp4Service,
+ IN UDP4_INSTANCE_DATA *Instance
+ );
+
+VOID
+Udp4CleanInstance (
+ IN UDP4_INSTANCE_DATA *Instance
+ );
+
+EFI_STATUS
+Udp4Bind (
+ IN NET_LIST_ENTRY *InstanceList,
+ IN EFI_UDP4_CONFIG_DATA *ConfigData
+ );
+
+BOOLEAN
+Udp4IsReconfigurable (
+ IN EFI_UDP4_CONFIG_DATA *OldConfigData,
+ IN EFI_UDP4_CONFIG_DATA *NewConfigData
+ );
+
+VOID
+Udp4BuildIp4ConfigData (
+ IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,
+ IN EFI_IP4_CONFIG_DATA *Ip4ConfigData
+ );
+
+EFI_STATUS
+Udp4ValidateTxToken (
+ IN UDP4_INSTANCE_DATA *Instance,
+ IN EFI_UDP4_COMPLETION_TOKEN *TxToken
+ );
+
+EFI_STATUS
+Udp4TokenExist (
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Context
+ );
+
+UINT16
+Udp4Checksum (
+ IN NET_BUF *Packet,
+ IN UINT16 HeadSum
+ );
+
+EFI_STATUS
+Udp4RemoveToken (
+ IN NET_MAP *TokenMap,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token
+ );
+
+EFI_STATUS
+Udp4LeaveGroup (
+ IN NET_MAP *Map,
+ IN NET_MAP_ITEM *Item,
+ IN VOID *Arg OPTIONAL
+ );
+
+VOID
+Udp4FlushRxData (
+ IN NET_LIST_ENTRY *RcvdDgramQue
+ );
+
+EFI_STATUS
+Udp4InstanceCancelToken (
+ IN UDP4_INSTANCE_DATA *Instance,
+ IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
+ );
+
+VOID
+Udp4InstanceDeliverDgram (
+ IN UDP4_INSTANCE_DATA *Instance
+ );
+
+VOID
+Udp4ReportIcmpError (
+ IN UDP4_INSTANCE_DATA *Instance
+ );
+
+VOID
+Udp4NetVectorExtFree (
+ VOID *Context
+ );
+
+EFI_STATUS
+Udp4SetVariableData (
+ IN UDP4_SERVICE_DATA *Udp4Service
+ );
+
+VOID
+Udp4ClearVariableData (
+ IN UDP4_SERVICE_DATA *Udp4Service
+ );
+
+#endif
+