2 DnsDxe support functions implementation.
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __EFI_DNS_IMPL_H_
10 #define __EFI_DNS_IMPL_H_
17 #include <Library/BaseLib.h>
18 #include <Library/UefiLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/UefiDriverEntryPoint.h>
21 #include <Library/UefiRuntimeServicesTableLib.h>
22 #include <Library/BaseMemoryLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/NetLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/DpcLib.h>
27 #include <Library/PrintLib.h>
28 #include <Library/UdpIoLib.h>
31 // UEFI Driver Model Protocols
33 #include <Protocol/DriverBinding.h>
34 #include <Protocol/ComponentName2.h>
35 #include <Protocol/ComponentName.h>
37 #include <Protocol/Udp4.h>
38 #include <Protocol/Dhcp4.h>
39 #include <Protocol/Dns4.h>
41 #include <Protocol/Udp6.h>
42 #include <Protocol/Dhcp6.h>
43 #include <Protocol/Dns6.h>
45 #include <Protocol/Ip4Config2.h>
47 #include "DnsDriver.h"
53 #define DNS_VERSION 0x00000000
58 extern EFI_COMPONENT_NAME_PROTOCOL gDnsComponentName
;
59 extern EFI_COMPONENT_NAME2_PROTOCOL gDnsComponentName2
;
60 extern EFI_UNICODE_STRING_TABLE
*gDnsControllerNameTable
;
62 extern EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding
;
63 extern EFI_SERVICE_BINDING_PROTOCOL mDns4ServiceBinding
;
64 extern EFI_DNS4_PROTOCOL mDns4Protocol
;
66 extern EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding
;
67 extern EFI_SERVICE_BINDING_PROTOCOL mDns6ServiceBinding
;
68 extern EFI_DNS6_PROTOCOL mDns6Protocol
;
73 #define DNS_SERVER_PORT 53
75 #define DNS_PROTOCOL_UDP EFI_IP_PROTO_UDP
76 #define DNS_PROTOCOL_TCP EFI_IP_PROTO_TCP
78 #define DNS_STATE_UNCONFIGED 0
79 #define DNS_STATE_CONFIGED 1
80 #define DNS_STATE_DESTROY 2
82 #define DNS_DEFAULT_TIMEOUT 2
84 #define DNS_TIME_TO_GETMAP 5
88 typedef union _DNS_FLAGS DNS_FLAGS
;
91 LIST_ENTRY AllCacheLink
;
92 EFI_DNS4_CACHE_ENTRY DnsCache
;
96 LIST_ENTRY AllCacheLink
;
97 EFI_DNS6_CACHE_ENTRY DnsCache
;
101 LIST_ENTRY AllServerLink
;
102 EFI_IPv4_ADDRESS Dns4ServerIp
;
106 LIST_ENTRY AllServerLink
;
107 EFI_IPv6_ADDRESS Dns6ServerIp
;
111 UINT32 RetryCounting
;
113 CHAR16
*QueryHostName
;
114 EFI_IPv4_ADDRESS QueryIpAddress
;
115 BOOLEAN GeneralLookUp
;
116 EFI_DNS4_COMPLETION_TOKEN
*Token
;
120 UINT32 RetryCounting
;
122 CHAR16
*QueryHostName
;
123 EFI_IPv6_ADDRESS QueryIpAddress
;
124 BOOLEAN GeneralLookUp
;
125 EFI_DNS6_COMPLETION_TOKEN
*Token
;
142 #define DNS_FLAGS_QR_QUERY 0
143 #define DNS_FLAGS_QR_RESPONSE 1
145 #define DNS_FLAGS_OPCODE_STANDARD 0
146 #define DNS_FLAGS_OPCODE_INVERSE 1
147 #define DNS_FLAGS_OPCODE_SERVER_STATE 2
149 #define DNS_FLAGS_RCODE_NO_ERROR 0
150 #define DNS_FLAGS_RCODE_NAME_ERROR 3
153 UINT16 Identification
;
171 } DNS_ANSWER_SECTION
;
173 #define DNS4_DOMAIN L"in-addr.arpa"
174 #define DNS6_DOMAIN L"IP6.ARPA"
180 Remove TokenEntry from TokenMap.
182 @param[in] TokenMap All DNSv4 Token entrys.
183 @param[in] TokenEntry TokenEntry need to be removed.
185 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
186 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
190 Dns4RemoveTokenEntry (
191 IN NET_MAP
*TokenMap
,
192 IN DNS4_TOKEN_ENTRY
*TokenEntry
196 Remove TokenEntry from TokenMap.
198 @param[in] TokenMap All DNSv6 Token entrys.
199 @param[in] TokenEntry TokenEntry need to be removed.
201 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
202 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
206 Dns6RemoveTokenEntry (
207 IN NET_MAP
*TokenMap
,
208 IN DNS6_TOKEN_ENTRY
*TokenEntry
212 This function cancle the token specified by Arg in the Map.
214 @param[in] Map Pointer to the NET_MAP.
215 @param[in] Item Pointer to the NET_MAP_ITEM.
216 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
217 the tokens in this Map will be cancelled.
218 This parameter is optional and may be NULL.
220 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
221 is not the same as that in the Item, if Arg is not
223 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
231 IN NET_MAP_ITEM
*Item
,
232 IN VOID
*Arg OPTIONAL
236 This function cancle the token specified by Arg in the Map.
238 @param[in] Map Pointer to the NET_MAP.
239 @param[in] Item Pointer to the NET_MAP_ITEM.
240 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
241 the tokens in this Map will be cancelled.
242 This parameter is optional and may be NULL.
244 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
245 is not the same as that in the Item, if Arg is not
247 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
255 IN NET_MAP_ITEM
*Item
,
256 IN VOID
*Arg OPTIONAL
260 Get the TokenEntry from the TokensMap.
262 @param[in] TokensMap All DNSv4 Token entrys
263 @param[in] Token Pointer to the token to be get.
264 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
266 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
267 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
273 IN NET_MAP
*TokensMap
,
274 IN EFI_DNS4_COMPLETION_TOKEN
*Token
,
275 OUT DNS4_TOKEN_ENTRY
**TokenEntry
279 Get the TokenEntry from the TokensMap.
281 @param[in] TokensMap All DNSv6 Token entrys
282 @param[in] Token Pointer to the token to be get.
283 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
285 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
286 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
292 IN NET_MAP
*TokensMap
,
293 IN EFI_DNS6_COMPLETION_TOKEN
*Token
,
294 OUT DNS6_TOKEN_ENTRY
**TokenEntry
298 Cancel DNS4 tokens from the DNS4 instance.
300 @param[in] Instance Pointer to the DNS instance context data.
301 @param[in] Token Pointer to the token to be canceled. If NULL, all
302 tokens in this instance will be cancelled.
303 This parameter is optional and may be NULL.
305 @retval EFI_SUCCESS The Token is cancelled.
306 @retval EFI_NOT_FOUND The Token is not found.
310 Dns4InstanceCancelToken (
311 IN DNS_INSTANCE
*Instance
,
312 IN EFI_DNS4_COMPLETION_TOKEN
*Token
316 Cancel DNS6 tokens from the DNS6 instance.
318 @param[in] Instance Pointer to the DNS instance context data.
319 @param[in] Token Pointer to the token to be canceled. If NULL, all
320 tokens in this instance will be cancelled.
321 This parameter is optional and may be NULL.
323 @retval EFI_SUCCESS The Token is cancelled.
324 @retval EFI_NOT_FOUND The Token is not found.
328 Dns6InstanceCancelToken (
329 IN DNS_INSTANCE
*Instance
,
330 IN EFI_DNS6_COMPLETION_TOKEN
*Token
334 Free the resource related to the configure parameters.
336 @param Config The DNS configure data
341 IN OUT EFI_DNS4_CONFIG_DATA
*Config
345 Free the resource related to the configure parameters.
347 @param Config The DNS configure data
352 IN OUT EFI_DNS6_CONFIG_DATA
*Config
356 Allocate memory for configure parameter such as timeout value for Dst,
357 then copy the configure parameter from Src to Dst.
359 @param[out] Dst The destination DHCP configure data.
360 @param[in] Src The source DHCP configure data.
362 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
363 @retval EFI_SUCCESS The configure is copied.
368 OUT EFI_DNS4_CONFIG_DATA
*Dst
,
369 IN EFI_DNS4_CONFIG_DATA
*Src
373 Allocate memory for configure parameter such as timeout value for Dst,
374 then copy the configure parameter from Src to Dst.
376 @param[out] Dst The destination DHCP configure data.
377 @param[in] Src The source DHCP configure data.
379 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
380 @retval EFI_SUCCESS The configure is copied.
385 OUT EFI_DNS6_CONFIG_DATA
*Dst
,
386 IN EFI_DNS6_CONFIG_DATA
*Src
390 Callback of Dns packet. Does nothing.
392 @param Arg The context.
402 Poll the UDP to get the IP4 default address, which may be retrieved
405 The default time out value is 5 seconds. If IP has retrieved the default address,
406 the UDP is reconfigured.
408 @param Instance The DNS instance
409 @param UdpIo The UDP_IO to poll
410 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
412 @retval TRUE The default address is retrieved and UDP is reconfigured.
413 @retval FALSE Some error occured.
418 IN DNS_INSTANCE
*Instance
,
420 IN EFI_UDP4_CONFIG_DATA
*UdpCfgData
424 Configure the opened Udp6 instance until the corresponding Ip6 instance
427 @param Instance The DNS instance
428 @param UdpIo The UDP_IO to poll
429 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
431 @retval TRUE Configure the Udp6 instance successfully.
432 @retval FALSE Some error occured.
437 IN DNS_INSTANCE
*Instance
,
439 IN EFI_UDP6_CONFIG_DATA
*UdpCfgData
445 @param Instance The DNS session
446 @param UdpIo The UDP_IO instance
448 @retval EFI_SUCCESS The UDP is successfully configured for the
454 IN DNS_INSTANCE
*Instance
,
461 @param Instance The DNS session
462 @param UdpIo The UDP_IO instance
464 @retval EFI_SUCCESS The UDP is successfully configured for the
470 IN DNS_INSTANCE
*Instance
,
475 Update Dns4 cache to shared list of caches of all DNSv4 instances.
477 @param Dns4CacheList All Dns4 cache list.
478 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
479 If TRUE, this function will delete matching DNS Cache entry.
480 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
481 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
482 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
484 @retval EFI_SUCCESS Update Dns4 cache successfully.
485 @retval Others Failed to update Dns4 cache.
491 IN LIST_ENTRY
*Dns4CacheList
,
492 IN BOOLEAN DeleteFlag
,
494 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
498 Update Dns6 cache to shared list of caches of all DNSv6 instances.
500 @param Dns6CacheList All Dns6 cache list.
501 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
502 If TRUE, this function will delete matching DNS Cache entry.
503 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
504 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
505 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
507 @retval EFI_SUCCESS Update Dns6 cache successfully.
508 @retval Others Failed to update Dns6 cache.
513 IN LIST_ENTRY
*Dns6CacheList
,
514 IN BOOLEAN DeleteFlag
,
516 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
520 Add Dns4 ServerIp to common list of addresses of all configured DNSv4 server.
522 @param Dns4ServerList Common list of addresses of all configured DNSv4 server.
523 @param ServerIp DNS server Ip.
525 @retval EFI_SUCCESS Add Dns4 ServerIp to common list successfully.
526 @retval Others Failed to add Dns4 ServerIp to common list.
532 IN LIST_ENTRY
*Dns4ServerList
,
533 IN EFI_IPv4_ADDRESS ServerIp
537 Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server.
539 @param Dns6ServerList Common list of addresses of all configured DNSv6 server.
540 @param ServerIp DNS server Ip.
542 @retval EFI_SUCCESS Add Dns6 ServerIp to common list successfully.
543 @retval Others Failed to add Dns6 ServerIp to common list.
549 IN LIST_ENTRY
*Dns6ServerList
,
550 IN EFI_IPv6_ADDRESS ServerIp
554 Find out whether the response is valid or invalid.
556 @param TokensMap All DNS transmittal Tokens entry.
557 @param Identification Identification for queried packet.
558 @param Type Type for queried packet.
559 @param Class Class for queried packet.
560 @param Item Return corresponding Token entry.
562 @retval TRUE The response is valid.
563 @retval FALSE The response is invalid.
568 IN NET_MAP
*TokensMap
,
569 IN UINT16 Identification
,
572 OUT NET_MAP_ITEM
**Item
578 @param Instance The DNS instance
579 @param RxString Received buffer.
580 @param Length Received buffer length.
581 @param Completed Flag to indicate that Dns response is valid.
583 @retval EFI_SUCCESS Parse Dns Response successfully.
584 @retval Others Failed to parse Dns Response.
589 IN OUT DNS_INSTANCE
*Instance
,
592 OUT BOOLEAN
*Completed
596 Parse response packet.
598 @param Packet The packets received.
599 @param EndPoint The local/remote UDP access point
600 @param IoStatus The status of the UDP receive
601 @param Context The opaque parameter to the function.
606 DnsOnPacketReceived (
608 UDP_END_POINT
*EndPoint
,
614 Release the net buffer when packet is sent.
616 @param Packet The packets received.
617 @param EndPoint The local/remote UDP access point
618 @param IoStatus The status of the UDP receive
619 @param Context The opaque parameter to the function.
626 UDP_END_POINT
*EndPoint
,
632 Query request information.
634 @param Instance The DNS instance
635 @param Packet The packet for querying request information.
637 @retval EFI_SUCCESS Query request information successfully.
638 @retval Others Failed to query request information.
643 IN DNS_INSTANCE
*Instance
,
648 Construct the Packet according query section.
650 @param Instance The DNS instance
651 @param QueryName Queried Name
652 @param Type Queried Type
653 @param Class Queried Class
654 @param Packet The packet for query
656 @retval EFI_SUCCESS The packet is constructed.
657 @retval Others Failed to construct the Packet.
662 IN DNS_INSTANCE
*Instance
,
670 Retransmit the packet.
672 @param Instance The DNS instance
673 @param Packet Retransmit the packet
675 @retval EFI_SUCCESS The packet is retransmitted.
676 @retval Others Failed to retransmit.
681 IN DNS_INSTANCE
*Instance
,
686 The timer ticking function for the DNS service.
688 @param Event The ticking event
689 @param Context The DNS service instance
694 DnsOnTimerRetransmit (
700 The timer ticking function for the DNS driver.
702 @param Event The ticking event
715 Retrieve mode data of this DNS instance.
717 This function is used to retrieve DNS mode data for this DNS instance.
719 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
720 @param[out] DnsModeData Point to the mode data.
722 @retval EFI_SUCCESS The operation completed successfully.
723 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
724 is available because this instance has not been
726 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
727 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
732 IN EFI_DNS4_PROTOCOL
*This
,
733 OUT EFI_DNS4_MODE_DATA
*DnsModeData
737 Configure this DNS instance.
739 This function is used to configure DNS mode data for this DNS instance.
741 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
742 @param[in] DnsConfigData Point to the Configuration data.
744 @retval EFI_SUCCESS The operation completed successfully.
745 @retval EFI_UNSUPPORTED The designated protocol is not supported.
746 @retval EFI_INVALID_PARAMTER Thisis NULL.
747 The StationIp address provided in DnsConfigData is not a
749 DnsServerList is NULL while DnsServerListCount
751 DnsServerListCount is ZERO while DnsServerList
753 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
755 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
756 EFI DNSv4 Protocol instance is not configured.
757 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
758 reconfigure the instance the caller must call Configure()
759 with NULL first to return driver to unconfigured state.
764 IN EFI_DNS4_PROTOCOL
*This
,
765 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
769 Host name to host address translation.
771 The HostNameToIp () function is used to translate the host name to host IP address. A
772 type A query is used to get the one or more IP addresses for this host.
774 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
775 @param[in] HostName Host name.
776 @param[in] Token Point to the completion token to translate host name
779 @retval EFI_SUCCESS The operation completed successfully.
780 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
784 HostName is NULL. HostName string is unsupported format.
785 @retval EFI_NO_MAPPING There's no source address is available for use.
786 @retval EFI_NOT_STARTED This instance has not been started.
791 IN EFI_DNS4_PROTOCOL
*This
,
793 IN EFI_DNS4_COMPLETION_TOKEN
*Token
797 IPv4 address to host name translation also known as Reverse DNS lookup.
799 The IpToHostName() function is used to translate the host address to host name. A type PTR
800 query is used to get the primary name of the host. Support of this function is optional.
802 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
803 @param[in] IpAddress Ip Address.
804 @param[in] Token Point to the completion token to translate host
805 address to host name.
807 @retval EFI_SUCCESS The operation completed successfully.
808 @retval EFI_UNSUPPORTED This function is not supported.
809 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
813 IpAddress is not valid IP address .
814 @retval EFI_NO_MAPPING There's no source address is available for use.
815 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
816 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
821 IN EFI_DNS4_PROTOCOL
*This
,
822 IN EFI_IPv4_ADDRESS IpAddress
,
823 IN EFI_DNS4_COMPLETION_TOKEN
*Token
827 Retrieve arbitrary information from the DNS server.
829 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
830 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
831 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
832 required information. The function is optional.
834 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
835 @param[in] QName Pointer to Query Name.
836 @param[in] QType Query Type.
837 @param[in] QClass Query Name.
838 @param[in] Token Point to the completion token to retrieve arbitrary
841 @retval EFI_SUCCESS The operation completed successfully.
842 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
843 QType is not supported
844 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
849 @retval EFI_NO_MAPPING There's no source address is available for use.
850 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
851 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
856 IN EFI_DNS4_PROTOCOL
*This
,
860 IN EFI_DNS4_COMPLETION_TOKEN
*Token
864 This function is to update the DNS Cache.
866 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
867 can be normally dynamically updated after the DNS resolve succeeds. This function
868 provided capability to manually add/delete/modify the DNS cache.
870 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
871 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
872 DNS Cahce. If TRUE, this function will delete
873 matching DNS Cache entry.
874 @param[in] Override If TRUE, the maching DNS cache entry will be
875 overwritten with the supplied parameter. If FALSE,
876 EFI_ACCESS_DENIED will be returned if the entry to
877 be added is already existed.
878 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
880 @retval EFI_SUCCESS The operation completed successfully.
881 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
883 DnsCacheEntry.HostName is NULL.
884 DnsCacheEntry.IpAddress is NULL.
885 DnsCacheEntry.Timeout is zero.
886 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
892 IN EFI_DNS4_PROTOCOL
*This
,
893 IN BOOLEAN DeleteFlag
,
895 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
899 Polls for incoming data packets and processes outgoing data packets.
901 The Poll() function can be used by network drivers and applications to increase the
902 rate that data packets are moved between the communications device and the transmit
904 In some systems, the periodic timer event in the managed network driver may not poll
905 the underlying communications device fast enough to transmit and/or receive all data
906 packets without missing incoming packets or dropping outgoing packets. Drivers and
907 applications that are experiencing packet loss should try calling the Poll()
910 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
912 @retval EFI_SUCCESS Incoming or outgoing data was processed.
913 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
914 @retval EFI_INVALID_PARAMETER This is NULL.
915 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
916 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
917 queue. Consider increasing the polling rate.
922 IN EFI_DNS4_PROTOCOL
*This
926 Abort an asynchronous DNS operation, including translation between IP and Host, and
927 general look up behavior.
929 The Cancel() function is used to abort a pending resolution request. After calling
930 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
931 signaled. If the token is not in one of the queues, which usually means that the
932 asynchronous operation has completed, this function will not signal the token and
933 EFI_NOT_FOUND is returned.
935 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
936 @param[in] Token Pointer to a token that has been issued by
937 EFI_DNS4_PROTOCOL.HostNameToIp (),
938 EFI_DNS4_PROTOCOL.IpToHostName() or
939 EFI_DNS4_PROTOCOL.GeneralLookup().
940 If NULL, all pending tokens are aborted.
942 @retval EFI_SUCCESS Incoming or outgoing data was processed.
943 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
944 @retval EFI_INVALID_PARAMETER This is NULL.
945 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
946 operation was not found in the transmit queue. It
947 was either completed or was not issued by
948 HostNameToIp(), IpToHostName() or GeneralLookup().
953 IN EFI_DNS4_PROTOCOL
*This
,
954 IN EFI_DNS4_COMPLETION_TOKEN
*Token
959 Retrieve mode data of this DNS instance.
961 This function is used to retrieve DNS mode data for this DNS instance.
963 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
964 @param[out] DnsModeData Pointer to the caller-allocated storage for the
965 EFI_DNS6_MODE_DATA data.
967 @retval EFI_SUCCESS The operation completed successfully.
968 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
969 is available because this instance has not been
971 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
972 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
977 IN EFI_DNS6_PROTOCOL
*This
,
978 OUT EFI_DNS6_MODE_DATA
*DnsModeData
982 Configure this DNS instance.
984 The Configure() function is used to set and change the configuration data for this
985 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
987 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
988 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
989 storage to be allocated and released by caller.
991 @retval EFI_SUCCESS The operation completed successfully.
992 @retval EFI_INVALID_PARAMTER This is NULL.
993 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
994 DnsServerList is NULL while DnsServerList Count is not ZERO.
995 DnsServerList Count is ZERO while DnsServerList is not NULL.
996 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
997 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
998 EFI DNSv6 Protocol instance is not configured.
999 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1000 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1001 reconfigure the instance the caller must call Configure() with
1002 NULL first to return driver to unconfigured state.
1007 IN EFI_DNS6_PROTOCOL
*This
,
1008 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1012 Host name to host address translation.
1014 The HostNameToIp () function is used to translate the host name to host IP address. A
1015 type AAAA query is used to get the one or more IPv6 addresses for this host.
1017 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1018 @param[in] HostName Host name.
1019 @param[in] Token Point to the completion token to translate host name
1022 @retval EFI_SUCCESS The operation completed successfully.
1023 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1026 Token.Event is NULL.
1027 HostName is NULL or buffer contained unsupported characters.
1028 @retval EFI_NO_MAPPING There's no source address is available for use.
1029 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1030 @retval EFI_NOT_STARTED This instance has not been started.
1031 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1036 IN EFI_DNS6_PROTOCOL
*This
,
1037 IN CHAR16
*HostName
,
1038 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1042 Host address to host name translation.
1044 The IpToHostName () function is used to translate the host address to host name. A
1045 type PTR query is used to get the primary name of the host. Implementation can choose
1046 to support this function or not.
1048 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1049 @param[in] IpAddress Ip Address.
1050 @param[in] Token Point to the completion token to translate host
1051 address to host name.
1053 @retval EFI_SUCCESS The operation completed successfully.
1054 @retval EFI_UNSUPPORTED This function is not supported.
1055 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1058 Token.Event is NULL.
1059 IpAddress is not valid IP address.
1060 @retval EFI_NO_MAPPING There's no source address is available for use.
1061 @retval EFI_NOT_STARTED This instance has not been started.
1062 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1067 IN EFI_DNS6_PROTOCOL
*This
,
1068 IN EFI_IPv6_ADDRESS IpAddress
,
1069 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1073 This function provides capability to retrieve arbitrary information from the DNS
1076 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1077 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1078 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1079 required information. The function is optional. Implementation can choose to support
1082 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1083 @param[in] QName Pointer to Query Name.
1084 @param[in] QType Query Type.
1085 @param[in] QClass Query Name.
1086 @param[in] Token Point to the completion token to retrieve arbitrary
1089 @retval EFI_SUCCESS The operation completed successfully.
1090 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1091 QType is not supported
1092 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1095 Token.Event is NULL.
1097 @retval EFI_NO_MAPPING There's no source address is available for use.
1098 @retval EFI_NOT_STARTED This instance has not been started.
1099 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1104 IN EFI_DNS6_PROTOCOL
*This
,
1108 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1112 This function is to update the DNS Cache.
1114 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1115 can be normally dynamically updated after the DNS resolve succeeds. This function
1116 provided capability to manually add/delete/modify the DNS cache.
1118 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1119 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1120 DNS Cahce. If TRUE, this function will delete
1121 matching DNS Cache entry.
1122 @param[in] Override If TRUE, the maching DNS cache entry will be
1123 overwritten with the supplied parameter. If FALSE,
1124 EFI_ACCESS_DENIED will be returned if the entry to
1125 be added is already existed.
1126 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1128 @retval EFI_SUCCESS The operation completed successfully.
1129 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1131 DnsCacheEntry.HostName is NULL.
1132 DnsCacheEntry.IpAddress is NULL.
1133 DnsCacheEntry.Timeout is zero.
1134 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1136 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1140 Dns6UpdateDnsCache (
1141 IN EFI_DNS6_PROTOCOL
*This
,
1142 IN BOOLEAN DeleteFlag
,
1143 IN BOOLEAN Override
,
1144 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1148 Polls for incoming data packets and processes outgoing data packets.
1150 The Poll() function can be used by network drivers and applications to increase the
1151 rate that data packets are moved between the communications device and the transmit
1154 In some systems, the periodic timer event in the managed network driver may not poll
1155 the underlying communications device fast enough to transmit and/or receive all data
1156 packets without missing incoming packets or dropping outgoing packets. Drivers and
1157 applications that are experiencing packet loss should try calling the Poll()
1158 function more often.
1160 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1162 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1163 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1164 @retval EFI_INVALID_PARAMETER This is NULL.
1165 @retval EFI_NO_MAPPING There is no source address is available for use.
1166 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1167 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1168 queue. Consider increasing the polling rate.
1173 IN EFI_DNS6_PROTOCOL
*This
1177 Abort an asynchronous DNS operation, including translation between IP and Host, and
1178 general look up behavior.
1180 The Cancel() function is used to abort a pending resolution request. After calling
1181 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1182 signaled. If the token is not in one of the queues, which usually means that the
1183 asynchronous operation has completed, this function will not signal the token and
1184 EFI_NOT_FOUND is returned.
1186 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1187 @param[in] Token Pointer to a token that has been issued by
1188 EFI_DNS6_PROTOCOL.HostNameToIp (),
1189 EFI_DNS6_PROTOCOL.IpToHostName() or
1190 EFI_DNS6_PROTOCOL.GeneralLookup().
1191 If NULL, all pending tokens are aborted.
1193 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1194 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1195 @retval EFI_INVALID_PARAMETER This is NULL.
1196 @retval EFI_NO_MAPPING There's no source address is available for use.
1197 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1198 operation was not found in the transmit queue. It
1199 was either completed or was not issued by
1200 HostNameToIp(), IpToHostName() or GeneralLookup().
1205 IN EFI_DNS6_PROTOCOL
*This
,
1206 IN EFI_DNS6_COMPLETION_TOKEN
*Token