summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/DnsDxe/DnsDhcp.h
diff options
context:
space:
mode:
authorjiaxinwu <jiaxin.wu@intel.com>2015-07-07 08:22:03 +0000
committerjiaxinwu <jiaxinwu@Edk2>2015-07-07 08:22:03 +0000
commit99c048ef4aca44589d519946ee6a6c890ad9123b (patch)
treeda327aeb9a98a8e7e5ac1ceaf774efce2d76d4ec /NetworkPkg/DnsDxe/DnsDhcp.h
parent1f6729ffe98095107ce82e67a4a0209674601a90 (diff)
downloadedk2-99c048ef4aca44589d519946ee6a6c890ad9123b.tar.gz
edk2-99c048ef4aca44589d519946ee6a6c890ad9123b.tar.bz2
edk2-99c048ef4aca44589d519946ee6a6c890ad9123b.zip
NetworkPkg: Add DNS feature support over IPv4 and IPv6.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: jiaxinwu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17854 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/DnsDxe/DnsDhcp.h')
-rw-r--r--NetworkPkg/DnsDxe/DnsDhcp.h145
1 files changed, 145 insertions, 0 deletions
diff --git a/NetworkPkg/DnsDxe/DnsDhcp.h b/NetworkPkg/DnsDxe/DnsDhcp.h
new file mode 100644
index 0000000000..62bf7174e1
--- /dev/null
+++ b/NetworkPkg/DnsDxe/DnsDhcp.h
@@ -0,0 +1,145 @@
+/** @file
+Functions implementation related with DHCPv4/v6 for DNS driver.
+
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _DNS_DHCP_H_
+#define _DNS_DHCP_H_
+
+//
+// DHCP DNS related
+//
+#pragma pack(1)
+
+#define IP4_ETHER_PROTO 0x0800
+
+#define DHCP4_OPCODE_REQUEST 1
+#define DHCP4_MAGIC 0x63538263 /// network byte order
+#define DHCP4_TAG_EOP 255 /// End Option
+
+#define DHCP4_TAG_TYPE 53
+#define DHCP4_MSG_REQUEST 3
+#define DHCP4_MSG_INFORM 8
+
+#define DHCP4_TAG_PARA_LIST 55
+#define DHCP4_TAG_DNS_SERVER 6
+
+
+#define DHCP6_TAG_DNS_REQUEST 6
+#define DHCP6_TAG_DNS_SERVER 23
+
+//
+// The required Dns4 server information.
+//
+typedef struct {
+ UINT32 *ServerCount;
+ EFI_IPv4_ADDRESS *ServerList;
+} DNS4_SERVER_INFOR;
+
+//
+// The required Dns6 server information.
+//
+typedef struct {
+ UINT32 *ServerCount;
+ EFI_IPv6_ADDRESS *ServerList;
+} DNS6_SERVER_INFOR;
+
+#pragma pack()
+
+/**
+ Parse the ACK to get required information
+
+ @param Dhcp4 The DHCP4 protocol.
+ @param Packet Packet waiting for parse.
+ @param DnsServerInfor The required Dns4 server information.
+
+ @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
+ @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.
+ @retval EFI_DEVICE_ERROR Other errors as indicated.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+
+**/
+EFI_STATUS
+ParseDhcp4Ack (
+ IN EFI_DHCP4_PROTOCOL *Dhcp4,
+ IN EFI_DHCP4_PACKET *Packet,
+ IN DNS4_SERVER_INFOR *DnsServerInfor
+ );
+
+/**
+ EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol
+ instance to intercept events that occurs in the DHCPv6 Information Request
+ exchange process.
+
+ @param This Pointer to the EFI_DHCP6_PROTOCOL instance that
+ is used to configure this callback function.
+ @param Context Pointer to the context that is initialized in
+ the EFI_DHCP6_PROTOCOL.InfoRequest().
+ @param Packet Pointer to Reply packet that has been received.
+ The EFI DHCPv6 Protocol instance is responsible
+ for freeing the buffer.
+
+ @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.
+ @retval EFI_DEVICE_ERROR Other errors as indicated.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+ParseDhcp6Ack (
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN VOID *Context,
+ IN EFI_DHCP6_PACKET *Packet
+ );
+
+/**
+ Parse the DHCP ACK to get Dns4 server information.
+
+ @param Instance The DNS instance.
+ @param DnsServerCount Retrieved Dns4 server Ip count.
+ @param DnsServerList Retrieved Dns4 server Ip list.
+
+ @retval EFI_SUCCESS The Dns4 information is got from the DHCP ACK.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+ @retval EFI_NO_MEDIA There was a media error.
+ @retval Others Other errors as indicated.
+
+**/
+EFI_STATUS
+GetDns4ServerFromDhcp4 (
+ IN DNS_INSTANCE *Instance,
+ OUT UINT32 *DnsServerCount,
+ OUT EFI_IPv4_ADDRESS **DnsServerList
+ );
+
+/**
+ Parse the DHCP ACK to get Dns6 server information.
+
+ @param Image The handle of the driver image.
+ @param Controller The handle of the controller.
+ @param DnsServerCount Retrieved Dns6 server Ip count.
+ @param DnsServerList Retrieved Dns6 server Ip list.
+
+ @retval EFI_SUCCESS The Dns6 information is got from the DHCP ACK.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+ @retval EFI_NO_MEDIA There was a media error.
+ @retval Others Other errors as indicated.
+
+**/
+EFI_STATUS
+GetDns6ServerFromDhcp6 (
+ IN EFI_HANDLE Image,
+ IN EFI_HANDLE Controller,
+ OUT UINT32 *DnsServerCount,
+ OUT EFI_IPv6_ADDRESS **DnsServerList
+ );
+
+#endif \ No newline at end of file