]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
1 /** @file
2
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
8
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.
11
12 Module Name:
13
14 Ip4Config.h
15
16 Abstract:
17
18 Header file for IP4Config driver.
19
20
21 **/
22
23 #ifndef __EFI_IP4CONFIG_H__
24 #define __EFI_IP4CONFIG_H__
25
26 #include <PiDxe.h>
27
28 #include <Protocol/Dhcp4.h>
29 #include <Protocol/Ip4Config.h>
30 #include <Protocol/ManagedNetwork.h>
31
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>
40
41 #include "NicIp4Variable.h"
42
43 typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
44
45 typedef enum {
46 IP4_CONFIG_STATE_IDLE = 0,
47 IP4_CONFIG_STATE_STARTED,
48 IP4_CONFIG_STATE_CONFIGURED
49 } IP4_CONFIG_STATE;
50
51 #define IP4_PROTO_ICMP 0x01
52 #define IP4_CONFIG_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('I', 'P', '4', 'C')
53
54 typedef enum {
55 DHCP_TAG_PARA_LIST = 55,
56 DHCP_TAG_NETMASK = 1,
57 DHCP_TAG_ROUTER = 3
58 } DHCP_TAGS;
59
60 //
61 // Configure the DHCP to request the routers and netmask
62 // from server. The DHCP_TAG_NETMASK is included in Head.
63 //
64 #pragma pack(1)
65 typedef struct {
66 EFI_DHCP4_PACKET_OPTION Head;
67 UINT8 Route;
68 } IP4_CONFIG_DHCP4_OPTION;
69 #pragma pack()
70
71 struct _IP4_CONFIG_INSTANCE {
72 UINT32 Signature;
73 EFI_HANDLE Controller;
74 EFI_HANDLE Image;
75
76 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
77 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
78
79 //
80 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
81 //
82 INTN State;
83
84 //
85 // Mnp child to keep the connection with MNP.
86 //
87 EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
88 EFI_HANDLE MnpHandle;
89
90 //
91 // User's requests data
92 //
93 EFI_EVENT DoneEvent;
94 EFI_EVENT ReconfigEvent;
95 EFI_STATUS Result;
96
97 //
98 // Identity of this interface and some configuration info.
99 //
100 NIC_ADDR NicAddr;
101 UINT16 NicName[IP4_NIC_NAME_LENGTH];
102 UINT32 NicIndex;
103 NIC_IP4_CONFIG_INFO *NicConfig;
104
105 //
106 // DHCP handles to access DHCP
107 //
108 EFI_DHCP4_PROTOCOL *Dhcp4;
109 EFI_HANDLE Dhcp4Handle;
110 EFI_EVENT Dhcp4Event;
111 };
112
113 #define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
114 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
115
116 #define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
117 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
118
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;
125
126 /**
127 Release all the DHCP related resources.
128
129 @param This The IP4 configure instance
130
131 @return None
132
133 **/
134 VOID
135 Ip4ConfigCleanDhcp4 (
136 IN IP4_CONFIG_INSTANCE *This
137 );
138
139 /**
140 Clean up all the configuration parameters.
141
142 @param Instance The IP4 configure instance
143
144 @return None
145
146 **/
147 VOID
148 Ip4ConfigCleanConfig (
149 IN IP4_CONFIG_INSTANCE *Instance
150 );
151 #endif