]>
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
30 #define DHCP6_TAG_DNS_REQUEST 6
31 #define DHCP6_TAG_DNS_SERVER 23
33 #define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
36 // The required Dns4 server information.
40 EFI_IPv4_ADDRESS
*ServerList
;
44 // The required Dns6 server information.
48 EFI_IPv6_ADDRESS
*ServerList
;
54 Parse the ACK to get required information
56 @param Dhcp4 The DHCP4 protocol.
57 @param Packet Packet waiting for parse.
58 @param DnsServerInfor The required Dns4 server information.
60 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
61 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
62 @retval EFI_DEVICE_ERROR Other errors as indicated.
63 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
68 IN EFI_DHCP4_PROTOCOL
*Dhcp4
,
69 IN EFI_DHCP4_PACKET
*Packet
,
70 IN DNS4_SERVER_INFOR
*DnsServerInfor
74 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol
75 instance to intercept events that occurs in the DHCPv6 Information Request
78 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that
79 is used to configure this callback function.
80 @param Context Pointer to the context that is initialized in
81 the EFI_DHCP6_PROTOCOL.InfoRequest().
82 @param Packet Pointer to Reply packet that has been received.
83 The EFI DHCPv6 Protocol instance is responsible
84 for freeing the buffer.
86 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
87 @retval EFI_DEVICE_ERROR Other errors as indicated.
88 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
93 IN EFI_DHCP6_PROTOCOL
*This
,
95 IN EFI_DHCP6_PACKET
*Packet
99 Parse the DHCP ACK to get Dns4 server information.
101 @param Instance The DNS instance.
102 @param DnsServerCount Retrieved Dns4 server Ip count.
103 @param DnsServerList Retrieved Dns4 server Ip list.
105 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.
106 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
107 @retval EFI_NO_MEDIA There was a media error.
108 @retval Others Other errors as indicated.
112 GetDns4ServerFromDhcp4 (
113 IN DNS_INSTANCE
*Instance
,
114 OUT UINT32
*DnsServerCount
,
115 OUT EFI_IPv4_ADDRESS
**DnsServerList
119 Parse the DHCP ACK to get Dns6 server information.
121 @param Image The handle of the driver image.
122 @param Controller The handle of the controller.
123 @param DnsServerCount Retrieved Dns6 server Ip count.
124 @param DnsServerList Retrieved Dns6 server Ip list.
126 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.
127 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
128 @retval EFI_NO_MEDIA There was a media error.
129 @retval Others Other errors as indicated.
133 GetDns6ServerFromDhcp6 (
135 IN EFI_HANDLE Controller
,
136 OUT UINT32
*DnsServerCount
,
137 OUT EFI_IPv6_ADDRESS
**DnsServerList