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