3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Header file for IP4Config driver.
23 #ifndef __EFI_IP4CONFIG_H__
24 #define __EFI_IP4CONFIG_H__
28 #include <Protocol/Dhcp4.h>
29 #include <Protocol/Ip4Config.h>
30 #include <Protocol/ManagedNetwork.h>
32 #include <Library/DebugLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Library/UefiDriverEntryPoint.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/UefiLib.h>
37 #include <Library/NetLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/MemoryAllocationLib.h>
41 #include "NicIp4Variable.h"
43 typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE
;
46 IP4_CONFIG_STATE_IDLE
= 0,
47 IP4_CONFIG_STATE_STARTED
,
48 IP4_CONFIG_STATE_CONFIGURED
,
50 IP4_PROTO_ICMP
= 0x01,
51 IP4_CONFIG_INSTANCE_SIGNATURE
= EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
53 DHCP_TAG_PARA_LIST
= 55,
59 // Configure the DHCP to request the routers and netmask
60 // from server. The DHCP_TAG_NETMASK is included in Head.
64 EFI_DHCP4_PACKET_OPTION Head
;
66 } IP4_CONFIG_DHCP4_OPTION
;
69 struct _IP4_CONFIG_INSTANCE
{
71 EFI_HANDLE Controller
;
74 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol
;
75 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol
;
78 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
83 // Mnp child to keep the connection with MNP.
85 EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
;
89 // User's requests data
92 EFI_EVENT ReconfigEvent
;
96 // Identity of this interface and some configuration info.
99 UINT16 NicName
[IP4_NIC_NAME_LENGTH
];
101 NIC_IP4_CONFIG_INFO
*NicConfig
;
104 // DHCP handles to access DHCP
106 EFI_DHCP4_PROTOCOL
*Dhcp4
;
107 EFI_HANDLE Dhcp4Handle
;
108 EFI_EVENT Dhcp4Event
;
111 #define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
112 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
114 #define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
115 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
117 extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding
;
118 extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName
;
119 extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2
;
120 extern IP4_CONFIG_INSTANCE
*mIp4ConfigNicList
[MAX_IP4_CONFIG_IN_VARIABLE
];
121 extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate
;
122 extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate
;
125 Ip4ConfigCleanDhcp4 (
126 IN IP4_CONFIG_INSTANCE
*This
130 Ip4ConfigCleanConfig (
131 IN IP4_CONFIG_INSTANCE
*Instance