]>
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, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #define IP4_ETHER_PROTO 0x0800
25 #define DHCP4_OPCODE_REQUEST 1
26 #define DHCP4_MAGIC 0x63538263 /// network byte order
27 #define DHCP4_TAG_EOP 255 /// End Option
29 #define DHCP4_TAG_TYPE 53
30 #define DHCP4_MSG_REQUEST 3
31 #define DHCP4_MSG_INFORM 8
33 #define DHCP4_TAG_PARA_LIST 55
34 #define DHCP4_TAG_DNS_SERVER 6
37 #define DHCP6_TAG_DNS_REQUEST 6
38 #define DHCP6_TAG_DNS_SERVER 23
40 #define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
43 // The required Dns4 server information.
47 EFI_IPv4_ADDRESS
*ServerList
;
51 // The required Dns6 server information.
55 EFI_IPv6_ADDRESS
*ServerList
;
61 Parse the ACK to get required information
63 @param Dhcp4 The DHCP4 protocol.
64 @param Packet Packet waiting for parse.
65 @param DnsServerInfor The required Dns4 server information.
67 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
68 @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
69 @retval EFI_DEVICE_ERROR Other errors as indicated.
70 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
75 IN EFI_DHCP4_PROTOCOL
*Dhcp4
,
76 IN EFI_DHCP4_PACKET
*Packet
,
77 IN DNS4_SERVER_INFOR
*DnsServerInfor
81 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol
82 instance to intercept events that occurs in the DHCPv6 Information Request
85 @param This Pointer to the EFI_DHCP6_PROTOCOL instance that
86 is used to configure this callback function.
87 @param Context Pointer to the context that is initialized in
88 the EFI_DHCP6_PROTOCOL.InfoRequest().
89 @param Packet Pointer to Reply packet that has been received.
90 The EFI DHCPv6 Protocol instance is responsible
91 for freeing the buffer.
93 @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
94 @retval EFI_DEVICE_ERROR Other errors as indicated.
95 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
100 IN EFI_DHCP6_PROTOCOL
*This
,
102 IN EFI_DHCP6_PACKET
*Packet
106 Parse the DHCP ACK to get Dns4 server information.
108 @param Instance The DNS instance.
109 @param DnsServerCount Retrieved Dns4 server Ip count.
110 @param DnsServerList Retrieved Dns4 server Ip list.
112 @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.
113 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
114 @retval EFI_NO_MEDIA There was a media error.
115 @retval Others Other errors as indicated.
119 GetDns4ServerFromDhcp4 (
120 IN DNS_INSTANCE
*Instance
,
121 OUT UINT32
*DnsServerCount
,
122 OUT EFI_IPv4_ADDRESS
**DnsServerList
126 Parse the DHCP ACK to get Dns6 server information.
128 @param Image The handle of the driver image.
129 @param Controller The handle of the controller.
130 @param DnsServerCount Retrieved Dns6 server Ip count.
131 @param DnsServerList Retrieved Dns6 server Ip list.
133 @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.
134 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
135 @retval EFI_NO_MEDIA There was a media error.
136 @retval Others Other errors as indicated.
140 GetDns6ServerFromDhcp6 (
142 IN EFI_HANDLE Controller
,
143 OUT UINT32
*DnsServerCount
,
144 OUT EFI_IPv6_ADDRESS
**DnsServerList