2 DnsDxe support functions implementation.
4 Copyright (c) 2015 - 2016, 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
89 #define DNS_DEFAULT_RETRY 3
91 #define DNS_TIME_TO_GETMAP 5
95 typedef union _DNS_FLAGS DNS_FLAGS
;
98 LIST_ENTRY AllCacheLink
;
99 EFI_DNS4_CACHE_ENTRY DnsCache
;
103 LIST_ENTRY AllCacheLink
;
104 EFI_DNS6_CACHE_ENTRY DnsCache
;
108 LIST_ENTRY AllServerLink
;
109 EFI_IPv4_ADDRESS Dns4ServerIp
;
113 LIST_ENTRY AllServerLink
;
114 EFI_IPv6_ADDRESS Dns6ServerIp
;
119 CHAR16
*QueryHostName
;
120 EFI_IPv4_ADDRESS QueryIpAddress
;
121 BOOLEAN GeneralLookUp
;
122 EFI_DNS4_COMPLETION_TOKEN
*Token
;
127 CHAR16
*QueryHostName
;
128 EFI_IPv6_ADDRESS QueryIpAddress
;
129 BOOLEAN GeneralLookUp
;
130 EFI_DNS6_COMPLETION_TOKEN
*Token
;
147 #define DNS_FLAGS_QR_QUERY 0
148 #define DNS_FLAGS_QR_RESPONSE 1
150 #define DNS_FLAGS_OPCODE_STANDARD 0
151 #define DNS_FLAGS_OPCODE_INVERSE 1
152 #define DNS_FLAGS_OPCODE_SERVER_STATE 2
154 #define DNS_FLAGS_RCODE_NO_ERROR 0
155 #define DNS_FLAGS_RCODE_NAME_ERROR 3
158 UINT16 Identification
;
176 } DNS_ANSWER_SECTION
;
178 #define DNS4_DOMAIN L"in-addr.arpa"
179 #define DNS6_DOMAIN L"IP6.ARPA"
185 Remove TokenEntry from TokenMap.
187 @param[in] TokenMap All DNSv4 Token entrys.
188 @param[in] TokenEntry TokenEntry need to be removed.
190 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
191 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
195 Dns4RemoveTokenEntry (
196 IN NET_MAP
*TokenMap
,
197 IN DNS4_TOKEN_ENTRY
*TokenEntry
201 Remove TokenEntry from TokenMap.
203 @param[in] TokenMap All DNSv6 Token entrys.
204 @param[in] TokenEntry TokenEntry need to be removed.
206 @retval EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
207 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
211 Dns6RemoveTokenEntry (
212 IN NET_MAP
*TokenMap
,
213 IN DNS6_TOKEN_ENTRY
*TokenEntry
217 This function cancle the token specified by Arg in the Map.
219 @param[in] Map Pointer to the NET_MAP.
220 @param[in] Item Pointer to the NET_MAP_ITEM.
221 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
222 the tokens in this Map will be cancelled.
223 This parameter is optional and may be NULL.
225 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
226 is not the same as that in the Item, if Arg is not
228 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
236 IN NET_MAP_ITEM
*Item
,
237 IN VOID
*Arg OPTIONAL
241 This function cancle the token specified by Arg in the Map.
243 @param[in] Map Pointer to the NET_MAP.
244 @param[in] Item Pointer to the NET_MAP_ITEM.
245 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
246 the tokens in this Map will be cancelled.
247 This parameter is optional and may be NULL.
249 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
250 is not the same as that in the Item, if Arg is not
252 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
260 IN NET_MAP_ITEM
*Item
,
261 IN VOID
*Arg OPTIONAL
265 Get the TokenEntry from the TokensMap.
267 @param[in] TokensMap All DNSv4 Token entrys
268 @param[in] Token Pointer to the token to be get.
269 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
271 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
272 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
278 IN NET_MAP
*TokensMap
,
279 IN EFI_DNS4_COMPLETION_TOKEN
*Token
,
280 OUT DNS4_TOKEN_ENTRY
**TokenEntry
284 Get the TokenEntry from the TokensMap.
286 @param[in] TokensMap All DNSv6 Token entrys
287 @param[in] Token Pointer to the token to be get.
288 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
290 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
291 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
297 IN NET_MAP
*TokensMap
,
298 IN EFI_DNS6_COMPLETION_TOKEN
*Token
,
299 OUT DNS6_TOKEN_ENTRY
**TokenEntry
303 Cancel DNS4 tokens from the DNS4 instance.
305 @param[in] Instance Pointer to the DNS instance context data.
306 @param[in] Token Pointer to the token to be canceled. If NULL, all
307 tokens in this instance will be cancelled.
308 This parameter is optional and may be NULL.
310 @retval EFI_SUCCESS The Token is cancelled.
311 @retval EFI_NOT_FOUND The Token is not found.
315 Dns4InstanceCancelToken (
316 IN DNS_INSTANCE
*Instance
,
317 IN EFI_DNS4_COMPLETION_TOKEN
*Token
321 Cancel DNS6 tokens from the DNS6 instance.
323 @param[in] Instance Pointer to the DNS instance context data.
324 @param[in] Token Pointer to the token to be canceled. If NULL, all
325 tokens in this instance will be cancelled.
326 This parameter is optional and may be NULL.
328 @retval EFI_SUCCESS The Token is cancelled.
329 @retval EFI_NOT_FOUND The Token is not found.
333 Dns6InstanceCancelToken (
334 IN DNS_INSTANCE
*Instance
,
335 IN EFI_DNS6_COMPLETION_TOKEN
*Token
339 Free the resource related to the configure parameters.
341 @param Config The DNS configure data
346 IN OUT EFI_DNS4_CONFIG_DATA
*Config
350 Free the resource related to the configure parameters.
352 @param Config The DNS configure data
357 IN OUT EFI_DNS6_CONFIG_DATA
*Config
361 Allocate memory for configure parameter such as timeout value for Dst,
362 then copy the configure parameter from Src to Dst.
364 @param[out] Dst The destination DHCP configure data.
365 @param[in] Src The source DHCP configure data.
367 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
368 @retval EFI_SUCCESS The configure is copied.
373 OUT EFI_DNS4_CONFIG_DATA
*Dst
,
374 IN EFI_DNS4_CONFIG_DATA
*Src
378 Allocate memory for configure parameter such as timeout value for Dst,
379 then copy the configure parameter from Src to Dst.
381 @param[out] Dst The destination DHCP configure data.
382 @param[in] Src The source DHCP configure data.
384 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
385 @retval EFI_SUCCESS The configure is copied.
390 OUT EFI_DNS6_CONFIG_DATA
*Dst
,
391 IN EFI_DNS6_CONFIG_DATA
*Src
395 Callback of Dns packet. Does nothing.
397 @param Arg The context.
407 Poll the UDP to get the IP4 default address, which may be retrieved
410 The default time out value is 5 seconds. If IP has retrieved the default address,
411 the UDP is reconfigured.
413 @param Instance The DNS instance
414 @param UdpIo The UDP_IO to poll
415 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
417 @retval TRUE The default address is retrieved and UDP is reconfigured.
418 @retval FALSE Some error occured.
423 IN DNS_INSTANCE
*Instance
,
425 IN EFI_UDP4_CONFIG_DATA
*UdpCfgData
429 Configure the opened Udp6 instance until the corresponding Ip6 instance
432 @param Instance The DNS instance
433 @param UdpIo The UDP_IO to poll
434 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
436 @retval TRUE Configure the Udp6 instance successfully.
437 @retval FALSE Some error occured.
442 IN DNS_INSTANCE
*Instance
,
444 IN EFI_UDP6_CONFIG_DATA
*UdpCfgData
450 @param Instance The DNS session
451 @param UdpIo The UDP_IO instance
453 @retval EFI_SUCCESS The UDP is successfully configured for the
459 IN DNS_INSTANCE
*Instance
,
466 @param Instance The DNS session
467 @param UdpIo The UDP_IO instance
469 @retval EFI_SUCCESS The UDP is successfully configured for the
475 IN DNS_INSTANCE
*Instance
,
480 Update Dns4 cache to shared list of caches of all DNSv4 instances.
482 @param Dns4CacheList All Dns4 cache list.
483 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
484 If TRUE, this function will delete matching DNS Cache entry.
485 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
486 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
487 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
489 @retval EFI_SUCCESS Update Dns4 cache successfully.
490 @retval Others Failed to update Dns4 cache.
496 IN LIST_ENTRY
*Dns4CacheList
,
497 IN BOOLEAN DeleteFlag
,
499 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
503 Update Dns6 cache to shared list of caches of all DNSv6 instances.
505 @param Dns6CacheList All Dns6 cache list.
506 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
507 If TRUE, this function will delete matching DNS Cache entry.
508 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
509 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
510 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
512 @retval EFI_SUCCESS Update Dns6 cache successfully.
513 @retval Others Failed to update Dns6 cache.
518 IN LIST_ENTRY
*Dns6CacheList
,
519 IN BOOLEAN DeleteFlag
,
521 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
525 Add Dns4 ServerIp to common list of addresses of all configured DNSv4 server.
527 @param Dns4ServerList Common list of addresses of all configured DNSv4 server.
528 @param ServerIp DNS server Ip.
530 @retval EFI_SUCCESS Add Dns4 ServerIp to common list successfully.
531 @retval Others Failed to add Dns4 ServerIp to common list.
537 IN LIST_ENTRY
*Dns4ServerList
,
538 IN EFI_IPv4_ADDRESS ServerIp
542 Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server.
544 @param Dns6ServerList Common list of addresses of all configured DNSv6 server.
545 @param ServerIp DNS server Ip.
547 @retval EFI_SUCCESS Add Dns6 ServerIp to common list successfully.
548 @retval Others Failed to add Dns6 ServerIp to common list.
554 IN LIST_ENTRY
*Dns6ServerList
,
555 IN EFI_IPv6_ADDRESS ServerIp
559 Find out whether the response is valid or invalid.
561 @param TokensMap All DNS transmittal Tokens entry.
562 @param Identification Identification for queried packet.
563 @param Type Type for queried packet.
564 @param Class Class for queried packet.
565 @param Item Return corresponding Token entry.
567 @retval TRUE The response is valid.
568 @retval FALSE The response is invalid.
573 IN NET_MAP
*TokensMap
,
574 IN UINT16 Identification
,
577 OUT NET_MAP_ITEM
**Item
583 @param Instance The DNS instance
584 @param RxString Received buffer.
585 @param Completed Flag to indicate that Dns response is valid.
587 @retval EFI_SUCCESS Parse Dns Response successfully.
588 @retval Others Failed to parse Dns Response.
593 IN OUT DNS_INSTANCE
*Instance
,
595 OUT BOOLEAN
*Completed
599 Parse response packet.
601 @param Packet The packets received.
602 @param EndPoint The local/remote UDP access point
603 @param IoStatus The status of the UDP receive
604 @param Context The opaque parameter to the function.
609 DnsOnPacketReceived (
611 UDP_END_POINT
*EndPoint
,
617 Release the net buffer when packet is sent.
619 @param Packet The packets received.
620 @param EndPoint The local/remote UDP access point
621 @param IoStatus The status of the UDP receive
622 @param Context The opaque parameter to the function.
629 UDP_END_POINT
*EndPoint
,
635 Query request information.
637 @param Instance The DNS instance
638 @param Packet The packet for querying request information.
640 @retval EFI_SUCCESS Query request information successfully.
641 @retval Others Failed to query request information.
646 IN DNS_INSTANCE
*Instance
,
651 Construct the Packet according query section.
653 @param Instance The DNS instance
654 @param QueryName Queried Name
655 @param Type Queried Type
656 @param Class Queried Class
657 @param Packet The packet for query
659 @retval EFI_SUCCESS The packet is constructed.
660 @retval Others Failed to construct the Packet.
665 IN DNS_INSTANCE
*Instance
,
673 Retransmit the packet.
675 @param Instance The DNS instance
676 @param Packet Retransmit the packet
678 @retval EFI_SUCCESS The packet is retransmitted.
679 @retval Others Failed to retransmit.
684 IN DNS_INSTANCE
*Instance
,
689 The timer ticking function for the DNS service.
691 @param Event The ticking event
692 @param Context The DNS service instance
697 DnsOnTimerRetransmit (
703 The timer ticking function for the DNS driver.
705 @param Event The ticking event
718 Retrieve mode data of this DNS instance.
720 This function is used to retrieve DNS mode data for this DNS instance.
722 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
723 @param[out] DnsModeData Point to the mode data.
725 @retval EFI_SUCCESS The operation completed successfully.
726 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
727 is available because this instance has not been
729 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
730 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
735 IN EFI_DNS4_PROTOCOL
*This
,
736 OUT EFI_DNS4_MODE_DATA
*DnsModeData
740 Configure this DNS instance.
742 This function is used to configure DNS mode data for this DNS instance.
744 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
745 @param[in] DnsConfigData Point to the Configuration data.
747 @retval EFI_SUCCESS The operation completed successfully.
748 @retval EFI_UNSUPPORTED The designated protocol is not supported.
749 @retval EFI_INVALID_PARAMTER Thisis NULL.
750 The StationIp address provided in DnsConfigData is not a
752 DnsServerList is NULL while DnsServerListCount
754 DnsServerListCount is ZERO while DnsServerList
756 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
758 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
759 EFI DNSv4 Protocol instance is not configured.
760 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
761 reconfigure the instance the caller must call Configure()
762 with NULL first to return driver to unconfigured state.
767 IN EFI_DNS4_PROTOCOL
*This
,
768 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
772 Host name to host address translation.
774 The HostNameToIp () function is used to translate the host name to host IP address. A
775 type A query is used to get the one or more IP addresses for this host.
777 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
778 @param[in] HostName Host name.
779 @param[in] Token Point to the completion token to translate host name
782 @retval EFI_SUCCESS The operation completed successfully.
783 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
787 HostName is NULL. HostName string is unsupported format.
788 @retval EFI_NO_MAPPING There's no source address is available for use.
789 @retval EFI_NOT_STARTED This instance has not been started.
794 IN EFI_DNS4_PROTOCOL
*This
,
796 IN EFI_DNS4_COMPLETION_TOKEN
*Token
800 IPv4 address to host name translation also known as Reverse DNS lookup.
802 The IpToHostName() function is used to translate the host address to host name. A type PTR
803 query is used to get the primary name of the host. Support of this function is optional.
805 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
806 @param[in] IpAddress Ip Address.
807 @param[in] Token Point to the completion token to translate host
808 address to host name.
810 @retval EFI_SUCCESS The operation completed successfully.
811 @retval EFI_UNSUPPORTED This function is not supported.
812 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
816 IpAddress is not valid IP address .
817 @retval EFI_NO_MAPPING There's no source address is available for use.
818 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
819 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
824 IN EFI_DNS4_PROTOCOL
*This
,
825 IN EFI_IPv4_ADDRESS IpAddress
,
826 IN EFI_DNS4_COMPLETION_TOKEN
*Token
830 Retrieve arbitrary information from the DNS server.
832 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
833 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
834 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
835 required information. The function is optional.
837 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
838 @param[in] QName Pointer to Query Name.
839 @param[in] QType Query Type.
840 @param[in] QClass Query Name.
841 @param[in] Token Point to the completion token to retrieve arbitrary
844 @retval EFI_SUCCESS The operation completed successfully.
845 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
846 QType is not supported
847 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
852 @retval EFI_NO_MAPPING There's no source address is available for use.
853 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
854 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
859 IN EFI_DNS4_PROTOCOL
*This
,
863 IN EFI_DNS4_COMPLETION_TOKEN
*Token
867 This function is to update the DNS Cache.
869 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
870 can be normally dynamically updated after the DNS resolve succeeds. This function
871 provided capability to manually add/delete/modify the DNS cache.
873 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
874 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
875 DNS Cahce. If TRUE, this function will delete
876 matching DNS Cache entry.
877 @param[in] Override If TRUE, the maching DNS cache entry will be
878 overwritten with the supplied parameter. If FALSE,
879 EFI_ACCESS_DENIED will be returned if the entry to
880 be added is already existed.
881 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
883 @retval EFI_SUCCESS The operation completed successfully.
884 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
886 DnsCacheEntry.HostName is NULL.
887 DnsCacheEntry.IpAddress is NULL.
888 DnsCacheEntry.Timeout is zero.
889 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
895 IN EFI_DNS4_PROTOCOL
*This
,
896 IN BOOLEAN DeleteFlag
,
898 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
902 Polls for incoming data packets and processes outgoing data packets.
904 The Poll() function can be used by network drivers and applications to increase the
905 rate that data packets are moved between the communications device and the transmit
907 In some systems, the periodic timer event in the managed network driver may not poll
908 the underlying communications device fast enough to transmit and/or receive all data
909 packets without missing incoming packets or dropping outgoing packets. Drivers and
910 applications that are experiencing packet loss should try calling the Poll()
913 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
915 @retval EFI_SUCCESS Incoming or outgoing data was processed.
916 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
917 @retval EFI_INVALID_PARAMETER This is NULL.
918 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
919 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
920 queue. Consider increasing the polling rate.
925 IN EFI_DNS4_PROTOCOL
*This
929 Abort an asynchronous DNS operation, including translation between IP and Host, and
930 general look up behavior.
932 The Cancel() function is used to abort a pending resolution request. After calling
933 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
934 signaled. If the token is not in one of the queues, which usually means that the
935 asynchronous operation has completed, this function will not signal the token and
936 EFI_NOT_FOUND is returned.
938 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
939 @param[in] Token Pointer to a token that has been issued by
940 EFI_DNS4_PROTOCOL.HostNameToIp (),
941 EFI_DNS4_PROTOCOL.IpToHostName() or
942 EFI_DNS4_PROTOCOL.GeneralLookup().
943 If NULL, all pending tokens are aborted.
945 @retval EFI_SUCCESS Incoming or outgoing data was processed.
946 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
947 @retval EFI_INVALID_PARAMETER This is NULL.
948 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
949 operation was not found in the transmit queue. It
950 was either completed or was not issued by
951 HostNameToIp(), IpToHostName() or GeneralLookup().
956 IN EFI_DNS4_PROTOCOL
*This
,
957 IN EFI_DNS4_COMPLETION_TOKEN
*Token
962 Retrieve mode data of this DNS instance.
964 This function is used to retrieve DNS mode data for this DNS instance.
966 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
967 @param[out] DnsModeData Pointer to the caller-allocated storage for the
968 EFI_DNS6_MODE_DATA data.
970 @retval EFI_SUCCESS The operation completed successfully.
971 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
972 is available because this instance has not been
974 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
975 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
980 IN EFI_DNS6_PROTOCOL
*This
,
981 OUT EFI_DNS6_MODE_DATA
*DnsModeData
985 Configure this DNS instance.
987 The Configure() function is used to set and change the configuration data for this
988 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
990 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
991 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
992 storage to be allocated and released by caller.
994 @retval EFI_SUCCESS The operation completed successfully.
995 @retval EFI_INVALID_PARAMTER This is NULL.
996 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
997 DnsServerList is NULL while DnsServerList Count is not ZERO.
998 DnsServerList Count is ZERO while DnsServerList is not NULL.
999 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
1000 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
1001 EFI DNSv6 Protocol instance is not configured.
1002 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1003 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1004 reconfigure the instance the caller must call Configure() with
1005 NULL first to return driver to unconfigured state.
1010 IN EFI_DNS6_PROTOCOL
*This
,
1011 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1015 Host name to host address translation.
1017 The HostNameToIp () function is used to translate the host name to host IP address. A
1018 type AAAA query is used to get the one or more IPv6 addresses for this host.
1020 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1021 @param[in] HostName Host name.
1022 @param[in] Token Point to the completion token to translate host name
1025 @retval EFI_SUCCESS The operation completed successfully.
1026 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1029 Token.Event is NULL.
1030 HostName is NULL or buffer contained unsupported characters.
1031 @retval EFI_NO_MAPPING There's no source address is available for use.
1032 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1033 @retval EFI_NOT_STARTED This instance has not been started.
1034 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1039 IN EFI_DNS6_PROTOCOL
*This
,
1040 IN CHAR16
*HostName
,
1041 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1045 Host address to host name translation.
1047 The IpToHostName () function is used to translate the host address to host name. A
1048 type PTR query is used to get the primary name of the host. Implementation can choose
1049 to support this function or not.
1051 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1052 @param[in] IpAddress Ip Address.
1053 @param[in] Token Point to the completion token to translate host
1054 address to host name.
1056 @retval EFI_SUCCESS The operation completed successfully.
1057 @retval EFI_UNSUPPORTED This function is not supported.
1058 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1061 Token.Event is NULL.
1062 IpAddress is not valid IP address.
1063 @retval EFI_NO_MAPPING There's no source address is available for use.
1064 @retval EFI_NOT_STARTED This instance has not been started.
1065 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1070 IN EFI_DNS6_PROTOCOL
*This
,
1071 IN EFI_IPv6_ADDRESS IpAddress
,
1072 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1076 This function provides capability to retrieve arbitrary information from the DNS
1079 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1080 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1081 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1082 required information. The function is optional. Implementation can choose to support
1085 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1086 @param[in] QName Pointer to Query Name.
1087 @param[in] QType Query Type.
1088 @param[in] QClass Query Name.
1089 @param[in] Token Point to the completion token to retrieve arbitrary
1092 @retval EFI_SUCCESS The operation completed successfully.
1093 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1094 QType is not supported
1095 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1098 Token.Event is NULL.
1100 @retval EFI_NO_MAPPING There's no source address is available for use.
1101 @retval EFI_NOT_STARTED This instance has not been started.
1102 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1107 IN EFI_DNS6_PROTOCOL
*This
,
1111 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1115 This function is to update the DNS Cache.
1117 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1118 can be normally dynamically updated after the DNS resolve succeeds. This function
1119 provided capability to manually add/delete/modify the DNS cache.
1121 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1122 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1123 DNS Cahce. If TRUE, this function will delete
1124 matching DNS Cache entry.
1125 @param[in] Override If TRUE, the maching DNS cache entry will be
1126 overwritten with the supplied parameter. If FALSE,
1127 EFI_ACCESS_DENIED will be returned if the entry to
1128 be added is already existed.
1129 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1131 @retval EFI_SUCCESS The operation completed successfully.
1132 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1134 DnsCacheEntry.HostName is NULL.
1135 DnsCacheEntry.IpAddress is NULL.
1136 DnsCacheEntry.Timeout is zero.
1137 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1139 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1143 Dns6UpdateDnsCache (
1144 IN EFI_DNS6_PROTOCOL
*This
,
1145 IN BOOLEAN DeleteFlag
,
1146 IN BOOLEAN Override
,
1147 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1151 Polls for incoming data packets and processes outgoing data packets.
1153 The Poll() function can be used by network drivers and applications to increase the
1154 rate that data packets are moved between the communications device and the transmit
1157 In some systems, the periodic timer event in the managed network driver may not poll
1158 the underlying communications device fast enough to transmit and/or receive all data
1159 packets without missing incoming packets or dropping outgoing packets. Drivers and
1160 applications that are experiencing packet loss should try calling the Poll()
1161 function more often.
1163 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1165 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1166 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1167 @retval EFI_INVALID_PARAMETER This is NULL.
1168 @retval EFI_NO_MAPPING There is no source address is available for use.
1169 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1170 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1171 queue. Consider increasing the polling rate.
1176 IN EFI_DNS6_PROTOCOL
*This
1180 Abort an asynchronous DNS operation, including translation between IP and Host, and
1181 general look up behavior.
1183 The Cancel() function is used to abort a pending resolution request. After calling
1184 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1185 signaled. If the token is not in one of the queues, which usually means that the
1186 asynchronous operation has completed, this function will not signal the token and
1187 EFI_NOT_FOUND is returned.
1189 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1190 @param[in] Token Pointer to a token that has been issued by
1191 EFI_DNS6_PROTOCOL.HostNameToIp (),
1192 EFI_DNS6_PROTOCOL.IpToHostName() or
1193 EFI_DNS6_PROTOCOL.GeneralLookup().
1194 If NULL, all pending tokens are aborted.
1196 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1197 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1198 @retval EFI_INVALID_PARAMETER This is NULL.
1199 @retval EFI_NO_MAPPING There's no source address is available for use.
1200 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1201 operation was not found in the transmit queue. It
1202 was either completed or was not issued by
1203 HostNameToIp(), IpToHostName() or GeneralLookup().
1208 IN EFI_DNS6_PROTOCOL
*This
,
1209 IN EFI_DNS6_COMPLETION_TOKEN
*Token