VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h@ 80721

Last change on this file since 80721 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 7.6 KB
Line 
1/** @file
2 Functions declaration related with DHCPv6 for UefiPxeBc Driver.
3
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef __EFI_PXEBC_DHCP6_H__
11#define __EFI_PXEBC_DHCP6_H__
12
13#define PXEBC_DHCP6_OPTION_MAX_NUM 16
14#define PXEBC_DHCP6_OPTION_MAX_SIZE 312
15#define PXEBC_DHCP6_PACKET_MAX_SIZE (sizeof (EFI_PXE_BASE_CODE_PACKET))
16#define PXEBC_IP6_POLICY_MAX 0xff
17#define PXEBC_IP6_ROUTE_TABLE_TIMEOUT 10
18
19#define PXEBC_DHCP6_S_PORT 547
20#define PXEBC_DHCP6_C_PORT 546
21
22#define PXEBC_DHCP6_ENTERPRISE_NUM 343 // TODO: IANA TBD: temporarily using Intel's
23#define PXEBC_DHCP6_MAX_BOOT_FILE_SIZE 65535 // It's a limitation of bit length, 65535*512 bytes.
24
25
26#define PXEBC_DHCP6_IDX_IA_NA 0
27#define PXEBC_DHCP6_IDX_BOOT_FILE_URL 1
28#define PXEBC_DHCP6_IDX_BOOT_FILE_PARAM 2
29#define PXEBC_DHCP6_IDX_VENDOR_CLASS 3
30#define PXEBC_DHCP6_IDX_DNS_SERVER 4
31#define PXEBC_DHCP6_IDX_MAX 5
32
33#define PXEBC_DHCP6_BOOT_FILE_URL_PREFIX "tftp://"
34#define PXEBC_TFTP_URL_SEPARATOR '/'
35#define PXEBC_ADDR_START_DELIMITER '['
36#define PXEBC_ADDR_END_DELIMITER ']'
37
38#define GET_NEXT_DHCP6_OPTION(Opt) \
39 (EFI_DHCP6_PACKET_OPTION *) ((UINT8 *) (Opt) + \
40 sizeof (EFI_DHCP6_PACKET_OPTION) + (NTOHS ((Opt)->OpLen)) - 1)
41
42#define GET_DHCP6_OPTION_SIZE(Pkt) \
43 ((Pkt)->Length - sizeof (EFI_DHCP6_HEADER))
44
45#define IS_PROXY_OFFER(Type) \
46 ((Type) == PxeOfferTypeProxyBinl || \
47 (Type) == PxeOfferTypeProxyPxe10 || \
48 (Type) == PxeOfferTypeProxyWfm11a)
49
50
51#pragma pack(1)
52typedef struct {
53 UINT16 OpCode[256];
54} PXEBC_DHCP6_OPTION_ORO;
55
56typedef struct {
57 UINT8 Type;
58 UINT8 MajorVer;
59 UINT8 MinorVer;
60} PXEBC_DHCP6_OPTION_UNDI;
61
62typedef struct {
63 UINT16 Type;
64} PXEBC_DHCP6_OPTION_ARCH;
65
66typedef struct {
67 UINT8 ClassIdentifier[10];
68 UINT8 ArchitecturePrefix[5];
69 UINT8 ArchitectureType[5];
70 UINT8 Lit3[1];
71 UINT8 InterfaceName[4];
72 UINT8 Lit4[1];
73 UINT8 UndiMajor[3];
74 UINT8 UndiMinor[3];
75} PXEBC_CLASS_ID;
76
77typedef struct {
78 UINT32 Vendor;
79 UINT16 ClassLen;
80 PXEBC_CLASS_ID ClassId;
81} PXEBC_DHCP6_OPTION_VENDOR_CLASS;
82
83#pragma pack()
84
85typedef union {
86 PXEBC_DHCP6_OPTION_ORO *Oro;
87 PXEBC_DHCP6_OPTION_UNDI *Undi;
88 PXEBC_DHCP6_OPTION_ARCH *Arch;
89 PXEBC_DHCP6_OPTION_VENDOR_CLASS *VendorClass;
90} PXEBC_DHCP6_OPTION_ENTRY;
91
92typedef struct {
93 LIST_ENTRY Link;
94 EFI_DHCP6_PACKET_OPTION *Option;
95 UINT8 Precedence;
96} PXEBC_DHCP6_OPTION_NODE;
97
98#define PXEBC_CACHED_DHCP6_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP6_PACKET, Dhcp6) + PXEBC_DHCP6_PACKET_MAX_SIZE)
99
100typedef union {
101 EFI_DHCP6_PACKET Offer;
102 EFI_DHCP6_PACKET Ack;
103 UINT8 Buffer[PXEBC_CACHED_DHCP6_PACKET_MAX_SIZE];
104} PXEBC_DHCP6_PACKET;
105
106typedef struct {
107 PXEBC_DHCP6_PACKET Packet;
108 PXEBC_OFFER_TYPE OfferType;
109 EFI_DHCP6_PACKET_OPTION *OptList[PXEBC_DHCP6_IDX_MAX];
110} PXEBC_DHCP6_PACKET_CACHE;
111
112
113
114
115/**
116 Parse the Boot File URL option.
117
118 @param[in] Private Pointer to PxeBc private data.
119 @param[out] FileName The pointer to the boot file name.
120 @param[in, out] SrvAddr The pointer to the boot server address.
121 @param[in] BootFile The pointer to the boot file URL option data.
122 @param[in] Length Length of the boot file URL option data.
123
124 @retval EFI_ABORTED User canceled the operation.
125 @retval EFI_SUCCESS Selected the boot menu successfully.
126 @retval EFI_NOT_READY Read the input key from the keybroad has not finish.
127
128**/
129EFI_STATUS
130PxeBcExtractBootFileUrl (
131 IN PXEBC_PRIVATE_DATA *Private,
132 OUT UINT8 **FileName,
133 IN OUT EFI_IPv6_ADDRESS *SrvAddr,
134 IN CHAR8 *BootFile,
135 IN UINT16 Length
136 );
137
138
139/**
140 Parse the Boot File Parameter option.
141
142 @param[in] BootFilePara The pointer to the boot file parameter option data.
143 @param[out] BootFileSize The pointer to the parsed boot file size.
144
145 @retval EFI_SUCCESS Successfully obtained the boot file size from parameter option.
146 @retval EFI_NOT_FOUND Failed to extract the boot file size from parameter option.
147
148**/
149EFI_STATUS
150PxeBcExtractBootFileParam (
151 IN CHAR8 *BootFilePara,
152 OUT UINT16 *BootFileSize
153 );
154
155
156/**
157 Parse the cached DHCPv6 packet, including all the options.
158
159 @param[in] Cache6 The pointer to a cached DHCPv6 packet.
160
161 @retval EFI_SUCCESS Parsed the DHCPv6 packet successfully.
162 @retval EFI_DEVICE_ERROR Failed to parse and invalid packet.
163
164**/
165EFI_STATUS
166PxeBcParseDhcp6Packet (
167 IN PXEBC_DHCP6_PACKET_CACHE *Cache6
168 );
169
170
171/**
172 Register the ready address by Ip6Config protocol.
173
174 @param[in] Private The pointer to the PxeBc private data.
175 @param[in] Address The pointer to the ready address.
176
177 @retval EFI_SUCCESS Registered the address succesfully.
178 @retval Others Failed to register the address.
179
180**/
181EFI_STATUS
182PxeBcRegisterIp6Address (
183 IN PXEBC_PRIVATE_DATA *Private,
184 IN EFI_IPv6_ADDRESS *Address
185 );
186
187
188/**
189 Unregister the address by Ip6Config protocol.
190
191 @param[in] Private The pointer to the PxeBc private data.
192
193**/
194VOID
195PxeBcUnregisterIp6Address (
196 IN PXEBC_PRIVATE_DATA *Private
197 );
198
199
200/**
201 Build and send out the request packet for the bootfile, and parse the reply.
202
203 @param[in] Private The pointer to the PxeBc private data.
204 @param[in] Type PxeBc option boot item type.
205 @param[in] Layer The pointer to the option boot item layer.
206 @param[in] UseBis Use BIS or not.
207 @param[in] DestIp The pointer to the server address.
208
209 @retval EFI_SUCCESS Successfully discovered theboot file.
210 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.
211 @retval EFI_NOT_FOUND Can't get the PXE reply packet.
212 @retval Others Failed to discover boot file.
213
214**/
215EFI_STATUS
216PxeBcDhcp6Discover (
217 IN PXEBC_PRIVATE_DATA *Private,
218 IN UINT16 Type,
219 IN UINT16 *Layer,
220 IN BOOLEAN UseBis,
221 IN EFI_IP_ADDRESS *DestIp
222 );
223
224/**
225 Set the IP6 policy to Automatic.
226
227 @param[in] Private The pointer to PXEBC_PRIVATE_DATA.
228
229 @retval EFI_SUCCESS Switch the IP policy succesfully.
230 @retval Others Unexpect error happened.
231
232**/
233EFI_STATUS
234PxeBcSetIp6Policy (
235 IN PXEBC_PRIVATE_DATA *Private
236 );
237
238/**
239 This function will register the station IP address and flush IP instance to start using the new IP address.
240
241 @param[in] Private The pointer to PXEBC_PRIVATE_DATA.
242
243 @retval EFI_SUCCESS The new IP address has been configured successfully.
244 @retval Others Failed to configure the address.
245
246**/
247EFI_STATUS
248PxeBcSetIp6Address (
249 IN PXEBC_PRIVATE_DATA *Private
250 );
251
252/**
253 Start the DHCPv6 S.A.R.R. process to acquire the IPv6 address and other PXE boot information.
254
255 @param[in] Private The pointer to the PxeBc private data.
256 @param[in] Dhcp6 The pointer to EFI_DHCP6_PROTOCOL.
257
258 @retval EFI_SUCCESS The S.A.R.R. process successfully finished.
259 @retval Others Failed to finish the S.A.R.R. process.
260
261**/
262EFI_STATUS
263PxeBcDhcp6Sarr (
264 IN PXEBC_PRIVATE_DATA *Private,
265 IN EFI_DHCP6_PROTOCOL *Dhcp6
266 );
267
268#endif
269
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette