VirtualBox

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

Last change on this file since 105668 was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

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

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