]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
Sync the latest version from R8.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Impl.h
CommitLineData
83cbd279 1/** @file\r
2\r
3Copyright (c) 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Dhcp4Impl.h\r
15\r
16Abstract:\r
17\r
18 EFI DHCP protocol implementation\r
19 RFCs supported are:\r
20 RFC 2131: Dynamic Host Configuration Protocol\r
21 RFC 2132: DHCP Options and BOOTP Vendor Extensions\r
22 RFC 1534: Interoperation Between DHCP and BOOTP\r
23 RFC 3396: Encoding Long Options in DHCP\r
24\r
25\r
26**/\r
27\r
28#ifndef __EFI_DHCP4_IMPL_H__\r
29#define __EFI_DHCP4_IMPL_H__\r
30\r
31\r
772db4bb 32\r
33#include <PiDxe.h>\r
34\r
35#include <Protocol/Dhcp4.h>\r
36#include <Protocol/Udp4.h>\r
37\r
38#include <Library/DebugLib.h>\r
39#include <Library/UefiDriverEntryPoint.h>\r
40#include <Library/UefiBootServicesTableLib.h>\r
41#include <Library/UefiLib.h>\r
83cbd279 42#include <Library/BaseLib.h>\r
43#include <Library/NetLib.h>\r
44\r
45typedef struct _DHCP_SERVICE DHCP_SERVICE;\r
46typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;\r
47\r
48#include "Dhcp4Option.h"\r
49#include "Dhcp4Io.h"\r
50\r
51enum {\r
52 DHCP_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),\r
53 DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),\r
54\r
55 //\r
56 // The state of the DHCP service. It starts as UNCONFIGED. If\r
57 // and active child configures the service successfully, it\r
58 // goes to CONFIGED. If the active child configures NULL, it\r
59 // goes back to UNCONFIGED. It becomes DESTORY if it is (partly)\r
60 // destoried.\r
61 //\r
62 DHCP_UNCONFIGED = 0,\r
63 DHCP_CONFIGED,\r
64 DHCP_DESTORY\r
65};\r
66\r
67struct _DHCP_PROTOCOL {\r
68 UINT32 Signature;\r
69 EFI_DHCP4_PROTOCOL Dhcp4Protocol;\r
70 NET_LIST_ENTRY Link;\r
71 EFI_HANDLE Handle;\r
72 DHCP_SERVICE *Service;\r
73\r
74 BOOLEAN InDestory;\r
75\r
76 EFI_EVENT CompletionEvent;\r
77 EFI_EVENT RenewRebindEvent;\r
78\r
79 EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;\r
c4a62a12 80 UDP_IO_PORT *UdpIo; // The UDP IO used for TransmitReceive.\r
81 UINT32 Timeout;\r
82 NET_BUF_QUEUE ResponseQueue;\r
83cbd279 83};\r
84\r
85//\r
86// DHCP driver is specical in that it is a singleton. Although it\r
87// has a service binding, there can be only one active child.\r
88//\r
89struct _DHCP_SERVICE {\r
90 UINT32 Signature;\r
91 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
92\r
93 INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY\r
94 BOOLEAN InDestory;\r
95\r
96 EFI_HANDLE Controller;\r
97 EFI_HANDLE Image;\r
98\r
99 NET_LIST_ENTRY Children;\r
100 UINTN NumChildren;\r
101\r
102 INTN DhcpState;\r
103 EFI_STATUS IoStatus; // the result of last user operation\r
104 UINT32 Xid;\r
105\r
106 IP4_ADDR ClientAddr; // lease IP or configured client address\r
107 IP4_ADDR Netmask;\r
108 IP4_ADDR ServerAddr;\r
109\r
110 EFI_DHCP4_PACKET *LastOffer; // The last received offer\r
111 EFI_DHCP4_PACKET *Selected;\r
112 DHCP_PARAMETER *Para;\r
113\r
114 UINT32 Lease;\r
115 UINT32 T1;\r
116 UINT32 T2;\r
117 INTN ExtraRefresh; // This refresh is reqested by user\r
118\r
119 UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message\r
120 UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP\r
121 NET_BUF *LastPacket; // The last sent packet for retransmission\r
122 EFI_MAC_ADDRESS Mac;\r
123 UINT8 HwType;\r
124 UINT8 HwLen;\r
125\r
126 DHCP_PROTOCOL *ActiveChild;\r
127 EFI_DHCP4_CONFIG_DATA ActiveConfig;\r
128 UINT32 UserOptionLen;\r
129\r
130 //\r
131 // Timer event and various timer\r
132 //\r
133 EFI_EVENT Timer;\r
134\r
135 UINT32 PacketToLive; // Retransmission timer for our packets\r
136 INTN CurRetry;\r
137 INTN MaxRetries;\r
138\r
139 UINT32 WaitOffer; // Time to collect the offers\r
140 UINT32 LeaseLife;\r
141};\r
142\r
143typedef struct {\r
144 EFI_DHCP4_PACKET_OPTION **Option;\r
145 UINT32 OptionCount;\r
146 UINT32 Index;\r
147} DHCP_PARSE_CONTEXT;\r
148\r
149#define DHCP_INSTANCE_FROM_THIS(Proto) \\r
150 CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)\r
151\r
152#define DHCP_SERVICE_FROM_THIS(Sb) \\r
153 CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)\r
154\r
155extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;\r
156\r
157VOID\r
158DhcpYieldControl (\r
159 IN DHCP_SERVICE *DhcpSb\r
160 );\r
161\r
c4a62a12 162VOID\r
163PxeDhcpDone (\r
164 IN DHCP_PROTOCOL *Instance\r
165 );\r
166\r
83cbd279 167#endif\r