]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
remove member context from _EFI_MTFTP4_TOKEN structure.
[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
80};\r
81\r
82//\r
83// DHCP driver is specical in that it is a singleton. Although it\r
84// has a service binding, there can be only one active child.\r
85//\r
86struct _DHCP_SERVICE {\r
87 UINT32 Signature;\r
88 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
89\r
90 INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY\r
91 BOOLEAN InDestory;\r
92\r
93 EFI_HANDLE Controller;\r
94 EFI_HANDLE Image;\r
95\r
96 NET_LIST_ENTRY Children;\r
97 UINTN NumChildren;\r
98\r
99 INTN DhcpState;\r
100 EFI_STATUS IoStatus; // the result of last user operation\r
101 UINT32 Xid;\r
102\r
103 IP4_ADDR ClientAddr; // lease IP or configured client address\r
104 IP4_ADDR Netmask;\r
105 IP4_ADDR ServerAddr;\r
106\r
107 EFI_DHCP4_PACKET *LastOffer; // The last received offer\r
108 EFI_DHCP4_PACKET *Selected;\r
109 DHCP_PARAMETER *Para;\r
110\r
111 UINT32 Lease;\r
112 UINT32 T1;\r
113 UINT32 T2;\r
114 INTN ExtraRefresh; // This refresh is reqested by user\r
115\r
116 UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message\r
117 UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP\r
118 NET_BUF *LastPacket; // The last sent packet for retransmission\r
119 EFI_MAC_ADDRESS Mac;\r
120 UINT8 HwType;\r
121 UINT8 HwLen;\r
122\r
123 DHCP_PROTOCOL *ActiveChild;\r
124 EFI_DHCP4_CONFIG_DATA ActiveConfig;\r
125 UINT32 UserOptionLen;\r
126\r
127 //\r
128 // Timer event and various timer\r
129 //\r
130 EFI_EVENT Timer;\r
131\r
132 UINT32 PacketToLive; // Retransmission timer for our packets\r
133 INTN CurRetry;\r
134 INTN MaxRetries;\r
135\r
136 UINT32 WaitOffer; // Time to collect the offers\r
137 UINT32 LeaseLife;\r
138};\r
139\r
140typedef struct {\r
141 EFI_DHCP4_PACKET_OPTION **Option;\r
142 UINT32 OptionCount;\r
143 UINT32 Index;\r
144} DHCP_PARSE_CONTEXT;\r
145\r
146#define DHCP_INSTANCE_FROM_THIS(Proto) \\r
147 CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)\r
148\r
149#define DHCP_SERVICE_FROM_THIS(Sb) \\r
150 CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)\r
151\r
152extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;\r
153\r
154VOID\r
155DhcpYieldControl (\r
156 IN DHCP_SERVICE *DhcpSb\r
157 );\r
158\r
159#endif\r