]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
Import Ip4Config module
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
CommitLineData
b2570da8 1/** @file
2
3Copyright (c) 2006 - 2007, Intel Corporation
4All rights reserved. This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14 Ip4Config.h
15
16Abstract:
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>\r
27\r
28#include <Protocol/Dhcp4.h>\r
29#include <Protocol/IP4Config.h>\r
30#include <Protocol/ManagedNetwork.h>\r
31\r
32#include <Library/DebugLib.h>\r
33#include <Library/UefiRuntimeServicesTableLib.h>\r
34#include <Library/UefiDriverEntryPoint.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/UefiLib.h>\r
37#include <Library/NetLib.h>\r
38#include <Library/BaseMemoryLib.h>\r
39#include <Library/MemoryAllocationLib.h>
40
41#include "NicIp4Variable.h"
42
43typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
44
45enum {
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)
63typedef struct {
64 EFI_DHCP4_PACKET_OPTION Head;
65 UINT8 Route;
66} IP4_CONFIG_DHCP4_OPTION;
67#pragma pack()
68
69typedef 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
117extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
118extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
119extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
120extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
121extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
122
123VOID
124Ip4ConfigCleanDhcp4 (
125 IN IP4_CONFIG_INSTANCE *This
126 );
127
128VOID
129Ip4ConfigCleanConfig (
130 IN IP4_CONFIG_INSTANCE *Instance
131 );
132#endif