VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.h@ 70119

最後變更 在這個檔案從70119是 58459,由 vboxsync 提交於 9 年 前

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.2 KB
 
1/** @file
2 Functions declaration related with DHCPv6 for UefiPxeBc Driver.
3
4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14**/
15
16#ifndef __EFI_PXEBC_DHCP6_H__
17#define __EFI_PXEBC_DHCP6_H__
18
19#define PXEBC_DHCP6_OPTION_MAX_NUM 16
20#define PXEBC_DHCP6_OPTION_MAX_SIZE 312
21#define PXEBC_DHCP6_PACKET_MAX_SIZE 1472
22#define PXEBC_IP6_POLICY_MAX 0xff
23
24#define PXEBC_DHCP6_S_PORT 547
25#define PXEBC_DHCP6_C_PORT 546
26
27#define PXEBC_DHCP6_OPT_CLIENT_ID 1
28#define PXEBC_DHCP6_OPT_SERVER_ID 2
29#define PXEBC_DHCP6_OPT_IA_NA 3
30#define PXEBC_DHCP6_OPT_IA_TA 4
31#define PXEBC_DHCP6_OPT_IAADDR 5
32#define PXEBC_DHCP6_OPT_ORO 6
33#define PXEBC_DHCP6_OPT_PREFERENCE 7
34#define PXEBC_DHCP6_OPT_ELAPSED_TIME 8
35#define PXEBC_DHCP6_OPT_REPLAY_MSG 9
36#define PXEBC_DHCP6_OPT_AUTH 11
37#define PXEBC_DHCP6_OPT_UNICAST 12
38#define PXEBC_DHCP6_OPT_STATUS_CODE 13
39#define PXEBC_DHCP6_OPT_RAPID_COMMIT 14
40#define PXEBC_DHCP6_OPT_USER_CLASS 15
41#define PXEBC_DHCP6_OPT_VENDOR_CLASS 16
42#define PXEBC_DHCP6_OPT_VENDOR_OPTS 17
43#define PXEBC_DHCP6_OPT_INTERFACE_ID 18
44#define PXEBC_DHCP6_OPT_RECONFIG_MSG 19
45#define PXEBC_DHCP6_OPT_RECONFIG_ACCEPT 20
46#define PXEBC_DHCP6_OPT_BOOT_FILE_URL 59 // Assigned by IANA, RFC 5970
47#define PXEBC_DHCP6_OPT_BOOT_FILE_PARAM 60 // Assigned by IANA, RFC 5970
48#define PXEBC_DHCP6_OPT_ARCH 61 // Assigned by IANA, RFC 5970
49#define PXEBC_DHCP6_OPT_UNDI 62 // Assigned by IANA, RFC 5970
50#define PXEBC_DHCP6_ENTERPRISE_NUM 343 // TODO: IANA TBD: temporarily using Intel's
51#define PXEBC_DHCP6_MAX_BOOT_FILE_SIZE 65535 // It's a limitation of bit length, 65535*512 bytes.
52
53
54#define PXEBC_DHCP6_IDX_IA_NA 0
55#define PXEBC_DHCP6_IDX_BOOT_FILE_URL 1
56#define PXEBC_DHCP6_IDX_BOOT_FILE_PARAM 2
57#define PXEBC_DHCP6_IDX_VENDOR_CLASS 3
58#define PXEBC_DHCP6_IDX_MAX 4
59
60#define PXEBC_DHCP6_BOOT_FILE_URL_PREFIX "tftp://"
61#define PXEBC_TFTP_URL_SEPARATOR '/'
62#define PXEBC_ADDR_START_DELIMITER '['
63#define PXEBC_ADDR_END_DELIMITER ']'
64
65#define GET_NEXT_DHCP6_OPTION(Opt) \
66 (EFI_DHCP6_PACKET_OPTION *) ((UINT8 *) (Opt) + \
67 sizeof (EFI_DHCP6_PACKET_OPTION) + (NTOHS ((Opt)->OpLen)) - 1)
68
69#define GET_DHCP6_OPTION_SIZE(Pkt) \
70 ((Pkt)->Length - sizeof (EFI_DHCP6_HEADER))
71
72#define IS_PROXY_OFFER(Type) \
73 ((Type) == PxeOfferTypeProxyBinl || \
74 (Type) == PxeOfferTypeProxyPxe10 || \
75 (Type) == PxeOfferTypeProxyWfm11a)
76
77
78#pragma pack(1)
79typedef struct {
80 UINT16 OpCode[256];
81} PXEBC_DHCP6_OPTION_ORO;
82
83typedef struct {
84 UINT8 Type;
85 UINT8 MajorVer;
86 UINT8 MinorVer;
87} PXEBC_DHCP6_OPTION_UNDI;
88
89typedef struct {
90 UINT16 Type;
91} PXEBC_DHCP6_OPTION_ARCH;
92
93typedef struct {
94 UINT8 ClassIdentifier[10];
95 UINT8 ArchitecturePrefix[5];
96 UINT8 ArchitectureType[5];
97 UINT8 Lit3[1];
98 UINT8 InterfaceName[4];
99 UINT8 Lit4[1];
100 UINT8 UndiMajor[3];
101 UINT8 UndiMinor[3];
102} PXEBC_CLASS_ID;
103
104typedef struct {
105 UINT32 Vendor;
106 UINT16 ClassLen;
107 PXEBC_CLASS_ID ClassId;
108} PXEBC_DHCP6_OPTION_VENDOR_CLASS;
109
110#pragma pack()
111
112typedef union {
113 PXEBC_DHCP6_OPTION_ORO *Oro;
114 PXEBC_DHCP6_OPTION_UNDI *Undi;
115 PXEBC_DHCP6_OPTION_ARCH *Arch;
116 PXEBC_DHCP6_OPTION_VENDOR_CLASS *VendorClass;
117} PXEBC_DHCP6_OPTION_ENTRY;
118
119typedef struct {
120 LIST_ENTRY Link;
121 EFI_DHCP6_PACKET_OPTION *Option;
122 UINT8 Precedence;
123} PXEBC_DHCP6_OPTION_NODE;
124
125typedef union {
126 EFI_DHCP6_PACKET Offer;
127 EFI_DHCP6_PACKET Ack;
128 UINT8 Buffer[PXEBC_DHCP6_PACKET_MAX_SIZE];
129} PXEBC_DHCP6_PACKET;
130
131typedef struct {
132 PXEBC_DHCP6_PACKET Packet;
133 PXEBC_OFFER_TYPE OfferType;
134 EFI_DHCP6_PACKET_OPTION *OptList[PXEBC_DHCP6_IDX_MAX];
135} PXEBC_DHCP6_PACKET_CACHE;
136
137
138/**
139 Free all the nodes in the boot file list.
140
141 @param[in] Head The pointer to the head of the list.
142
143**/
144VOID
145PxeBcFreeBootFileOption (
146 IN LIST_ENTRY *Head
147 );
148
149
150/**
151 Parse the Boot File URL option.
152
153 @param[out] FileName The pointer to the boot file name.
154 @param[in, out] SrvAddr The pointer to the boot server address.
155 @param[in] BootFile The pointer to the boot file URL option data.
156 @param[in] Length Length of the boot file URL option data.
157
158 @retval EFI_ABORTED User canceled the operation.
159 @retval EFI_SUCCESS Selected the boot menu successfully.
160 @retval EFI_NOT_READY Read the input key from the keybroad has not finish.
161
162**/
163EFI_STATUS
164PxeBcExtractBootFileUrl (
165 OUT UINT8 **FileName,
166 IN OUT EFI_IPv6_ADDRESS *SrvAddr,
167 IN CHAR8 *BootFile,
168 IN UINT16 Length
169 );
170
171
172/**
173 Parse the Boot File Parameter option.
174
175 @param[in] BootFilePara The pointer to the boot file parameter option data.
176 @param[out] BootFileSize The pointer to the parsed boot file size.
177
178 @retval EFI_SUCCESS Successfully obtained the boot file size from parameter option.
179 @retval EFI_NOT_FOUND Failed to extract the boot file size from parameter option.
180
181**/
182EFI_STATUS
183PxeBcExtractBootFileParam (
184 IN CHAR8 *BootFilePara,
185 OUT UINT16 *BootFileSize
186 );
187
188
189/**
190 Parse the cached DHCPv6 packet, including all the options.
191
192 @param[in] Cache6 The pointer to a cached DHCPv6 packet.
193
194 @retval EFI_SUCCESS Parsed the DHCPv6 packet successfully.
195 @retval EFI_DEVICE_ERROR Failed to parse and invalid packet.
196
197**/
198EFI_STATUS
199PxeBcParseDhcp6Packet (
200 IN PXEBC_DHCP6_PACKET_CACHE *Cache6
201 );
202
203
204/**
205 Register the ready address by Ip6Config protocol.
206
207 @param[in] Private The pointer to the PxeBc private data.
208 @param[in] Address The pointer to the ready address.
209
210 @retval EFI_SUCCESS Registered the address succesfully.
211 @retval Others Failed to register the address.
212
213**/
214EFI_STATUS
215PxeBcRegisterIp6Address (
216 IN PXEBC_PRIVATE_DATA *Private,
217 IN EFI_IPv6_ADDRESS *Address
218 );
219
220
221/**
222 Unregister the address by Ip6Config protocol.
223
224 @param[in] Private The pointer to the PxeBc private data.
225
226**/
227VOID
228PxeBcUnregisterIp6Address (
229 IN PXEBC_PRIVATE_DATA *Private
230 );
231
232
233/**
234 Build and send out the request packet for the bootfile, and parse the reply.
235
236 @param[in] Private The pointer to the PxeBc private data.
237 @param[in] Type PxeBc option boot item type.
238 @param[in] Layer The pointer to the option boot item layer.
239 @param[in] UseBis Use BIS or not.
240 @param[in] DestIp The pointer to the server address.
241
242 @retval EFI_SUCCESS Successfully discovered theboot file.
243 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.
244 @retval EFI_NOT_FOUND Can't get the PXE reply packet.
245 @retval Others Failed to discover boot file.
246
247**/
248EFI_STATUS
249PxeBcDhcp6Discover (
250 IN PXEBC_PRIVATE_DATA *Private,
251 IN UINT16 Type,
252 IN UINT16 *Layer,
253 IN BOOLEAN UseBis,
254 IN EFI_IP_ADDRESS *DestIp
255 );
256
257
258/**
259 Start the DHCPv6 S.A.R.R. process to acquire the IPv6 address and other PXE boot information.
260
261 @param[in] Private The pointer to the PxeBc private data.
262 @param[in] Dhcp6 The pointer to EFI_DHCP6_PROTOCOL.
263
264 @retval EFI_SUCCESS The S.A.R.R. process successfully finished.
265 @retval Others Failed to finish the S.A.R.R. process.
266
267**/
268EFI_STATUS
269PxeBcDhcp6Sarr (
270 IN PXEBC_PRIVATE_DATA *Private,
271 IN EFI_DHCP6_PROTOCOL *Dhcp6
272 );
273
274#endif
275
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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