]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
Scrubbed some code for Ip4ConfigDxe.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
1 /** @file
2 Header file for IP4Config driver.
3
4 Copyright (c) 2006 - 2008, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at<BR>
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _EFI_IP4CONFIG_H_
16 #define _EFI_IP4CONFIG_H_
17
18 #include <PiDxe.h>
19
20 #include <Protocol/Dhcp4.h>
21 #include <Protocol/Ip4Config.h>
22 #include <Protocol/ManagedNetwork.h>
23
24 #include <Library/DebugLib.h>
25 #include <Library/UefiRuntimeServicesTableLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/UefiLib.h>
29 #include <Library/NetLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/MemoryAllocationLib.h>
32
33 #include "NicIp4Variable.h"
34
35 typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
36
37 typedef enum {
38 IP4_CONFIG_STATE_IDLE = 0,
39 IP4_CONFIG_STATE_STARTED,
40 IP4_CONFIG_STATE_CONFIGURED
41 } IP4_CONFIG_STATE;
42
43 #define IP4_PROTO_ICMP 0x01
44 #define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
45
46 typedef enum {
47 DHCP_TAG_PARA_LIST = 55,
48 DHCP_TAG_NETMASK = 1,
49 DHCP_TAG_ROUTER = 3
50 } DHCP_TAGS;
51
52 //
53 // Configure the DHCP to request the routers and netmask
54 // from server. The DHCP_TAG_NETMASK is included in Head.
55 //
56 #pragma pack(1)
57 typedef struct {
58 EFI_DHCP4_PACKET_OPTION Head;
59 UINT8 Route;
60 } IP4_CONFIG_DHCP4_OPTION;
61 #pragma pack()
62
63 struct _IP4_CONFIG_INSTANCE {
64 UINT32 Signature;
65 EFI_HANDLE Controller;
66 EFI_HANDLE Image;
67
68 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
69 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
70
71 //
72 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
73 //
74 INTN State;
75
76 //
77 // Mnp child to keep the connection with MNP.
78 //
79 EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
80 EFI_HANDLE MnpHandle;
81
82 //
83 // User's requests data
84 //
85 EFI_EVENT DoneEvent;
86 EFI_EVENT ReconfigEvent;
87 EFI_STATUS Result;
88
89 //
90 // Identity of this interface and some configuration info.
91 //
92 NIC_ADDR NicAddr;
93 UINT16 NicName[IP4_NIC_NAME_LENGTH];
94 UINT32 NicIndex;
95 NIC_IP4_CONFIG_INFO *NicConfig;
96
97 //
98 // DHCP handles to access DHCP
99 //
100 EFI_DHCP4_PROTOCOL *Dhcp4;
101 EFI_HANDLE Dhcp4Handle;
102 EFI_EVENT Dhcp4Event;
103 };
104
105 #define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
106 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
107
108 #define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
109 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
110
111 extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
112 extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
113 extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
114 extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
115 extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
116 extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
117
118 /**
119 Release all the DHCP related resources.
120
121 @param This The IP4 configure instance
122
123 @return None
124
125 **/
126 VOID
127 Ip4ConfigCleanDhcp4 (
128 IN IP4_CONFIG_INSTANCE *This
129 );
130
131 /**
132 Clean up all the configuration parameters.
133
134 @param Instance The IP4 configure instance
135
136 @return None
137
138 **/
139 VOID
140 Ip4ConfigCleanConfig (
141 IN IP4_CONFIG_INSTANCE *Instance
142 );
143 #endif