2 Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces.
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 EFI_DNS4_PROTOCOL mDns4Protocol
= {
28 EFI_DNS6_PROTOCOL mDns6Protocol
= {
40 This function is used to retrieve DNS mode data for this DNS instance.
42 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
43 @param[out] DnsModeData Pointer to the caller-allocated storage for the EFI_DNS4_MODE_DATA structure.
45 @retval EFI_SUCCESS The operation completed successfully.
46 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data is
47 available because this instance has not been configured.
48 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
49 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
55 IN EFI_DNS4_PROTOCOL
*This
,
56 OUT EFI_DNS4_MODE_DATA
*DnsModeData
59 DNS_INSTANCE
*Instance
;
68 DNS4_SERVER_IP
*ServerItem
;
69 EFI_IPv4_ADDRESS
*ServerList
;
70 DNS4_CACHE
*CacheItem
;
71 EFI_DNS4_CACHE_ENTRY
*CacheList
;
81 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
82 return EFI_INVALID_PARAMETER
;
85 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
87 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
88 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
89 gBS
->RestoreTPL (OldTpl
);
90 return EFI_NOT_STARTED
;
93 ZeroMem (DnsModeData
, sizeof (EFI_DNS4_MODE_DATA
));
96 // Get the current configuration data of this instance.
98 Status
= Dns4CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns4CfgData
);
99 if (EFI_ERROR (Status
)) {
100 gBS
->RestoreTPL (OldTpl
);
105 // Get the DnsServerCount and DnsServerList
108 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
111 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
112 ServerList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * DnsModeData
->DnsServerCount
);
113 ASSERT (ServerList
!= NULL
);
115 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
116 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_SERVER_IP
, AllServerLink
);
117 CopyMem (ServerList
+ Index
, &ServerItem
->Dns4ServerIp
, sizeof (EFI_IPv4_ADDRESS
));
120 DnsModeData
->DnsServerList
= ServerList
;
123 // Get the DnsCacheCount and DnsCacheList
126 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
129 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
130 CacheList
= AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
131 ASSERT (CacheList
!= NULL
);
133 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
134 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
135 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS4_CACHE_ENTRY
));
138 DnsModeData
->DnsCacheList
= CacheList
;
140 gBS
->RestoreTPL (OldTpl
);
146 This function is used to configure DNS configuration data for this DNS instance.
148 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
149 @param[in] DnsConfigData Pointer to caller-allocated buffer containing EFI_DNS4_CONFIG_DATA structure.
150 If NULL, the driver will reinitialize the protocol instance to the unconfigured state.
152 @retval EFI_SUCCESS The operation completed successfully.
153 @retval EFI_UNSUPPORTED The designated protocol is not supported.
154 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
155 @retval EFI_INVALID_PARAMETER This is NULL.
156 The StationIp address provided in DnsConfigData is not a valid unicast.
157 DnsServerList is NULL while DnsServerListCount is not equal to Zero.
158 DnsServerListCount is Zero while DnsServerListCount is not equal to NULL.
159 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI DNSv4 Protocol instance is not configured.
165 IN EFI_DNS4_PROTOCOL
*This
,
166 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
170 DNS_INSTANCE
*Instance
;
176 UINT32 ServerListCount
;
177 EFI_IPv4_ADDRESS
*ServerList
;
179 Status
= EFI_SUCCESS
;
183 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerListCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
184 (DnsConfigData
->DnsServerListCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
185 return EFI_INVALID_PARAMETER
;
188 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
189 return EFI_UNSUPPORTED
;
192 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
194 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
196 if (DnsConfigData
== NULL
) {
197 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
200 // Reset the Instance if ConfigData is NULL
202 if (!NetMapIsEmpty(&Instance
->Dns4TxTokens
)) {
203 Dns4InstanceCancelToken(Instance
, NULL
);
206 Instance
->MaxRetry
= 0;
208 if (Instance
->UdpIo
!= NULL
){
209 UdpIoCleanIo (Instance
->UdpIo
);
212 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
213 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
215 ZeroMem (&Instance
->Dns4CfgData
, sizeof (EFI_DNS4_CONFIG_DATA
));
217 Instance
->State
= DNS_STATE_UNCONFIGED
;
220 // Configure the parameters for new operation.
222 CopyMem (&Ip
, &DnsConfigData
->StationIp
, sizeof (IP4_ADDR
));
223 CopyMem (&Netmask
, &DnsConfigData
->SubnetMask
, sizeof (IP4_ADDR
));
226 Netmask
= NTOHL (Netmask
);
228 if (!DnsConfigData
->UseDefaultSetting
&&
229 ((!IP4_IS_VALID_NETMASK (Netmask
) || !NetIp4IsUnicast (Ip
, Netmask
)))) {
230 Status
= EFI_INVALID_PARAMETER
;
234 Status
= Dns4CopyConfigure (&Instance
->Dns4CfgData
, DnsConfigData
);
235 if (EFI_ERROR (Status
)) {
239 if (DnsConfigData
->DnsServerListCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
240 gBS
->RestoreTPL (OldTpl
);
243 // The DNS instance will retrieve DNS server from DHCP Server
245 Status
= GetDns4ServerFromDhcp4 (
250 if (EFI_ERROR (Status
)) {
254 ASSERT(ServerList
!= NULL
);
256 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
258 CopyMem (&Instance
->SessionDnsServer
.v4
, &ServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
260 CopyMem (&Instance
->SessionDnsServer
.v4
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
266 Status
= Dns4ConfigUdp (Instance
, Instance
->UdpIo
);
267 if (EFI_ERROR (Status
)) {
268 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
269 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
275 // Add configured DNS server used by this instance to ServerList.
277 Status
= AddDns4ServerIp (&mDriverData
->Dns4ServerList
, Instance
->SessionDnsServer
.v4
);
278 if (EFI_ERROR (Status
)) {
279 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
280 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
285 Instance
->State
= DNS_STATE_CONFIGED
;
289 gBS
->RestoreTPL (OldTpl
);
294 The function is used to translate the host name to host IP address.
295 A type A query is used to get the one or more IP addresses for this host.
297 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
298 @param[in] HostName Pointer to caller-supplied buffer containing Host name to be translated.
299 This buffer contains 16 bit characters but these are translated to ASCII for use with
300 DNSv4 server and there is no requirement for driver to support non-ASCII Unicode characters.
301 @param[in] Token Pointer to the caller-allocated completion token to return at the completion of the process to translate host name to host address.
303 @retval EFI_SUCCESS The operation completed successfully.
304 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
305 @retval EFI_INVALID_PARAMETER This is NULL.
309 @retval EFI_NO_MAPPING There's no source address is available for use.
310 @retval EFI_NOT_STARTED This instance has not been started.
316 IN EFI_DNS4_PROTOCOL
*This
,
318 IN EFI_DNS4_COMPLETION_TOKEN
*Token
323 DNS_INSTANCE
*Instance
;
325 EFI_DNS4_CONFIG_DATA
*ConfigData
;
334 DNS4_TOKEN_ENTRY
*TokenEntry
;
339 Status
= EFI_SUCCESS
;
346 // Validate the parameters
348 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
349 return EFI_INVALID_PARAMETER
;
352 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
354 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
356 ConfigData
= &(Instance
->Dns4CfgData
);
358 Instance
->MaxRetry
= ConfigData
->RetryCount
;
360 Token
->Status
= EFI_NOT_READY
;
361 Token
->RetryCount
= 0;
362 Token
->RetryInterval
= ConfigData
->RetryInterval
;
364 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
365 Status
= EFI_NOT_STARTED
;
370 // Check the MaxRetry and RetryInterval values.
372 if (Instance
->MaxRetry
== 0) {
373 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
376 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
377 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
383 if (ConfigData
->EnableDnsCache
) {
385 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
386 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
387 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
393 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS_HOST_TO_ADDR_DATA
));
394 if (Token
->RspData
.H2AData
== NULL
) {
395 Status
= EFI_OUT_OF_RESOURCES
;
399 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
400 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * Index
);
401 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
402 if (Token
->RspData
.H2AData
!= NULL
) {
403 FreePool (Token
->RspData
.H2AData
);
406 Status
= EFI_OUT_OF_RESOURCES
;
411 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
412 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
413 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
414 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv4_ADDRESS
));
419 Token
->Status
= EFI_SUCCESS
;
421 if (Token
->Event
!= NULL
) {
422 gBS
->SignalEvent (Token
->Event
);
426 Status
= Token
->Status
;
432 // Construct DNS TokenEntry.
434 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
435 if (TokenEntry
== NULL
) {
436 Status
= EFI_OUT_OF_RESOURCES
;
440 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
441 TokenEntry
->QueryHostName
= HostName
;
442 TokenEntry
->Token
= Token
;
447 QueryName
= DnsFillinQNameForQueryIp (TokenEntry
->QueryHostName
);
448 if (QueryName
== NULL
) {
449 Status
= EFI_OUT_OF_RESOURCES
;
454 // Construct DNS Query Packet.
456 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_A
, DNS_CLASS_INET
, &Packet
);
457 if (EFI_ERROR (Status
)) {
458 if (TokenEntry
!= NULL
) {
459 FreePool (TokenEntry
);
465 ASSERT (Packet
!= NULL
);
468 // Save the token into the Dns4TxTokens map.
470 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
471 if (EFI_ERROR (Status
)) {
472 if (TokenEntry
!= NULL
) {
473 FreePool (TokenEntry
);
484 Status
= DoDnsQuery (Instance
, Packet
);
485 if (EFI_ERROR (Status
)) {
486 if (TokenEntry
!= NULL
) {
487 FreePool (TokenEntry
);
494 if (QueryName
!= NULL
) {
495 FreePool (QueryName
);
498 gBS
->RestoreTPL (OldTpl
);
503 The function is used to translate the host address to host name.
504 A type PTR query is used to get the primary name of the host.
506 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
507 @param[in] IpAddress IP address.
508 @param[in] Token Pointer to the caller-allocated completion used token to translate host address to host name.
510 @retval EFI_SUCCESS The operation completed successfully.
511 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
512 @retval EFI_INVALID_PARAMETER This is NULL.
515 IpAddress is not valid IP address.
516 @retval EFI_NO_MAPPING There's no source address is available for use.
517 @retval EFI_NOT_STARTED This instance has not been started.
518 @retval EFI_UNSUPPORTED This function is not supported.
524 IN EFI_DNS4_PROTOCOL
*This
,
525 IN EFI_IPv4_ADDRESS IpAddress
,
526 IN EFI_DNS4_COMPLETION_TOKEN
*Token
529 return EFI_UNSUPPORTED
;
533 This function retrieves arbitrary information from the DNS.
534 The caller supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned.
535 All RR content (e.g., Ttl) was returned.
536 The caller need parse the returned RR to get required information. This function is optional.
538 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
539 @param[in] QName Pointer to Query Name.
540 @param[in] QType Query Type.
541 @param[in] QClass Query Name.
542 @param[in] Token Point to the caller-allocated completion token to retrieve arbitrary information.
544 @retval EFI_SUCCESS The operation completed successfully.
545 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
546 @retval EFI_INVALID_PARAMETER This is NULL.
550 @retval EFI_NO_MAPPING There's no source address is available for use.
551 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
552 @retval EFI_UNSUPPORTED This function is not supported. Or the requested QType is not supported
558 IN EFI_DNS4_PROTOCOL
*This
,
562 IN EFI_DNS4_COMPLETION_TOKEN
*Token
567 DNS_INSTANCE
*Instance
;
569 EFI_DNS4_CONFIG_DATA
*ConfigData
;
571 DNS4_TOKEN_ENTRY
*TokenEntry
;
576 Status
= EFI_SUCCESS
;
581 // Validate the parameters
583 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
584 return EFI_INVALID_PARAMETER
;
587 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
589 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
591 ConfigData
= &(Instance
->Dns4CfgData
);
593 Instance
->MaxRetry
= ConfigData
->RetryCount
;
595 Token
->Status
= EFI_NOT_READY
;
596 Token
->RetryCount
= 0;
597 Token
->RetryInterval
= ConfigData
->RetryInterval
;
599 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
600 Status
= EFI_NOT_STARTED
;
605 // Check the MaxRetry and RetryInterval values.
607 if (Instance
->MaxRetry
== 0) {
608 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
611 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
612 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
616 // Construct DNS TokenEntry.
618 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
619 if (TokenEntry
== NULL
) {
620 Status
= EFI_OUT_OF_RESOURCES
;
624 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
625 TokenEntry
->GeneralLookUp
= TRUE
;
626 TokenEntry
->Token
= Token
;
629 // Construct DNS Query Packet.
631 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
632 if (EFI_ERROR (Status
)) {
633 if (TokenEntry
!= NULL
) {
634 FreePool (TokenEntry
);
640 ASSERT (Packet
!= NULL
);
643 // Save the token into the Dns4TxTokens map.
645 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
646 if (EFI_ERROR (Status
)) {
647 if (TokenEntry
!= NULL
) {
648 FreePool (TokenEntry
);
659 Status
= DoDnsQuery (Instance
, Packet
);
660 if (EFI_ERROR (Status
)) {
661 if (TokenEntry
!= NULL
) {
662 FreePool (TokenEntry
);
669 gBS
->RestoreTPL (OldTpl
);
674 This function is used to add/delete/modify DNS cache entry.
675 DNS cache can be normally dynamically updated after the DNS resolve succeeds.
676 This function provided capability to manually add/delete/modify the DNS cache.
678 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
679 @param[in] DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
680 If TRUE, this function will delete matching DNS Cache entry.
681 @param[in] Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
682 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
683 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
685 @retval EFI_SUCCESS The operation completed successfully.
686 @retval EFI_INVALID_PARAMETER This is NULL.
687 DnsCacheEntry.HostName is NULL.
688 DnsCacheEntry.IpAddress is NULL.
689 DnsCacheEntry.Timeout is zero.
690 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is not TRUE.
696 IN EFI_DNS4_PROTOCOL
*This
,
697 IN BOOLEAN DeleteFlag
,
699 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
705 Status
= EFI_SUCCESS
;
707 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
708 return EFI_INVALID_PARAMETER
;
711 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
714 // Update Dns4Cache here.
716 Status
= UpdateDns4Cache (&mDriverData
->Dns4CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
718 gBS
->RestoreTPL (OldTpl
);
724 This function can be used by network drivers and applications to increase the rate that data packets are moved between
725 the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed
726 network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets
727 without missing incoming packets or dropping outgoing packets.
729 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
731 @retval EFI_SUCCESS Incoming or outgoing data was processed.
732 @retval EFI_INVALID_PARAMETER This is NULL.
733 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
734 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
735 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
736 Consider increasing the polling rate.
742 IN EFI_DNS4_PROTOCOL
*This
745 DNS_INSTANCE
*Instance
;
746 EFI_UDP4_PROTOCOL
*Udp
;
749 return EFI_INVALID_PARAMETER
;
752 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
754 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
755 return EFI_NOT_STARTED
;
756 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
757 return EFI_DEVICE_ERROR
;
760 Udp
= Instance
->UdpIo
->Protocol
.Udp4
;
762 return Udp
->Poll (Udp
);
766 This function is used to abort a pending resolution request.
767 After calling this function, Token.Status will be set to EFI_ABORTED and then Token.
769 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
770 @param[in] Token Pointer to a token that has been issued by EFI_DNS4_PROTOCOL.HostNameToIp(),
771 EFI_DNS4_PROTOCOL.IpToHostName() or EFI_DNS4_PROTOCOL.GeneralLookup().
772 If NULL, all pending tokens are aborted.
774 @retval EFI_SUCCESS Incoming or outgoing data was processed.
775 @retval EFI_INVALID_PARAMETER This is NULL.
776 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
777 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS operation was not found in the transmit queue.
778 It was either completed or was not issued by HostNameToIp(), IpToHostName() or GeneralLookup().
784 IN EFI_DNS4_PROTOCOL
*This
,
785 IN EFI_DNS4_COMPLETION_TOKEN
*Token
789 DNS_INSTANCE
*Instance
;
793 return EFI_INVALID_PARAMETER
;
796 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
798 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
799 return EFI_NOT_STARTED
;
802 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
805 // Cancle the tokens specified by Token for this instance.
807 Status
= Dns4InstanceCancelToken (Instance
, Token
);
810 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
814 gBS
->RestoreTPL (OldTpl
);
820 This function is used to retrieve DNS mode data for this DNS instance.
822 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
823 @param[out] DnsModeData Pointer to the caller-allocated storage for the EFI_DNS6_MODE_DATA structure.
825 @retval EFI_SUCCESS The operation completed successfully.
826 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data is
827 available because this instance has not been configured.
828 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
829 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
835 IN EFI_DNS6_PROTOCOL
*This
,
836 OUT EFI_DNS6_MODE_DATA
*DnsModeData
839 DNS_INSTANCE
*Instance
;
848 DNS6_SERVER_IP
*ServerItem
;
849 EFI_IPv6_ADDRESS
*ServerList
;
850 DNS6_CACHE
*CacheItem
;
851 EFI_DNS6_CACHE_ENTRY
*CacheList
;
858 Status
= EFI_SUCCESS
;
860 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
861 return EFI_INVALID_PARAMETER
;
864 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
866 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
867 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
868 gBS
->RestoreTPL (OldTpl
);
869 return EFI_NOT_STARTED
;
872 ZeroMem (DnsModeData
, sizeof (EFI_DNS6_MODE_DATA
));
875 // Get the current configuration data of this instance.
877 Status
= Dns6CopyConfigure(&DnsModeData
->DnsConfigData
, &Instance
->Dns6CfgData
);
878 if (EFI_ERROR (Status
)) {
879 gBS
->RestoreTPL (OldTpl
);
884 // Get the DnsServerCount and DnsServerList
887 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
890 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
891 ServerList
= AllocatePool (sizeof(EFI_IPv6_ADDRESS
) * DnsModeData
->DnsServerCount
);
892 ASSERT (ServerList
!= NULL
);
894 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
895 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_SERVER_IP
, AllServerLink
);
896 CopyMem (ServerList
+ Index
, &ServerItem
->Dns6ServerIp
, sizeof (EFI_IPv6_ADDRESS
));
899 DnsModeData
->DnsServerList
= ServerList
;
902 // Get the DnsCacheCount and DnsCacheList
905 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
908 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
909 CacheList
= AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
910 ASSERT (CacheList
!= NULL
);
912 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
913 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
914 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS6_CACHE_ENTRY
));
917 DnsModeData
->DnsCacheList
= CacheList
;
919 gBS
->RestoreTPL (OldTpl
);
925 The function is used to set and change the configuration data for this EFI DNSv6 Protocol driver instance.
926 Reset the DNS instance if DnsConfigData is NULL.
928 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
929 @param[in] DnsConfigData Pointer to the configuration data structure.
930 All associated storage to be allocated and released by caller.
932 @retval EFI_SUCCESS The operation completed successfully.
933 @retval EFI_UNSUPPORTED The designated protocol is not supported.
934 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
935 @retval EFI_INVALID_PARAMETER This is NULL.
936 The StationIp address provided in DnsConfigData is not a valid unicast.
937 DnsServerList is NULL while DnsServerListCount is not equal to Zero.
938 DnsServerListCount is Zero while DnsServerList is not equal to NULL.
939 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI DNSv6 Protocol instance is not configured.
945 IN EFI_DNS6_PROTOCOL
*This
,
946 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
950 DNS_INSTANCE
*Instance
;
954 UINT32 ServerListCount
;
955 EFI_IPv6_ADDRESS
*ServerList
;
957 Status
= EFI_SUCCESS
;
961 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
962 (DnsConfigData
->DnsServerCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
963 return EFI_INVALID_PARAMETER
;
966 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
967 return EFI_UNSUPPORTED
;
970 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
972 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
974 if (DnsConfigData
== NULL
) {
975 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
978 // Reset the Instance if ConfigData is NULL
980 if (!NetMapIsEmpty(&Instance
->Dns6TxTokens
)) {
981 Dns6InstanceCancelToken(Instance
, NULL
);
984 Instance
->MaxRetry
= 0;
986 if (Instance
->UdpIo
!= NULL
){
987 UdpIoCleanIo (Instance
->UdpIo
);
990 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
991 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
993 ZeroMem (&Instance
->Dns6CfgData
, sizeof (EFI_DNS6_CONFIG_DATA
));
995 Instance
->State
= DNS_STATE_UNCONFIGED
;
998 // Configure the parameters for new operation.
1000 if (!NetIp6IsUnspecifiedAddr (&DnsConfigData
->StationIp
) && !NetIp6IsValidUnicast (&DnsConfigData
->StationIp
)) {
1001 Status
= EFI_INVALID_PARAMETER
;
1005 Status
= Dns6CopyConfigure (&Instance
->Dns6CfgData
, DnsConfigData
);
1006 if (EFI_ERROR (Status
)) {
1010 if (DnsConfigData
->DnsServerCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
1011 gBS
->RestoreTPL (OldTpl
);
1014 //The DNS instance will retrieve DNS server from DHCP Server.
1016 Status
= GetDns6ServerFromDhcp6 (
1017 Instance
->Service
->ImageHandle
,
1018 Instance
->Service
->ControllerHandle
,
1022 if (EFI_ERROR (Status
)) {
1026 ASSERT(ServerList
!= NULL
);
1028 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1030 CopyMem (&Instance
->SessionDnsServer
.v6
, &ServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1032 CopyMem (&Instance
->SessionDnsServer
.v6
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1038 Status
= Dns6ConfigUdp (Instance
, Instance
->UdpIo
);
1039 if (EFI_ERROR (Status
)) {
1040 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1041 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1047 // Add configured DNS server used by this instance to ServerList.
1049 Status
= AddDns6ServerIp (&mDriverData
->Dns6ServerList
, Instance
->SessionDnsServer
.v6
);
1050 if (EFI_ERROR (Status
)) {
1051 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1052 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1057 Instance
->State
= DNS_STATE_CONFIGED
;
1061 gBS
->RestoreTPL (OldTpl
);
1066 The function is used to translate the host name to host IP address.
1067 A type AAAA query is used to get the one or more IPv6 addresses for this host.
1069 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1070 @param[in] HostName Pointer to caller-supplied buffer containing Host name to be translated.
1071 This buffer contains 16 bit characters but these are translated to ASCII for use with
1072 DNSv4 server and there is no requirement for driver to support non-ASCII Unicode characters.
1073 @param[in] Token Pointer to the caller-allocated completion token to return at the completion of the process to translate host name to host address.
1075 @retval EFI_SUCCESS The operation completed successfully.
1076 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1077 @retval EFI_INVALID_PARAMETER This is NULL.
1081 @retval EFI_NO_MAPPING There's no source address is available for use.
1082 @retval EFI_NOT_STARTED This instance has not been started.
1088 IN EFI_DNS6_PROTOCOL
*This
,
1089 IN CHAR16
*HostName
,
1090 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1095 DNS_INSTANCE
*Instance
;
1097 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1106 DNS6_TOKEN_ENTRY
*TokenEntry
;
1111 Status
= EFI_SUCCESS
;
1118 // Validate the parameters
1120 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
1121 return EFI_INVALID_PARAMETER
;
1124 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1126 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1128 ConfigData
= &(Instance
->Dns6CfgData
);
1130 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1132 Token
->Status
= EFI_NOT_READY
;
1133 Token
->RetryCount
= 0;
1134 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1136 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1137 Status
= EFI_NOT_STARTED
;
1142 // Check the MaxRetry and RetryInterval values.
1144 if (Instance
->MaxRetry
== 0) {
1145 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1148 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1149 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1155 if (ConfigData
->EnableDnsCache
) {
1157 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1158 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1159 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1165 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS6_HOST_TO_ADDR_DATA
));
1166 if (Token
->RspData
.H2AData
== NULL
) {
1167 Status
= EFI_OUT_OF_RESOURCES
;
1171 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
1172 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv6_ADDRESS
) * Index
);
1173 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
1174 if (Token
->RspData
.H2AData
!= NULL
) {
1175 FreePool (Token
->RspData
.H2AData
);
1178 Status
= EFI_OUT_OF_RESOURCES
;
1183 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1184 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1185 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1186 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv6_ADDRESS
));
1191 Token
->Status
= EFI_SUCCESS
;
1193 if (Token
->Event
!= NULL
) {
1194 gBS
->SignalEvent (Token
->Event
);
1198 Status
= Token
->Status
;
1204 // Construct DNS TokenEntry.
1206 TokenEntry
= AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY
));
1207 if (TokenEntry
== NULL
) {
1208 Status
= EFI_OUT_OF_RESOURCES
;
1212 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1213 TokenEntry
->QueryHostName
= HostName
;
1214 TokenEntry
->Token
= Token
;
1220 QueryName
= DnsFillinQNameForQueryIp (TokenEntry
->QueryHostName
);
1221 if (QueryName
== NULL
) {
1222 Status
= EFI_OUT_OF_RESOURCES
;
1227 // Construct DNS Query Packet.
1229 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_AAAA
, DNS_CLASS_INET
, &Packet
);
1230 if (EFI_ERROR (Status
)) {
1231 if (TokenEntry
!= NULL
) {
1232 FreePool (TokenEntry
);
1238 ASSERT (Packet
!= NULL
);
1241 // Save the token into the Dns6TxTokens map.
1243 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1244 if (EFI_ERROR (Status
)) {
1245 if (TokenEntry
!= NULL
) {
1246 FreePool (TokenEntry
);
1249 NetbufFree (Packet
);
1257 Status
= DoDnsQuery (Instance
, Packet
);
1258 if (EFI_ERROR (Status
)) {
1259 if (TokenEntry
!= NULL
) {
1260 FreePool (TokenEntry
);
1263 NetbufFree (Packet
);
1267 if (QueryName
!= NULL
) {
1268 FreePool (QueryName
);
1271 gBS
->RestoreTPL (OldTpl
);
1276 The function is used to translate the host address to host name.
1277 A type PTR query is used to get the primary name of the host.
1279 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1280 @param[in] IpAddress IP address.
1281 @param[in] Token Pointer to the caller-allocated completion used token to translate host address to host name.
1283 @retval EFI_SUCCESS The operation completed successfully.
1284 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1285 @retval EFI_INVALID_PARAMETER This is NULL.
1287 Token.Event is NULL.
1288 IpAddress is not valid IP address.
1289 @retval EFI_NO_MAPPING There's no source address is available for use.
1290 @retval EFI_NOT_STARTED This instance has not been started.
1291 @retval EFI_UNSUPPORTED This function is not supported.
1297 IN EFI_DNS6_PROTOCOL
*This
,
1298 IN EFI_IPv6_ADDRESS IpAddress
,
1299 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1302 return EFI_UNSUPPORTED
;
1306 This function retrieves arbitrary information from the DNS.
1307 The caller supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned.
1308 All RR content (e.g., Ttl) was returned.
1309 The caller need parse the returned RR to get required information. This function is optional.
1311 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1312 @param[in] QName Pointer to Query Name.
1313 @param[in] QType Query Type.
1314 @param[in] QClass Query Name.
1315 @param[in] Token Point to the caller-allocated completion token to retrieve arbitrary information.
1317 @retval EFI_SUCCESS The operation completed successfully.
1318 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1319 @retval EFI_INVALID_PARAMETER This is NULL.
1321 Token.Event is NULL.
1323 @retval EFI_NO_MAPPING There's no source address is available for use.
1324 @retval EFI_NOT_STARTED This instance has not been started.
1325 @retval EFI_UNSUPPORTED This function is not supported. Or the requested QType is not supported
1331 IN EFI_DNS6_PROTOCOL
*This
,
1335 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1340 DNS_INSTANCE
*Instance
;
1342 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1344 DNS6_TOKEN_ENTRY
*TokenEntry
;
1349 Status
= EFI_SUCCESS
;
1354 // Validate the parameters
1356 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
1357 return EFI_INVALID_PARAMETER
;
1360 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1362 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1364 ConfigData
= &(Instance
->Dns6CfgData
);
1366 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1368 Token
->Status
= EFI_NOT_READY
;
1369 Token
->RetryCount
= 0;
1370 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1372 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1373 Status
= EFI_NOT_STARTED
;
1378 // Check the MaxRetry and RetryInterval values.
1380 if (Instance
->MaxRetry
== 0) {
1381 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1384 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1385 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1389 // Construct DNS TokenEntry.
1391 TokenEntry
= AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY
));
1392 if (TokenEntry
== NULL
) {
1393 Status
= EFI_OUT_OF_RESOURCES
;
1397 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1398 TokenEntry
->GeneralLookUp
= TRUE
;
1399 TokenEntry
->Token
= Token
;
1402 // Construct DNS Query Packet.
1404 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
1405 if (EFI_ERROR (Status
)) {
1406 if (TokenEntry
!= NULL
) {
1407 FreePool (TokenEntry
);
1413 ASSERT (Packet
!= NULL
);
1416 // Save the token into the Dns6TxTokens map.
1418 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1419 if (EFI_ERROR (Status
)) {
1420 if (TokenEntry
!= NULL
) {
1421 FreePool (TokenEntry
);
1424 NetbufFree (Packet
);
1432 Status
= DoDnsQuery (Instance
, Packet
);
1433 if (EFI_ERROR (Status
)) {
1434 if (TokenEntry
!= NULL
) {
1435 FreePool (TokenEntry
);
1438 NetbufFree (Packet
);
1442 gBS
->RestoreTPL (OldTpl
);
1447 This function is used to add/delete/modify DNS cache entry.
1448 DNS cache can be normally dynamically updated after the DNS resolve succeeds.
1449 This function provided capability to manually add/delete/modify the DNS cache.
1451 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1452 @param[in] DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
1453 If TRUE, this function will delete matching DNS Cache entry.
1454 @param[in] Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
1455 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
1456 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1458 @retval EFI_SUCCESS The operation completed successfully.
1459 @retval EFI_INVALID_PARAMETER This is NULL.
1460 DnsCacheEntry.HostName is NULL.
1461 DnsCacheEntry.IpAddress is NULL.
1462 DnsCacheEntry.Timeout is zero.
1463 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is not TRUE.
1468 Dns6UpdateDnsCache (
1469 IN EFI_DNS6_PROTOCOL
*This
,
1470 IN BOOLEAN DeleteFlag
,
1471 IN BOOLEAN Override
,
1472 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1478 Status
= EFI_SUCCESS
;
1480 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
1481 return EFI_INVALID_PARAMETER
;
1484 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1487 // Update Dns6Cache here.
1489 Status
= UpdateDns6Cache (&mDriverData
->Dns6CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
1491 gBS
->RestoreTPL (OldTpl
);
1497 This function can be used by network drivers and applications to increase the rate that data packets are moved between
1498 the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed
1499 network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets
1500 without missing incoming packets or dropping outgoing packets.
1502 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1504 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1505 @retval EFI_INVALID_PARAMETER This is NULL.
1506 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1507 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1508 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
1509 Consider increasing the polling rate.
1515 IN EFI_DNS6_PROTOCOL
*This
1518 DNS_INSTANCE
*Instance
;
1519 EFI_UDP6_PROTOCOL
*Udp
;
1522 return EFI_INVALID_PARAMETER
;
1525 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1527 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1528 return EFI_NOT_STARTED
;
1529 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
1530 return EFI_DEVICE_ERROR
;
1533 Udp
= Instance
->UdpIo
->Protocol
.Udp6
;
1535 return Udp
->Poll (Udp
);
1539 This function is used to abort a pending resolution request.
1540 After calling this function, Token.Status will be set to EFI_ABORTED and then Token.
1542 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1543 @param[in] Token Pointer to a token that has been issued by EFI_DNS6_PROTOCOL.HostNameToIp(),
1544 EFI_DNS6_PROTOCOL.IpToHostName() or EFI_DNS6_PROTOCOL.GeneralLookup().
1545 If NULL, all pending tokens are aborted.
1547 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1548 @retval EFI_INVALID_PARAMETER This is NULL.
1549 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1550 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS operation was not found in the transmit queue.
1551 It was either completed or was not issued by HostNameToIp(), IpToHostName() or GeneralLookup().
1557 IN EFI_DNS6_PROTOCOL
*This
,
1558 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1562 DNS_INSTANCE
*Instance
;
1566 return EFI_INVALID_PARAMETER
;
1569 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1571 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1572 return EFI_NOT_STARTED
;
1575 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1578 // Cancle the tokens specified by Token for this instance.
1580 Status
= Dns6InstanceCancelToken (Instance
, Token
);
1583 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
1587 gBS
->RestoreTPL (OldTpl
);