2 DnsDxe support functions implementation.
4 Copyright (c) 2015 - 2018, 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.
15 #ifndef __EFI_DNS_IMPL_H_
16 #define __EFI_DNS_IMPL_H_
23 #include <Library/BaseLib.h>
24 #include <Library/UefiLib.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/UefiRuntimeServicesTableLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/NetLib.h>
31 #include <Library/DebugLib.h>
32 #include <Library/DpcLib.h>
33 #include <Library/PrintLib.h>
34 #include <Library/UdpIoLib.h>
37 // UEFI Driver Model Protocols
39 #include <Protocol/DriverBinding.h>
40 #include <Protocol/ComponentName2.h>
41 #include <Protocol/ComponentName.h>
43 #include <Protocol/Udp4.h>
44 #include <Protocol/Dhcp4.h>
45 #include <Protocol/Dns4.h>
47 #include <Protocol/Udp6.h>
48 #include <Protocol/Dhcp6.h>
49 #include <Protocol/Dns6.h>
51 #include <Protocol/Ip4Config2.h>
53 #include "DnsDriver.h"
59 #define DNS_VERSION 0x00000000
64 extern EFI_COMPONENT_NAME_PROTOCOL gDnsComponentName
;
65 extern EFI_COMPONENT_NAME2_PROTOCOL gDnsComponentName2
;
66 extern EFI_UNICODE_STRING_TABLE
*gDnsControllerNameTable
;
68 extern EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding
;
69 extern EFI_SERVICE_BINDING_PROTOCOL mDns4ServiceBinding
;
70 extern EFI_DNS4_PROTOCOL mDns4Protocol
;
72 extern EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding
;
73 extern EFI_SERVICE_BINDING_PROTOCOL mDns6ServiceBinding
;
74 extern EFI_DNS6_PROTOCOL mDns6Protocol
;
79 #define DNS_SERVER_PORT 53
81 #define DNS_PROTOCOL_UDP EFI_IP_PROTO_UDP
82 #define DNS_PROTOCOL_TCP EFI_IP_PROTO_TCP
84 #define DNS_STATE_UNCONFIGED 0
85 #define DNS_STATE_CONFIGED 1
86 #define DNS_STATE_DESTROY 2
88 #define DNS_DEFAULT_TIMEOUT 2
90 #define DNS_TIME_TO_GETMAP 5
94 typedef union _DNS_FLAGS DNS_FLAGS
;
97 LIST_ENTRY AllCacheLink
;
98 EFI_DNS4_CACHE_ENTRY DnsCache
;
102 LIST_ENTRY AllCacheLink
;
103 EFI_DNS6_CACHE_ENTRY DnsCache
;
107 LIST_ENTRY AllServerLink
;
108 EFI_IPv4_ADDRESS Dns4ServerIp
;
112 LIST_ENTRY AllServerLink
;
113 EFI_IPv6_ADDRESS Dns6ServerIp
;
117 UINT32 RetryCounting
;
119 CHAR16
*QueryHostName
;
120 EFI_IPv4_ADDRESS QueryIpAddress
;
121 BOOLEAN GeneralLookUp
;
122 EFI_DNS4_COMPLETION_TOKEN
*Token
;
126 UINT32 RetryCounting
;
128 CHAR16
*QueryHostName
;
129 EFI_IPv6_ADDRESS QueryIpAddress
;
130 BOOLEAN GeneralLookUp
;
131 EFI_DNS6_COMPLETION_TOKEN
*Token
;
148 #define DNS_FLAGS_QR_QUERY 0
149 #define DNS_FLAGS_QR_RESPONSE 1
151 #define DNS_FLAGS_OPCODE_STANDARD 0
152 #define DNS_FLAGS_OPCODE_INVERSE 1
153 #define DNS_FLAGS_OPCODE_SERVER_STATE 2
155 #define DNS_FLAGS_RCODE_NO_ERROR 0
156 #define DNS_FLAGS_RCODE_NAME_ERROR 3
159 UINT16 Identification
;
177 } DNS_ANSWER_SECTION
;
179 #define DNS4_DOMAIN L"in-addr.arpa"
180 #define DNS6_DOMAIN L"IP6.ARPA"
186 Remove TokenEntry from TokenMap.
188 @param[in] TokenMap All DNSv4 Token entrys.
189 @param[in] TokenEntry TokenEntry need to be removed.
191 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
192 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
196 Dns4RemoveTokenEntry (
197 IN NET_MAP
*TokenMap
,
198 IN DNS4_TOKEN_ENTRY
*TokenEntry
202 Remove TokenEntry from TokenMap.
204 @param[in] TokenMap All DNSv6 Token entrys.
205 @param[in] TokenEntry TokenEntry need to be removed.
207 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
208 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
212 Dns6RemoveTokenEntry (
213 IN NET_MAP
*TokenMap
,
214 IN DNS6_TOKEN_ENTRY
*TokenEntry
218 This function cancle the token specified by Arg in the Map.
220 @param[in] Map Pointer to the NET_MAP.
221 @param[in] Item Pointer to the NET_MAP_ITEM.
222 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
223 the tokens in this Map will be cancelled.
224 This parameter is optional and may be NULL.
226 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
227 is not the same as that in the Item, if Arg is not
229 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
237 IN NET_MAP_ITEM
*Item
,
238 IN VOID
*Arg OPTIONAL
242 This function cancle the token specified by Arg in the Map.
244 @param[in] Map Pointer to the NET_MAP.
245 @param[in] Item Pointer to the NET_MAP_ITEM.
246 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
247 the tokens in this Map will be cancelled.
248 This parameter is optional and may be NULL.
250 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
251 is not the same as that in the Item, if Arg is not
253 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
261 IN NET_MAP_ITEM
*Item
,
262 IN VOID
*Arg OPTIONAL
266 Get the TokenEntry from the TokensMap.
268 @param[in] TokensMap All DNSv4 Token entrys
269 @param[in] Token Pointer to the token to be get.
270 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
272 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
273 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
279 IN NET_MAP
*TokensMap
,
280 IN EFI_DNS4_COMPLETION_TOKEN
*Token
,
281 OUT DNS4_TOKEN_ENTRY
**TokenEntry
285 Get the TokenEntry from the TokensMap.
287 @param[in] TokensMap All DNSv6 Token entrys
288 @param[in] Token Pointer to the token to be get.
289 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
291 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
292 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
298 IN NET_MAP
*TokensMap
,
299 IN EFI_DNS6_COMPLETION_TOKEN
*Token
,
300 OUT DNS6_TOKEN_ENTRY
**TokenEntry
304 Cancel DNS4 tokens from the DNS4 instance.
306 @param[in] Instance Pointer to the DNS instance context data.
307 @param[in] Token Pointer to the token to be canceled. If NULL, all
308 tokens in this instance will be cancelled.
309 This parameter is optional and may be NULL.
311 @retval EFI_SUCCESS The Token is cancelled.
312 @retval EFI_NOT_FOUND The Token is not found.
316 Dns4InstanceCancelToken (
317 IN DNS_INSTANCE
*Instance
,
318 IN EFI_DNS4_COMPLETION_TOKEN
*Token
322 Cancel DNS6 tokens from the DNS6 instance.
324 @param[in] Instance Pointer to the DNS instance context data.
325 @param[in] Token Pointer to the token to be canceled. If NULL, all
326 tokens in this instance will be cancelled.
327 This parameter is optional and may be NULL.
329 @retval EFI_SUCCESS The Token is cancelled.
330 @retval EFI_NOT_FOUND The Token is not found.
334 Dns6InstanceCancelToken (
335 IN DNS_INSTANCE
*Instance
,
336 IN EFI_DNS6_COMPLETION_TOKEN
*Token
340 Free the resource related to the configure parameters.
342 @param Config The DNS configure data
347 IN OUT EFI_DNS4_CONFIG_DATA
*Config
351 Free the resource related to the configure parameters.
353 @param Config The DNS configure data
358 IN OUT EFI_DNS6_CONFIG_DATA
*Config
362 Allocate memory for configure parameter such as timeout value for Dst,
363 then copy the configure parameter from Src to Dst.
365 @param[out] Dst The destination DHCP configure data.
366 @param[in] Src The source DHCP configure data.
368 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
369 @retval EFI_SUCCESS The configure is copied.
374 OUT EFI_DNS4_CONFIG_DATA
*Dst
,
375 IN EFI_DNS4_CONFIG_DATA
*Src
379 Allocate memory for configure parameter such as timeout value for Dst,
380 then copy the configure parameter from Src to Dst.
382 @param[out] Dst The destination DHCP configure data.
383 @param[in] Src The source DHCP configure data.
385 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
386 @retval EFI_SUCCESS The configure is copied.
391 OUT EFI_DNS6_CONFIG_DATA
*Dst
,
392 IN EFI_DNS6_CONFIG_DATA
*Src
396 Callback of Dns packet. Does nothing.
398 @param Arg The context.
408 Poll the UDP to get the IP4 default address, which may be retrieved
411 The default time out value is 5 seconds. If IP has retrieved the default address,
412 the UDP is reconfigured.
414 @param Instance The DNS instance
415 @param UdpIo The UDP_IO to poll
416 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
418 @retval TRUE The default address is retrieved and UDP is reconfigured.
419 @retval FALSE Some error occured.
424 IN DNS_INSTANCE
*Instance
,
426 IN EFI_UDP4_CONFIG_DATA
*UdpCfgData
430 Configure the opened Udp6 instance until the corresponding Ip6 instance
433 @param Instance The DNS instance
434 @param UdpIo The UDP_IO to poll
435 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
437 @retval TRUE Configure the Udp6 instance successfully.
438 @retval FALSE Some error occured.
443 IN DNS_INSTANCE
*Instance
,
445 IN EFI_UDP6_CONFIG_DATA
*UdpCfgData
451 @param Instance The DNS session
452 @param UdpIo The UDP_IO instance
454 @retval EFI_SUCCESS The UDP is successfully configured for the
460 IN DNS_INSTANCE
*Instance
,
467 @param Instance The DNS session
468 @param UdpIo The UDP_IO instance
470 @retval EFI_SUCCESS The UDP is successfully configured for the
476 IN DNS_INSTANCE
*Instance
,
481 Update Dns4 cache to shared list of caches of all DNSv4 instances.
483 @param Dns4CacheList All Dns4 cache list.
484 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
485 If TRUE, this function will delete matching DNS Cache entry.
486 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
487 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
488 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
490 @retval EFI_SUCCESS Update Dns4 cache successfully.
491 @retval Others Failed to update Dns4 cache.
497 IN LIST_ENTRY
*Dns4CacheList
,
498 IN BOOLEAN DeleteFlag
,
500 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
504 Update Dns6 cache to shared list of caches of all DNSv6 instances.
506 @param Dns6CacheList All Dns6 cache list.
507 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
508 If TRUE, this function will delete matching DNS Cache entry.
509 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
510 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
511 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
513 @retval EFI_SUCCESS Update Dns6 cache successfully.
514 @retval Others Failed to update Dns6 cache.
519 IN LIST_ENTRY
*Dns6CacheList
,
520 IN BOOLEAN DeleteFlag
,
522 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
526 Add Dns4 ServerIp to common list of addresses of all configured DNSv4 server.
528 @param Dns4ServerList Common list of addresses of all configured DNSv4 server.
529 @param ServerIp DNS server Ip.
531 @retval EFI_SUCCESS Add Dns4 ServerIp to common list successfully.
532 @retval Others Failed to add Dns4 ServerIp to common list.
538 IN LIST_ENTRY
*Dns4ServerList
,
539 IN EFI_IPv4_ADDRESS ServerIp
543 Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server.
545 @param Dns6ServerList Common list of addresses of all configured DNSv6 server.
546 @param ServerIp DNS server Ip.
548 @retval EFI_SUCCESS Add Dns6 ServerIp to common list successfully.
549 @retval Others Failed to add Dns6 ServerIp to common list.
555 IN LIST_ENTRY
*Dns6ServerList
,
556 IN EFI_IPv6_ADDRESS ServerIp
560 Find out whether the response is valid or invalid.
562 @param TokensMap All DNS transmittal Tokens entry.
563 @param Identification Identification for queried packet.
564 @param Type Type for queried packet.
565 @param Class Class for queried packet.
566 @param Item Return corresponding Token entry.
568 @retval TRUE The response is valid.
569 @retval FALSE The response is invalid.
574 IN NET_MAP
*TokensMap
,
575 IN UINT16 Identification
,
578 OUT NET_MAP_ITEM
**Item
584 @param Instance The DNS instance
585 @param RxString Received buffer.
586 @param Length Received buffer length.
587 @param Completed Flag to indicate that Dns response is valid.
589 @retval EFI_SUCCESS Parse Dns Response successfully.
590 @retval Others Failed to parse Dns Response.
595 IN OUT DNS_INSTANCE
*Instance
,
598 OUT BOOLEAN
*Completed
602 Parse response packet.
604 @param Packet The packets received.
605 @param EndPoint The local/remote UDP access point
606 @param IoStatus The status of the UDP receive
607 @param Context The opaque parameter to the function.
612 DnsOnPacketReceived (
614 UDP_END_POINT
*EndPoint
,
620 Release the net buffer when packet is sent.
622 @param Packet The packets received.
623 @param EndPoint The local/remote UDP access point
624 @param IoStatus The status of the UDP receive
625 @param Context The opaque parameter to the function.
632 UDP_END_POINT
*EndPoint
,
638 Query request information.
640 @param Instance The DNS instance
641 @param Packet The packet for querying request information.
643 @retval EFI_SUCCESS Query request information successfully.
644 @retval Others Failed to query request information.
649 IN DNS_INSTANCE
*Instance
,
654 Construct the Packet according query section.
656 @param Instance The DNS instance
657 @param QueryName Queried Name
658 @param Type Queried Type
659 @param Class Queried Class
660 @param Packet The packet for query
662 @retval EFI_SUCCESS The packet is constructed.
663 @retval Others Failed to construct the Packet.
668 IN DNS_INSTANCE
*Instance
,
676 Retransmit the packet.
678 @param Instance The DNS instance
679 @param Packet Retransmit the packet
681 @retval EFI_SUCCESS The packet is retransmitted.
682 @retval Others Failed to retransmit.
687 IN DNS_INSTANCE
*Instance
,
692 The timer ticking function for the DNS service.
694 @param Event The ticking event
695 @param Context The DNS service instance
700 DnsOnTimerRetransmit (
706 The timer ticking function for the DNS driver.
708 @param Event The ticking event
721 Retrieve mode data of this DNS instance.
723 This function is used to retrieve DNS mode data for this DNS instance.
725 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
726 @param[out] DnsModeData Point to the mode data.
728 @retval EFI_SUCCESS The operation completed successfully.
729 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
730 is available because this instance has not been
732 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
733 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
738 IN EFI_DNS4_PROTOCOL
*This
,
739 OUT EFI_DNS4_MODE_DATA
*DnsModeData
743 Configure this DNS instance.
745 This function is used to configure DNS mode data for this DNS instance.
747 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
748 @param[in] DnsConfigData Point to the Configuration data.
750 @retval EFI_SUCCESS The operation completed successfully.
751 @retval EFI_UNSUPPORTED The designated protocol is not supported.
752 @retval EFI_INVALID_PARAMTER Thisis NULL.
753 The StationIp address provided in DnsConfigData is not a
755 DnsServerList is NULL while DnsServerListCount
757 DnsServerListCount is ZERO while DnsServerList
759 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
761 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
762 EFI DNSv4 Protocol instance is not configured.
763 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
764 reconfigure the instance the caller must call Configure()
765 with NULL first to return driver to unconfigured state.
770 IN EFI_DNS4_PROTOCOL
*This
,
771 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
775 Host name to host address translation.
777 The HostNameToIp () function is used to translate the host name to host IP address. A
778 type A query is used to get the one or more IP addresses for this host.
780 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
781 @param[in] HostName Host name.
782 @param[in] Token Point to the completion token to translate host name
785 @retval EFI_SUCCESS The operation completed successfully.
786 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
790 HostName is NULL. HostName string is unsupported format.
791 @retval EFI_NO_MAPPING There's no source address is available for use.
792 @retval EFI_NOT_STARTED This instance has not been started.
797 IN EFI_DNS4_PROTOCOL
*This
,
799 IN EFI_DNS4_COMPLETION_TOKEN
*Token
803 IPv4 address to host name translation also known as Reverse DNS lookup.
805 The IpToHostName() function is used to translate the host address to host name. A type PTR
806 query is used to get the primary name of the host. Support of this function is optional.
808 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
809 @param[in] IpAddress Ip Address.
810 @param[in] Token Point to the completion token to translate host
811 address to host name.
813 @retval EFI_SUCCESS The operation completed successfully.
814 @retval EFI_UNSUPPORTED This function is not supported.
815 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
819 IpAddress is not valid IP address .
820 @retval EFI_NO_MAPPING There's no source address is available for use.
821 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
822 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
827 IN EFI_DNS4_PROTOCOL
*This
,
828 IN EFI_IPv4_ADDRESS IpAddress
,
829 IN EFI_DNS4_COMPLETION_TOKEN
*Token
833 Retrieve arbitrary information from the DNS server.
835 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
836 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
837 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
838 required information. The function is optional.
840 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
841 @param[in] QName Pointer to Query Name.
842 @param[in] QType Query Type.
843 @param[in] QClass Query Name.
844 @param[in] Token Point to the completion token to retrieve arbitrary
847 @retval EFI_SUCCESS The operation completed successfully.
848 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
849 QType is not supported
850 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
855 @retval EFI_NO_MAPPING There's no source address is available for use.
856 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
857 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
862 IN EFI_DNS4_PROTOCOL
*This
,
866 IN EFI_DNS4_COMPLETION_TOKEN
*Token
870 This function is to update the DNS Cache.
872 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
873 can be normally dynamically updated after the DNS resolve succeeds. This function
874 provided capability to manually add/delete/modify the DNS cache.
876 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
877 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
878 DNS Cahce. If TRUE, this function will delete
879 matching DNS Cache entry.
880 @param[in] Override If TRUE, the maching DNS cache entry will be
881 overwritten with the supplied parameter. If FALSE,
882 EFI_ACCESS_DENIED will be returned if the entry to
883 be added is already existed.
884 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
886 @retval EFI_SUCCESS The operation completed successfully.
887 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
889 DnsCacheEntry.HostName is NULL.
890 DnsCacheEntry.IpAddress is NULL.
891 DnsCacheEntry.Timeout is zero.
892 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
898 IN EFI_DNS4_PROTOCOL
*This
,
899 IN BOOLEAN DeleteFlag
,
901 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
905 Polls for incoming data packets and processes outgoing data packets.
907 The Poll() function can be used by network drivers and applications to increase the
908 rate that data packets are moved between the communications device and the transmit
910 In some systems, the periodic timer event in the managed network driver may not poll
911 the underlying communications device fast enough to transmit and/or receive all data
912 packets without missing incoming packets or dropping outgoing packets. Drivers and
913 applications that are experiencing packet loss should try calling the Poll()
916 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
918 @retval EFI_SUCCESS Incoming or outgoing data was processed.
919 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
920 @retval EFI_INVALID_PARAMETER This is NULL.
921 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
922 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
923 queue. Consider increasing the polling rate.
928 IN EFI_DNS4_PROTOCOL
*This
932 Abort an asynchronous DNS operation, including translation between IP and Host, and
933 general look up behavior.
935 The Cancel() function is used to abort a pending resolution request. After calling
936 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
937 signaled. If the token is not in one of the queues, which usually means that the
938 asynchronous operation has completed, this function will not signal the token and
939 EFI_NOT_FOUND is returned.
941 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
942 @param[in] Token Pointer to a token that has been issued by
943 EFI_DNS4_PROTOCOL.HostNameToIp (),
944 EFI_DNS4_PROTOCOL.IpToHostName() or
945 EFI_DNS4_PROTOCOL.GeneralLookup().
946 If NULL, all pending tokens are aborted.
948 @retval EFI_SUCCESS Incoming or outgoing data was processed.
949 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
950 @retval EFI_INVALID_PARAMETER This is NULL.
951 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
952 operation was not found in the transmit queue. It
953 was either completed or was not issued by
954 HostNameToIp(), IpToHostName() or GeneralLookup().
959 IN EFI_DNS4_PROTOCOL
*This
,
960 IN EFI_DNS4_COMPLETION_TOKEN
*Token
965 Retrieve mode data of this DNS instance.
967 This function is used to retrieve DNS mode data for this DNS instance.
969 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
970 @param[out] DnsModeData Pointer to the caller-allocated storage for the
971 EFI_DNS6_MODE_DATA data.
973 @retval EFI_SUCCESS The operation completed successfully.
974 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
975 is available because this instance has not been
977 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
978 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
983 IN EFI_DNS6_PROTOCOL
*This
,
984 OUT EFI_DNS6_MODE_DATA
*DnsModeData
988 Configure this DNS instance.
990 The Configure() function is used to set and change the configuration data for this
991 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
993 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
994 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
995 storage to be allocated and released by caller.
997 @retval EFI_SUCCESS The operation completed successfully.
998 @retval EFI_INVALID_PARAMTER This is NULL.
999 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
1000 DnsServerList is NULL while DnsServerList Count is not ZERO.
1001 DnsServerList Count is ZERO while DnsServerList is not NULL.
1002 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
1003 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
1004 EFI DNSv6 Protocol instance is not configured.
1005 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1006 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1007 reconfigure the instance the caller must call Configure() with
1008 NULL first to return driver to unconfigured state.
1013 IN EFI_DNS6_PROTOCOL
*This
,
1014 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1018 Host name to host address translation.
1020 The HostNameToIp () function is used to translate the host name to host IP address. A
1021 type AAAA query is used to get the one or more IPv6 addresses for this host.
1023 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1024 @param[in] HostName Host name.
1025 @param[in] Token Point to the completion token to translate host name
1028 @retval EFI_SUCCESS The operation completed successfully.
1029 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1032 Token.Event is NULL.
1033 HostName is NULL or buffer contained unsupported characters.
1034 @retval EFI_NO_MAPPING There's no source address is available for use.
1035 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1036 @retval EFI_NOT_STARTED This instance has not been started.
1037 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1042 IN EFI_DNS6_PROTOCOL
*This
,
1043 IN CHAR16
*HostName
,
1044 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1048 Host address to host name translation.
1050 The IpToHostName () function is used to translate the host address to host name. A
1051 type PTR query is used to get the primary name of the host. Implementation can choose
1052 to support this function or not.
1054 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1055 @param[in] IpAddress Ip Address.
1056 @param[in] Token Point to the completion token to translate host
1057 address to host name.
1059 @retval EFI_SUCCESS The operation completed successfully.
1060 @retval EFI_UNSUPPORTED This function is not supported.
1061 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1064 Token.Event is NULL.
1065 IpAddress is not valid IP address.
1066 @retval EFI_NO_MAPPING There's no source address is available for use.
1067 @retval EFI_NOT_STARTED This instance has not been started.
1068 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1073 IN EFI_DNS6_PROTOCOL
*This
,
1074 IN EFI_IPv6_ADDRESS IpAddress
,
1075 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1079 This function provides capability to retrieve arbitrary information from the DNS
1082 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1083 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1084 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1085 required information. The function is optional. Implementation can choose to support
1088 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1089 @param[in] QName Pointer to Query Name.
1090 @param[in] QType Query Type.
1091 @param[in] QClass Query Name.
1092 @param[in] Token Point to the completion token to retrieve arbitrary
1095 @retval EFI_SUCCESS The operation completed successfully.
1096 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1097 QType is not supported
1098 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1101 Token.Event is NULL.
1103 @retval EFI_NO_MAPPING There's no source address is available for use.
1104 @retval EFI_NOT_STARTED This instance has not been started.
1105 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1110 IN EFI_DNS6_PROTOCOL
*This
,
1114 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1118 This function is to update the DNS Cache.
1120 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1121 can be normally dynamically updated after the DNS resolve succeeds. This function
1122 provided capability to manually add/delete/modify the DNS cache.
1124 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1125 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1126 DNS Cahce. If TRUE, this function will delete
1127 matching DNS Cache entry.
1128 @param[in] Override If TRUE, the maching DNS cache entry will be
1129 overwritten with the supplied parameter. If FALSE,
1130 EFI_ACCESS_DENIED will be returned if the entry to
1131 be added is already existed.
1132 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1134 @retval EFI_SUCCESS The operation completed successfully.
1135 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1137 DnsCacheEntry.HostName is NULL.
1138 DnsCacheEntry.IpAddress is NULL.
1139 DnsCacheEntry.Timeout is zero.
1140 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1142 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1146 Dns6UpdateDnsCache (
1147 IN EFI_DNS6_PROTOCOL
*This
,
1148 IN BOOLEAN DeleteFlag
,
1149 IN BOOLEAN Override
,
1150 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1154 Polls for incoming data packets and processes outgoing data packets.
1156 The Poll() function can be used by network drivers and applications to increase the
1157 rate that data packets are moved between the communications device and the transmit
1160 In some systems, the periodic timer event in the managed network driver may not poll
1161 the underlying communications device fast enough to transmit and/or receive all data
1162 packets without missing incoming packets or dropping outgoing packets. Drivers and
1163 applications that are experiencing packet loss should try calling the Poll()
1164 function more often.
1166 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1168 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1169 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1170 @retval EFI_INVALID_PARAMETER This is NULL.
1171 @retval EFI_NO_MAPPING There is no source address is available for use.
1172 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1173 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1174 queue. Consider increasing the polling rate.
1179 IN EFI_DNS6_PROTOCOL
*This
1183 Abort an asynchronous DNS operation, including translation between IP and Host, and
1184 general look up behavior.
1186 The Cancel() function is used to abort a pending resolution request. After calling
1187 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1188 signaled. If the token is not in one of the queues, which usually means that the
1189 asynchronous operation has completed, this function will not signal the token and
1190 EFI_NOT_FOUND is returned.
1192 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1193 @param[in] Token Pointer to a token that has been issued by
1194 EFI_DNS6_PROTOCOL.HostNameToIp (),
1195 EFI_DNS6_PROTOCOL.IpToHostName() or
1196 EFI_DNS6_PROTOCOL.GeneralLookup().
1197 If NULL, all pending tokens are aborted.
1199 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1200 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1201 @retval EFI_INVALID_PARAMETER This is NULL.
1202 @retval EFI_NO_MAPPING There's no source address is available for use.
1203 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1204 operation was not found in the transmit queue. It
1205 was either completed or was not issued by
1206 HostNameToIp(), IpToHostName() or GeneralLookup().
1211 IN EFI_DNS6_PROTOCOL
*This
,
1212 IN EFI_DNS6_COMPLETION_TOKEN
*Token