1 | /** @file
|
---|
2 | Functions declaration related with DHCPv6 for HTTP boot driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef __EFI_HTTP_BOOT_DHCP6_H__
|
---|
10 | #define __EFI_HTTP_BOOT_DHCP6_H__
|
---|
11 |
|
---|
12 | #define HTTP_BOOT_OFFER_MAX_NUM 16
|
---|
13 | #define HTTP_BOOT_DHCP6_OPTION_MAX_NUM 16
|
---|
14 | #define HTTP_BOOT_DHCP6_OPTION_MAX_SIZE 312
|
---|
15 | #define HTTP_BOOT_DHCP6_PACKET_MAX_SIZE 1472
|
---|
16 | #define HTTP_BOOT_IP6_ROUTE_TABLE_TIMEOUT 10
|
---|
17 | #define HTTP_BOOT_DEFAULT_HOPLIMIT 64
|
---|
18 | #define HTTP_BOOT_DEFAULT_LIFETIME 50000
|
---|
19 |
|
---|
20 | #define HTTP_BOOT_DHCP6_ENTERPRISE_NUM 343 // TODO: IANA TBD: temporarily using Intel's
|
---|
21 | #define HTTP_BOOT_DHCP6_MAX_BOOT_FILE_SIZE 65535 // It's a limitation of bit length, 65535*512 bytes.
|
---|
22 |
|
---|
23 | #define HTTP_BOOT_DHCP6_IDX_IA_NA 0
|
---|
24 | #define HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL 1
|
---|
25 | #define HTTP_BOOT_DHCP6_IDX_BOOT_FILE_PARAM 2
|
---|
26 | #define HTTP_BOOT_DHCP6_IDX_VENDOR_CLASS 3
|
---|
27 | #define HTTP_BOOT_DHCP6_IDX_DNS_SERVER 4
|
---|
28 | #define HTTP_BOOT_DHCP6_IDX_MAX 5
|
---|
29 |
|
---|
30 | #pragma pack(1)
|
---|
31 | typedef struct {
|
---|
32 | UINT16 OpCode[256];
|
---|
33 | } HTTP_BOOT_DHCP6_OPTION_ORO;
|
---|
34 |
|
---|
35 | typedef struct {
|
---|
36 | UINT8 Type;
|
---|
37 | UINT8 MajorVer;
|
---|
38 | UINT8 MinorVer;
|
---|
39 | } HTTP_BOOT_DHCP6_OPTION_UNDI;
|
---|
40 |
|
---|
41 | typedef struct {
|
---|
42 | UINT16 Type;
|
---|
43 | } HTTP_BOOT_DHCP6_OPTION_ARCH;
|
---|
44 |
|
---|
45 | typedef struct {
|
---|
46 | UINT8 ClassIdentifier[11];
|
---|
47 | UINT8 ArchitecturePrefix[5];
|
---|
48 | UINT8 ArchitectureType[5];
|
---|
49 | UINT8 Lit3[1];
|
---|
50 | UINT8 InterfaceName[4];
|
---|
51 | UINT8 Lit4[1];
|
---|
52 | UINT8 UndiMajor[3];
|
---|
53 | UINT8 UndiMinor[3];
|
---|
54 | } HTTP_BOOT_CLASS_ID;
|
---|
55 |
|
---|
56 | typedef struct {
|
---|
57 | UINT32 Vendor;
|
---|
58 | UINT16 ClassLen;
|
---|
59 | HTTP_BOOT_CLASS_ID ClassId;
|
---|
60 | } HTTP_BOOT_DHCP6_OPTION_VENDOR_CLASS;
|
---|
61 |
|
---|
62 | #pragma pack()
|
---|
63 |
|
---|
64 | typedef union {
|
---|
65 | HTTP_BOOT_DHCP6_OPTION_ORO *Oro;
|
---|
66 | HTTP_BOOT_DHCP6_OPTION_UNDI *Undi;
|
---|
67 | HTTP_BOOT_DHCP6_OPTION_ARCH *Arch;
|
---|
68 | HTTP_BOOT_DHCP6_OPTION_VENDOR_CLASS *VendorClass;
|
---|
69 | } HTTP_BOOT_DHCP6_OPTION_ENTRY;
|
---|
70 |
|
---|
71 | #define HTTP_CACHED_DHCP6_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP6_PACKET, Dhcp6) + HTTP_BOOT_DHCP6_PACKET_MAX_SIZE)
|
---|
72 |
|
---|
73 | typedef union {
|
---|
74 | EFI_DHCP6_PACKET Offer;
|
---|
75 | EFI_DHCP6_PACKET Ack;
|
---|
76 | UINT8 Buffer[HTTP_CACHED_DHCP6_PACKET_MAX_SIZE];
|
---|
77 | } HTTP_BOOT_DHCP6_PACKET;
|
---|
78 |
|
---|
79 | typedef struct {
|
---|
80 | HTTP_BOOT_DHCP6_PACKET Packet;
|
---|
81 | HTTP_BOOT_OFFER_TYPE OfferType;
|
---|
82 | EFI_DHCP6_PACKET_OPTION *OptList[HTTP_BOOT_DHCP6_IDX_MAX];
|
---|
83 | VOID *UriParser;
|
---|
84 | } HTTP_BOOT_DHCP6_PACKET_CACHE;
|
---|
85 |
|
---|
86 | #define GET_NEXT_DHCP6_OPTION(Opt) \
|
---|
87 | (EFI_DHCP6_PACKET_OPTION *) ((UINT8 *) (Opt) + \
|
---|
88 | sizeof (EFI_DHCP6_PACKET_OPTION) + (NTOHS ((Opt)->OpLen)) - 1)
|
---|
89 |
|
---|
90 | #define GET_DHCP6_OPTION_SIZE(Pkt) \
|
---|
91 | ((Pkt)->Length - sizeof (EFI_DHCP6_HEADER))
|
---|
92 |
|
---|
93 | /**
|
---|
94 | Start the S.A.R.R DHCPv6 process to acquire the IPv6 address and other Http boot information.
|
---|
95 |
|
---|
96 | @param[in] Private Pointer to HTTP_BOOT private data.
|
---|
97 |
|
---|
98 | @retval EFI_SUCCESS The S.A.R.R process successfully finished.
|
---|
99 | @retval Others Failed to finish the S.A.R.R process.
|
---|
100 |
|
---|
101 | **/
|
---|
102 | EFI_STATUS
|
---|
103 | HttpBootDhcp6Sarr (
|
---|
104 | IN HTTP_BOOT_PRIVATE_DATA *Private
|
---|
105 | );
|
---|
106 |
|
---|
107 | /**
|
---|
108 | Set the IP6 policy to Automatic.
|
---|
109 |
|
---|
110 | @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
---|
111 |
|
---|
112 | @retval EFI_SUCCESS Switch the IP policy successfully.
|
---|
113 | @retval Others Unexpected error happened.
|
---|
114 |
|
---|
115 | **/
|
---|
116 | EFI_STATUS
|
---|
117 | HttpBootSetIp6Policy (
|
---|
118 | IN HTTP_BOOT_PRIVATE_DATA *Private
|
---|
119 | );
|
---|
120 |
|
---|
121 | /**
|
---|
122 | This function will register the default DNS addresses to the network device.
|
---|
123 |
|
---|
124 | @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
---|
125 | @param[in] DataLength Size of the buffer pointed to by DnsServerData in bytes.
|
---|
126 | @param[in] DnsServerData Point a list of DNS server address in an array
|
---|
127 | of EFI_IPv6_ADDRESS instances.
|
---|
128 |
|
---|
129 | @retval EFI_SUCCESS The DNS configuration has been configured successfully.
|
---|
130 | @retval Others Failed to configure the address.
|
---|
131 |
|
---|
132 | **/
|
---|
133 | EFI_STATUS
|
---|
134 | HttpBootSetIp6Dns (
|
---|
135 | IN HTTP_BOOT_PRIVATE_DATA *Private,
|
---|
136 | IN UINTN DataLength,
|
---|
137 | IN VOID *DnsServerData
|
---|
138 | );
|
---|
139 |
|
---|
140 | /**
|
---|
141 | This function will register the IPv6 gateway address to the network device.
|
---|
142 |
|
---|
143 | @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
---|
144 |
|
---|
145 | @retval EFI_SUCCESS The new IP configuration has been configured successfully.
|
---|
146 | @retval Others Failed to configure the address.
|
---|
147 |
|
---|
148 | **/
|
---|
149 | EFI_STATUS
|
---|
150 | HttpBootSetIp6Gateway (
|
---|
151 | IN HTTP_BOOT_PRIVATE_DATA *Private
|
---|
152 | );
|
---|
153 |
|
---|
154 | /**
|
---|
155 | This function will register the station IP address.
|
---|
156 |
|
---|
157 | @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
|
---|
158 |
|
---|
159 | @retval EFI_SUCCESS The new IP address has been configured successfully.
|
---|
160 | @retval Others Failed to configure the address.
|
---|
161 |
|
---|
162 | **/
|
---|
163 | EFI_STATUS
|
---|
164 | HttpBootSetIp6Address (
|
---|
165 | IN HTTP_BOOT_PRIVATE_DATA *Private
|
---|
166 | );
|
---|
167 |
|
---|
168 | #endif
|
---|