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