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