]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/DnsDxe/DnsDhcp.h
NetworkPkg: Apply uncrustify changes
[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
ecf98fbc 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
99c048ef 6\r
7**/\r
8\r
9#ifndef _DNS_DHCP_H_\r
10#define _DNS_DHCP_H_\r
11\r
12//\r
13// DHCP DNS related\r
14//\r
15#pragma pack(1)\r
16\r
d1050b9d 17#define IP4_ETHER_PROTO 0x0800\r
99c048ef 18\r
d1050b9d
MK
19#define DHCP4_OPCODE_REQUEST 1\r
20#define DHCP4_MAGIC 0x63538263 /// network byte order\r
21#define DHCP4_TAG_EOP 255 /// End Option\r
99c048ef 22\r
d1050b9d
MK
23#define DHCP4_TAG_TYPE 53\r
24#define DHCP4_MSG_REQUEST 3\r
25#define DHCP4_MSG_INFORM 8\r
99c048ef 26\r
d1050b9d
MK
27#define DHCP4_TAG_PARA_LIST 55\r
28#define DHCP4_TAG_DNS_SERVER 6\r
99c048ef 29\r
d1050b9d
MK
30#define DHCP6_TAG_DNS_REQUEST 6\r
31#define DHCP6_TAG_DNS_SERVER 23\r
99c048ef 32\r
d1050b9d 33#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)\r
152f2d5e 34\r
99c048ef 35//\r
36// The required Dns4 server information.\r
37//\r
38typedef struct {\r
d1050b9d
MK
39 UINT32 *ServerCount;\r
40 EFI_IPv4_ADDRESS *ServerList;\r
99c048ef 41} DNS4_SERVER_INFOR;\r
42\r
43//\r
44// The required Dns6 server information.\r
45//\r
46typedef struct {\r
d1050b9d
MK
47 UINT32 *ServerCount;\r
48 EFI_IPv6_ADDRESS *ServerList;\r
99c048ef 49} DNS6_SERVER_INFOR;\r
50\r
51#pragma pack()\r
52\r
53/**\r
54 Parse the ACK to get required information\r
55\r
56 @param Dhcp4 The DHCP4 protocol.\r
57 @param Packet Packet waiting for parse.\r
58 @param DnsServerInfor The required Dns4 server information.\r
59\r
60 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
61 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.\r
62 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
63 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
64\r
65**/\r
66EFI_STATUS\r
67ParseDhcp4Ack (\r
d1050b9d
MK
68 IN EFI_DHCP4_PROTOCOL *Dhcp4,\r
69 IN EFI_DHCP4_PACKET *Packet,\r
70 IN DNS4_SERVER_INFOR *DnsServerInfor\r
99c048ef 71 );\r
72\r
73/**\r
f75a7f56 74 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol\r
99c048ef 75 instance to intercept events that occurs in the DHCPv6 Information Request\r
76 exchange process.\r
77\r
f75a7f56 78 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that\r
99c048ef 79 is used to configure this callback function.\r
80 @param Context Pointer to the context that is initialized in\r
81 the EFI_DHCP6_PROTOCOL.InfoRequest().\r
82 @param Packet Pointer to Reply packet that has been received.\r
83 The EFI DHCPv6 Protocol instance is responsible\r
84 for freeing the buffer.\r
85\r
86 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
87 @retval EFI_DEVICE_ERROR Other errors as indicated.\r
88 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
89**/\r
90EFI_STATUS\r
91EFIAPI\r
92ParseDhcp6Ack (\r
d1050b9d
MK
93 IN EFI_DHCP6_PROTOCOL *This,\r
94 IN VOID *Context,\r
95 IN EFI_DHCP6_PACKET *Packet\r
99c048ef 96 );\r
97\r
98/**\r
99 Parse the DHCP ACK to get Dns4 server information.\r
100\r
101 @param Instance The DNS instance.\r
102 @param DnsServerCount Retrieved Dns4 server Ip count.\r
103 @param DnsServerList Retrieved Dns4 server Ip list.\r
104\r
105 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.\r
106 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
107 @retval EFI_NO_MEDIA There was a media error.\r
108 @retval Others Other errors as indicated.\r
109\r
110**/\r
111EFI_STATUS\r
112GetDns4ServerFromDhcp4 (\r
d1050b9d
MK
113 IN DNS_INSTANCE *Instance,\r
114 OUT UINT32 *DnsServerCount,\r
115 OUT EFI_IPv4_ADDRESS **DnsServerList\r
99c048ef 116 );\r
117\r
118/**\r
119 Parse the DHCP ACK to get Dns6 server information.\r
120\r
121 @param Image The handle of the driver image.\r
122 @param Controller The handle of the controller.\r
123 @param DnsServerCount Retrieved Dns6 server Ip count.\r
124 @param DnsServerList Retrieved Dns6 server Ip list.\r
125\r
126 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.\r
127 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
128 @retval EFI_NO_MEDIA There was a media error.\r
129 @retval Others Other errors as indicated.\r
130\r
131**/\r
132EFI_STATUS\r
133GetDns6ServerFromDhcp6 (\r
d1050b9d
MK
134 IN EFI_HANDLE Image,\r
135 IN EFI_HANDLE Controller,\r
136 OUT UINT32 *DnsServerCount,\r
137 OUT EFI_IPv6_ADDRESS **DnsServerList\r
99c048ef 138 );\r
f75a7f56
LG
139\r
140#endif\r