3 Copyright (c) 2006 - 2008, 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
51 #define IP4_PROTO_ICMP 0x01
52 #define IP4_CONFIG_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('I', 'P', '4', 'C')
55 DHCP_TAG_PARA_LIST
= 55,
61 // Configure the DHCP to request the routers and netmask
62 // from server. The DHCP_TAG_NETMASK is included in Head.
66 EFI_DHCP4_PACKET_OPTION Head
;
68 } IP4_CONFIG_DHCP4_OPTION
;
71 struct _IP4_CONFIG_INSTANCE
{
73 EFI_HANDLE Controller
;
76 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol
;
77 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol
;
80 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
85 // Mnp child to keep the connection with MNP.
87 EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
;
91 // User's requests data
94 EFI_EVENT ReconfigEvent
;
98 // Identity of this interface and some configuration info.
101 UINT16 NicName
[IP4_NIC_NAME_LENGTH
];
103 NIC_IP4_CONFIG_INFO
*NicConfig
;
106 // DHCP handles to access DHCP
108 EFI_DHCP4_PROTOCOL
*Dhcp4
;
109 EFI_HANDLE Dhcp4Handle
;
110 EFI_EVENT Dhcp4Event
;
113 #define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
114 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
116 #define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
117 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
119 extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding
;
120 extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName
;
121 extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2
;
122 extern IP4_CONFIG_INSTANCE
*mIp4ConfigNicList
[MAX_IP4_CONFIG_IN_VARIABLE
];
123 extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate
;
124 extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate
;
127 Release all the DHCP related resources.
129 @param This The IP4 configure instance
135 Ip4ConfigCleanDhcp4 (
136 IN IP4_CONFIG_INSTANCE
*This
140 Clean up all the configuration parameters.
142 @param Instance The IP4 configure instance
148 Ip4ConfigCleanConfig (
149 IN IP4_CONFIG_INSTANCE
*Instance