]>
git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/DnsDxe/DnsDhcp.h
2 Functions implementation related with DHCPv4/v6 for DNS driver.
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
17 #define IP4_ETHER_PROTO 0x0800
19 #define DHCP4_OPCODE_REQUEST 1
20 #define DHCP4_MAGIC 0x63538263 /// network byte order
21 #define DHCP4_TAG_EOP 255 /// End Option
23 #define DHCP4_TAG_TYPE 53
24 #define DHCP4_MSG_REQUEST 3
25 #define DHCP4_MSG_INFORM 8
27 #define DHCP4_TAG_PARA_LIST 55
28 #define DHCP4_TAG_DNS_SERVER 6
31 #define DHCP6_TAG_DNS_REQUEST 6
32 #define DHCP6_TAG_DNS_SERVER 23
34 #define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
37 // The required Dns4 server information.
41 EFI_IPv4_ADDRESS
*ServerList
;
45 // The required Dns6 server information.
49 EFI_IPv6_ADDRESS
*ServerList
;
55 Parse the ACK to get required information
57 @param Dhcp4 The DHCP4 protocol.
58 @param Packet Packet waiting for parse.
59 @param DnsServerInfor The required Dns4 server information.
61 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
62 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
63 @retval EFI_DEVICE_ERROR Other errors as indicated.
64 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
69 IN EFI_DHCP4_PROTOCOL
*Dhcp4
,
70 IN EFI_DHCP4_PACKET
*Packet
,
71 IN DNS4_SERVER_INFOR
*DnsServerInfor
75 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol
76 instance to intercept events that occurs in the DHCPv6 Information Request
79 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that
80 is used to configure this callback function.
81 @param Context Pointer to the context that is initialized in
82 the EFI_DHCP6_PROTOCOL.InfoRequest().
83 @param Packet Pointer to Reply packet that has been received.
84 The EFI DHCPv6 Protocol instance is responsible
85 for freeing the buffer.
87 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
88 @retval EFI_DEVICE_ERROR Other errors as indicated.
89 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
94 IN EFI_DHCP6_PROTOCOL
*This
,
96 IN EFI_DHCP6_PACKET
*Packet
100 Parse the DHCP ACK to get Dns4 server information.
102 @param Instance The DNS instance.
103 @param DnsServerCount Retrieved Dns4 server Ip count.
104 @param DnsServerList Retrieved Dns4 server Ip list.
106 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.
107 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
108 @retval EFI_NO_MEDIA There was a media error.
109 @retval Others Other errors as indicated.
113 GetDns4ServerFromDhcp4 (
114 IN DNS_INSTANCE
*Instance
,
115 OUT UINT32
*DnsServerCount
,
116 OUT EFI_IPv4_ADDRESS
**DnsServerList
120 Parse the DHCP ACK to get Dns6 server information.
122 @param Image The handle of the driver image.
123 @param Controller The handle of the controller.
124 @param DnsServerCount Retrieved Dns6 server Ip count.
125 @param DnsServerList Retrieved Dns6 server Ip list.
127 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.
128 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
129 @retval EFI_NO_MEDIA There was a media error.
130 @retval Others Other errors as indicated.
134 GetDns6ServerFromDhcp6 (
136 IN EFI_HANDLE Controller
,
137 OUT UINT32
*DnsServerCount
,
138 OUT EFI_IPv6_ADDRESS
**DnsServerList