]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
Import Ip4Config module
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
1 /** @file
2
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
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 enum {
46 IP4_CONFIG_STATE_IDLE = 0,
47 IP4_CONFIG_STATE_STARTED,
48 IP4_CONFIG_STATE_CONFIGURED,
49
50 IP4_PROTO_ICMP = 0x01,
51 IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
52
53 DHCP_TAG_PARA_LIST = 55,
54 DHCP_TAG_NETMASK = 1,
55 DHCP_TAG_ROUTER = 3,
56 };
57
58 //
59 // Configure the DHCP to request the routers and netmask
60 // from server. The DHCP_TAG_NETMASK is included in Head.
61 //
62 #pragma pack(1)
63 typedef struct {
64 EFI_DHCP4_PACKET_OPTION Head;
65 UINT8 Route;
66 } IP4_CONFIG_DHCP4_OPTION;
67 #pragma pack()
68
69 typedef struct _IP4_CONFIG_INSTANCE {
70 UINT32 Signature;
71 EFI_HANDLE Controller;
72 EFI_HANDLE Image;
73
74 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
75 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
76
77 //
78 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
79 //
80 INTN State;
81
82 //
83 // Mnp child to keep the connection with MNP.
84 //
85 EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
86 EFI_HANDLE MnpHandle;
87
88 //
89 // User's requests data
90 //
91 EFI_EVENT DoneEvent;
92 EFI_EVENT ReconfigEvent;
93 EFI_STATUS Result;
94
95 //
96 // Identity of this interface and some configuration info.
97 //
98 NIC_ADDR NicAddr;
99 UINT16 NicName[IP4_NIC_NAME_LENGTH];
100 UINT32 NicIndex;
101 NIC_IP4_CONFIG_INFO *NicConfig;
102
103 //
104 // DHCP handles to access DHCP
105 //
106 EFI_DHCP4_PROTOCOL *Dhcp4;
107 EFI_HANDLE Dhcp4Handle;
108 EFI_EVENT Dhcp4Event;
109 };
110
111 #define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
112 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
113
114 #define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
115 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
116
117 extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
118 extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
119 extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
120 extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
121 extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
122
123 VOID
124 Ip4ConfigCleanDhcp4 (
125 IN IP4_CONFIG_INSTANCE *This
126 );
127
128 VOID
129 Ip4ConfigCleanConfig (
130 IN IP4_CONFIG_INSTANCE *Instance
131 );
132 #endif