]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/DnsDxe/DnsDhcp.h
NetworkPkg: Removing or adding some ASSERT statement
[mirror_edk2.git] / NetworkPkg / DnsDxe / DnsDhcp.h
CommitLineData
99c048ef 1/** @file\r
2Functions implementation related with DHCPv4/v6 for DNS driver.\r
3\r
4Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
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
40//\r
41// The required Dns4 server information.\r
42//\r
43typedef struct {\r
44 UINT32 *ServerCount;\r
45 EFI_IPv4_ADDRESS *ServerList;\r
46} DNS4_SERVER_INFOR;\r
47\r
48//\r
49// The required Dns6 server information.\r
50//\r
51typedef struct {\r
52 UINT32 *ServerCount;\r
53 EFI_IPv6_ADDRESS *ServerList;\r
54} DNS6_SERVER_INFOR;\r
55\r
56#pragma pack()\r
57\r
58/**\r
59 Parse the ACK to get required information\r
60\r
61 @param Dhcp4 The DHCP4 protocol.\r
62 @param Packet Packet waiting for parse.\r
63 @param DnsServerInfor The required Dns4 server information.\r
64\r
65 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
66 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.\r
67 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
68 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
69\r
70**/\r
71EFI_STATUS\r
72ParseDhcp4Ack (\r
73 IN EFI_DHCP4_PROTOCOL *Dhcp4,\r
74 IN EFI_DHCP4_PACKET *Packet,\r
75 IN DNS4_SERVER_INFOR *DnsServerInfor\r
76 );\r
77\r
78/**\r
79 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol \r
80 instance to intercept events that occurs in the DHCPv6 Information Request\r
81 exchange process.\r
82\r
83 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that \r
84 is used to configure this callback function.\r
85 @param Context Pointer to the context that is initialized in\r
86 the EFI_DHCP6_PROTOCOL.InfoRequest().\r
87 @param Packet Pointer to Reply packet that has been received.\r
88 The EFI DHCPv6 Protocol instance is responsible\r
89 for freeing the buffer.\r
90\r
91 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
92 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
93 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
94**/\r
95EFI_STATUS\r
96EFIAPI\r
97ParseDhcp6Ack (\r
98 IN EFI_DHCP6_PROTOCOL *This,\r
99 IN VOID *Context,\r
100 IN EFI_DHCP6_PACKET *Packet\r
101 );\r
102\r
103/**\r
104 Parse the DHCP ACK to get Dns4 server information.\r
105\r
106 @param Instance The DNS instance.\r
107 @param DnsServerCount Retrieved Dns4 server Ip count.\r
108 @param DnsServerList Retrieved Dns4 server Ip list.\r
109\r
110 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.\r
111 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
112 @retval EFI_NO_MEDIA There was a media error.\r
113 @retval Others Other errors as indicated.\r
114\r
115**/\r
116EFI_STATUS\r
117GetDns4ServerFromDhcp4 (\r
118 IN DNS_INSTANCE *Instance,\r
119 OUT UINT32 *DnsServerCount,\r
120 OUT EFI_IPv4_ADDRESS **DnsServerList\r
121 );\r
122\r
123/**\r
124 Parse the DHCP ACK to get Dns6 server information.\r
125\r
126 @param Image The handle of the driver image.\r
127 @param Controller The handle of the controller.\r
128 @param DnsServerCount Retrieved Dns6 server Ip count.\r
129 @param DnsServerList Retrieved Dns6 server Ip list.\r
130\r
131 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.\r
132 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
133 @retval EFI_NO_MEDIA There was a media error.\r
134 @retval Others Other errors as indicated.\r
135\r
136**/\r
137EFI_STATUS\r
138GetDns6ServerFromDhcp6 (\r
139 IN EFI_HANDLE Image,\r
140 IN EFI_HANDLE Controller,\r
141 OUT UINT32 *DnsServerCount,\r
142 OUT EFI_IPv6_ADDRESS **DnsServerList\r
143 );\r
144 \r
145#endif