]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/DnsDxe/DnsDhcp.h
NetworkPkg: Clean up source files
[mirror_edk2.git] / NetworkPkg / DnsDxe / DnsDhcp.h
CommitLineData
99c048ef 1/** @file\r
2Functions implementation related with DHCPv4/v6 for DNS driver.\r
3\r
f75a7f56 4Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
99c048ef 5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _DNS_DHCP_H_\r
16#define _DNS_DHCP_H_\r
17\r
18//\r
19// DHCP DNS related\r
20//\r
21#pragma pack(1)\r
22\r
23#define IP4_ETHER_PROTO 0x0800\r
24\r
25#define DHCP4_OPCODE_REQUEST 1\r
26#define DHCP4_MAGIC 0x63538263 /// network byte order\r
27#define DHCP4_TAG_EOP 255 /// End Option\r
28\r
29#define DHCP4_TAG_TYPE 53\r
30#define DHCP4_MSG_REQUEST 3\r
31#define DHCP4_MSG_INFORM 8\r
32\r
33#define DHCP4_TAG_PARA_LIST 55\r
34#define DHCP4_TAG_DNS_SERVER 6\r
35\r
36\r
37#define DHCP6_TAG_DNS_REQUEST 6\r
38#define DHCP6_TAG_DNS_SERVER 23\r
39\r
152f2d5e 40#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)\r
41\r
99c048ef 42//\r
43// The required Dns4 server information.\r
44//\r
45typedef struct {\r
46 UINT32 *ServerCount;\r
47 EFI_IPv4_ADDRESS *ServerList;\r
48} DNS4_SERVER_INFOR;\r
49\r
50//\r
51// The required Dns6 server information.\r
52//\r
53typedef struct {\r
54 UINT32 *ServerCount;\r
55 EFI_IPv6_ADDRESS *ServerList;\r
56} DNS6_SERVER_INFOR;\r
57\r
58#pragma pack()\r
59\r
60/**\r
61 Parse the ACK to get required information\r
62\r
63 @param Dhcp4 The DHCP4 protocol.\r
64 @param Packet Packet waiting for parse.\r
65 @param DnsServerInfor The required Dns4 server information.\r
66\r
67 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
68 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.\r
69 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
70 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
71\r
72**/\r
73EFI_STATUS\r
74ParseDhcp4Ack (\r
75 IN EFI_DHCP4_PROTOCOL *Dhcp4,\r
76 IN EFI_DHCP4_PACKET *Packet,\r
77 IN DNS4_SERVER_INFOR *DnsServerInfor\r
78 );\r
79\r
80/**\r
f75a7f56 81 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol\r
99c048ef 82 instance to intercept events that occurs in the DHCPv6 Information Request\r
83 exchange process.\r
84\r
f75a7f56 85 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that\r
99c048ef 86 is used to configure this callback function.\r
87 @param Context Pointer to the context that is initialized in\r
88 the EFI_DHCP6_PROTOCOL.InfoRequest().\r
89 @param Packet Pointer to Reply packet that has been received.\r
90 The EFI DHCPv6 Protocol instance is responsible\r
91 for freeing the buffer.\r
92\r
93 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
94 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
95 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
96**/\r
97EFI_STATUS\r
98EFIAPI\r
99ParseDhcp6Ack (\r
100 IN EFI_DHCP6_PROTOCOL *This,\r
101 IN VOID *Context,\r
102 IN EFI_DHCP6_PACKET *Packet\r
103 );\r
104\r
105/**\r
106 Parse the DHCP ACK to get Dns4 server information.\r
107\r
108 @param Instance The DNS instance.\r
109 @param DnsServerCount Retrieved Dns4 server Ip count.\r
110 @param DnsServerList Retrieved Dns4 server Ip list.\r
111\r
112 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.\r
113 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
114 @retval EFI_NO_MEDIA There was a media error.\r
115 @retval Others Other errors as indicated.\r
116\r
117**/\r
118EFI_STATUS\r
119GetDns4ServerFromDhcp4 (\r
120 IN DNS_INSTANCE *Instance,\r
121 OUT UINT32 *DnsServerCount,\r
122 OUT EFI_IPv4_ADDRESS **DnsServerList\r
123 );\r
124\r
125/**\r
126 Parse the DHCP ACK to get Dns6 server information.\r
127\r
128 @param Image The handle of the driver image.\r
129 @param Controller The handle of the controller.\r
130 @param DnsServerCount Retrieved Dns6 server Ip count.\r
131 @param DnsServerList Retrieved Dns6 server Ip list.\r
132\r
133 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.\r
134 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
135 @retval EFI_NO_MEDIA There was a media error.\r
136 @retval Others Other errors as indicated.\r
137\r
138**/\r
139EFI_STATUS\r
140GetDns6ServerFromDhcp6 (\r
141 IN EFI_HANDLE Image,\r
142 IN EFI_HANDLE Controller,\r
143 OUT UINT32 *DnsServerCount,\r
144 OUT EFI_IPv6_ADDRESS **DnsServerList\r
145 );\r
f75a7f56
LG
146\r
147#endif\r