2 Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces.
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.
17 EFI_DNS4_PROTOCOL mDns4Protocol
= {
28 EFI_DNS6_PROTOCOL mDns6Protocol
= {
40 Retrieve mode data of this DNS instance.
42 This function is used to retrieve DNS mode data for this DNS instance.
44 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
45 @param[out] DnsModeData Point to the mode data.
47 @retval EFI_SUCCESS The operation completed successfully.
48 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
49 is available because this instance has not been
51 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
52 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
57 IN EFI_DNS4_PROTOCOL
*This
,
58 OUT EFI_DNS4_MODE_DATA
*DnsModeData
61 DNS_INSTANCE
*Instance
;
70 DNS4_SERVER_IP
*ServerItem
;
71 EFI_IPv4_ADDRESS
*ServerList
;
72 DNS4_CACHE
*CacheItem
;
73 EFI_DNS4_CACHE_ENTRY
*CacheList
;
83 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
84 return EFI_INVALID_PARAMETER
;
87 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
89 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
90 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
91 Status
= EFI_NOT_STARTED
;
95 ZeroMem (DnsModeData
, sizeof (EFI_DNS4_MODE_DATA
));
98 // Get the current configuration data of this instance.
100 Status
= Dns4CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns4CfgData
);
101 if (EFI_ERROR (Status
)) {
106 // Get the DnsServerCount and DnsServerList
109 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
112 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
113 ServerList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * DnsModeData
->DnsServerCount
);
114 if (ServerList
== NULL
) {
115 Status
= EFI_OUT_OF_RESOURCES
;
116 Dns4CleanConfigure (&DnsModeData
->DnsConfigData
);
121 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
122 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_SERVER_IP
, AllServerLink
);
123 CopyMem (ServerList
+ Index
, &ServerItem
->Dns4ServerIp
, sizeof (EFI_IPv4_ADDRESS
));
126 DnsModeData
->DnsServerList
= ServerList
;
129 // Get the DnsCacheCount and DnsCacheList
132 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
135 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
136 CacheList
= AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
137 if (CacheList
== NULL
) {
138 Status
= EFI_OUT_OF_RESOURCES
;
139 Dns4CleanConfigure (&DnsModeData
->DnsConfigData
);
140 FreePool (ServerList
);
145 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
146 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
147 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS4_CACHE_ENTRY
));
150 DnsModeData
->DnsCacheList
= CacheList
;
153 gBS
->RestoreTPL (OldTpl
);
158 Configure this DNS instance.
160 This function is used to configure DNS mode data for this DNS instance.
162 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
163 @param[in] DnsConfigData Point to the Configuration data.
165 @retval EFI_SUCCESS The operation completed successfully.
166 @retval EFI_UNSUPPORTED The designated protocol is not supported.
167 @retval EFI_INVALID_PARAMTER Thisis NULL.
168 The StationIp address provided in DnsConfigData is not a
170 DnsServerList is NULL while DnsServerListCount
172 DnsServerListCount is ZERO while DnsServerList
174 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
176 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
177 EFI DNSv4 Protocol instance is not configured.
178 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
179 reconfigure the instance the caller must call Configure()
180 with NULL first to return driver to unconfigured state.
185 IN EFI_DNS4_PROTOCOL
*This
,
186 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
190 DNS_INSTANCE
*Instance
;
196 UINT32 ServerListCount
;
197 EFI_IPv4_ADDRESS
*ServerList
;
199 Status
= EFI_SUCCESS
;
203 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerListCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
204 (DnsConfigData
->DnsServerListCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
205 return EFI_INVALID_PARAMETER
;
208 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
209 return EFI_UNSUPPORTED
;
212 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
214 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
216 if (DnsConfigData
== NULL
) {
217 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
220 // Reset the Instance if ConfigData is NULL
222 if (!NetMapIsEmpty(&Instance
->Dns4TxTokens
)) {
223 Dns4InstanceCancelToken(Instance
, NULL
);
226 Instance
->MaxRetry
= 0;
228 if (Instance
->UdpIo
!= NULL
){
229 UdpIoCleanIo (Instance
->UdpIo
);
232 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
233 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
235 ZeroMem (&Instance
->Dns4CfgData
, sizeof (EFI_DNS4_CONFIG_DATA
));
237 Instance
->State
= DNS_STATE_UNCONFIGED
;
240 // Configure the parameters for new operation.
242 CopyMem (&Ip
, &DnsConfigData
->StationIp
, sizeof (IP4_ADDR
));
243 CopyMem (&Netmask
, &DnsConfigData
->SubnetMask
, sizeof (IP4_ADDR
));
246 Netmask
= NTOHL (Netmask
);
248 if (!DnsConfigData
->UseDefaultSetting
&&
249 ((!IP4_IS_VALID_NETMASK (Netmask
) || !NetIp4IsUnicast (Ip
, Netmask
)))) {
250 Status
= EFI_INVALID_PARAMETER
;
254 Status
= Dns4CopyConfigure (&Instance
->Dns4CfgData
, DnsConfigData
);
255 if (EFI_ERROR (Status
)) {
259 if (DnsConfigData
->DnsServerListCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
260 gBS
->RestoreTPL (OldTpl
);
263 // The DNS instance will retrieve DNS server from DHCP Server
265 Status
= GetDns4ServerFromDhcp4 (
270 if (EFI_ERROR (Status
)) {
274 ASSERT(ServerList
!= NULL
);
276 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
278 CopyMem (&Instance
->SessionDnsServer
.v4
, &ServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
280 CopyMem (&Instance
->SessionDnsServer
.v4
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
286 Status
= Dns4ConfigUdp (Instance
, Instance
->UdpIo
);
287 if (EFI_ERROR (Status
)) {
288 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
289 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
295 // Add configured DNS server used by this instance to ServerList.
297 Status
= AddDns4ServerIp (&mDriverData
->Dns4ServerList
, Instance
->SessionDnsServer
.v4
);
298 if (EFI_ERROR (Status
)) {
299 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
300 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
305 Instance
->State
= DNS_STATE_CONFIGED
;
309 gBS
->RestoreTPL (OldTpl
);
314 Host name to host address translation.
316 The HostNameToIp () function is used to translate the host name to host IP address. A
317 type A query is used to get the one or more IP addresses for this host.
319 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
320 @param[in] HostName Host name.
321 @param[in] Token Point to the completion token to translate host name
324 @retval EFI_SUCCESS The operation completed successfully.
325 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
329 HostName is NULL. HostName string is unsupported format.
330 @retval EFI_NO_MAPPING There's no source address is available for use.
331 @retval EFI_NOT_STARTED This instance has not been started.
336 IN EFI_DNS4_PROTOCOL
*This
,
338 IN EFI_DNS4_COMPLETION_TOKEN
*Token
343 DNS_INSTANCE
*Instance
;
345 EFI_DNS4_CONFIG_DATA
*ConfigData
;
354 DNS4_TOKEN_ENTRY
*TokenEntry
;
359 Status
= EFI_SUCCESS
;
366 // Validate the parameters
368 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
369 return EFI_INVALID_PARAMETER
;
372 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
374 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
376 ConfigData
= &(Instance
->Dns4CfgData
);
378 Instance
->MaxRetry
= ConfigData
->RetryCount
;
380 Token
->Status
= EFI_NOT_READY
;
381 Token
->RetryCount
= 0;
382 Token
->RetryInterval
= ConfigData
->RetryInterval
;
384 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
385 Status
= EFI_NOT_STARTED
;
390 // Check the MaxRetry and RetryInterval values.
392 if (Instance
->MaxRetry
== 0) {
393 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
396 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
397 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
403 if (ConfigData
->EnableDnsCache
) {
405 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
406 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
407 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
413 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS_HOST_TO_ADDR_DATA
));
414 if (Token
->RspData
.H2AData
== NULL
) {
415 Status
= EFI_OUT_OF_RESOURCES
;
419 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
420 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * Index
);
421 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
422 if (Token
->RspData
.H2AData
!= NULL
) {
423 FreePool (Token
->RspData
.H2AData
);
426 Status
= EFI_OUT_OF_RESOURCES
;
431 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
432 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
433 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
434 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv4_ADDRESS
));
439 Token
->Status
= EFI_SUCCESS
;
441 if (Token
->Event
!= NULL
) {
442 gBS
->SignalEvent (Token
->Event
);
446 Status
= Token
->Status
;
452 // Construct DNS TokenEntry.
454 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
455 if (TokenEntry
== NULL
) {
456 Status
= EFI_OUT_OF_RESOURCES
;
460 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
461 TokenEntry
->QueryHostName
= HostName
;
462 TokenEntry
->Token
= Token
;
467 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
468 if (QueryName
== NULL
) {
469 Status
= EFI_OUT_OF_RESOURCES
;
474 // Construct DNS Query Packet.
476 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_A
, DNS_CLASS_INET
, &Packet
);
477 if (EFI_ERROR (Status
)) {
478 if (TokenEntry
!= NULL
) {
479 FreePool (TokenEntry
);
485 ASSERT (Packet
!= NULL
);
488 // Save the token into the Dns4TxTokens map.
490 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
491 if (EFI_ERROR (Status
)) {
492 if (TokenEntry
!= NULL
) {
493 FreePool (TokenEntry
);
504 Status
= DoDnsQuery (Instance
, Packet
);
505 if (EFI_ERROR (Status
)) {
506 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
508 if (TokenEntry
!= NULL
) {
509 FreePool (TokenEntry
);
516 if (QueryName
!= NULL
) {
517 FreePool (QueryName
);
520 gBS
->RestoreTPL (OldTpl
);
525 IPv4 address to host name translation also known as Reverse DNS lookup.
527 The IpToHostName() function is used to translate the host address to host name. A type PTR
528 query is used to get the primary name of the host. Support of this function is optional.
530 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
531 @param[in] IpAddress Ip Address.
532 @param[in] Token Point to the completion token to translate host
533 address to host name.
535 @retval EFI_SUCCESS The operation completed successfully.
536 @retval EFI_UNSUPPORTED This function is not supported.
537 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
541 IpAddress is not valid IP address .
542 @retval EFI_NO_MAPPING There's no source address is available for use.
543 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
544 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
549 IN EFI_DNS4_PROTOCOL
*This
,
550 IN EFI_IPv4_ADDRESS IpAddress
,
551 IN EFI_DNS4_COMPLETION_TOKEN
*Token
554 return EFI_UNSUPPORTED
;
558 Retrieve arbitrary information from the DNS server.
560 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
561 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
562 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
563 required information. The function is optional.
565 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
566 @param[in] QName Pointer to Query Name.
567 @param[in] QType Query Type.
568 @param[in] QClass Query Name.
569 @param[in] Token Point to the completion token to retrieve arbitrary
572 @retval EFI_SUCCESS The operation completed successfully.
573 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
574 QType is not supported
575 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
580 @retval EFI_NO_MAPPING There's no source address is available for use.
581 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
582 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
587 IN EFI_DNS4_PROTOCOL
*This
,
591 IN EFI_DNS4_COMPLETION_TOKEN
*Token
596 DNS_INSTANCE
*Instance
;
598 EFI_DNS4_CONFIG_DATA
*ConfigData
;
600 DNS4_TOKEN_ENTRY
*TokenEntry
;
605 Status
= EFI_SUCCESS
;
610 // Validate the parameters
612 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
613 return EFI_INVALID_PARAMETER
;
616 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
618 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
620 ConfigData
= &(Instance
->Dns4CfgData
);
622 Instance
->MaxRetry
= ConfigData
->RetryCount
;
624 Token
->Status
= EFI_NOT_READY
;
625 Token
->RetryCount
= 0;
626 Token
->RetryInterval
= ConfigData
->RetryInterval
;
628 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
629 Status
= EFI_NOT_STARTED
;
634 // Check the MaxRetry and RetryInterval values.
636 if (Instance
->MaxRetry
== 0) {
637 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
640 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
641 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
645 // Construct DNS TokenEntry.
647 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
648 if (TokenEntry
== NULL
) {
649 Status
= EFI_OUT_OF_RESOURCES
;
653 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
654 TokenEntry
->GeneralLookUp
= TRUE
;
655 TokenEntry
->Token
= Token
;
658 // Construct DNS Query Packet.
660 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
661 if (EFI_ERROR (Status
)) {
662 if (TokenEntry
!= NULL
) {
663 FreePool (TokenEntry
);
669 ASSERT (Packet
!= NULL
);
672 // Save the token into the Dns4TxTokens map.
674 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
675 if (EFI_ERROR (Status
)) {
676 if (TokenEntry
!= NULL
) {
677 FreePool (TokenEntry
);
688 Status
= DoDnsQuery (Instance
, Packet
);
689 if (EFI_ERROR (Status
)) {
690 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
692 if (TokenEntry
!= NULL
) {
693 FreePool (TokenEntry
);
700 gBS
->RestoreTPL (OldTpl
);
705 This function is to update the DNS Cache.
707 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
708 can be normally dynamically updated after the DNS resolve succeeds. This function
709 provided capability to manually add/delete/modify the DNS cache.
711 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
712 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
713 DNS Cahce. If TRUE, this function will delete
714 matching DNS Cache entry.
715 @param[in] Override If TRUE, the maching DNS cache entry will be
716 overwritten with the supplied parameter. If FALSE,
717 EFI_ACCESS_DENIED will be returned if the entry to
718 be added is already existed.
719 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
721 @retval EFI_SUCCESS The operation completed successfully.
722 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
724 DnsCacheEntry.HostName is NULL.
725 DnsCacheEntry.IpAddress is NULL.
726 DnsCacheEntry.Timeout is zero.
727 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
733 IN EFI_DNS4_PROTOCOL
*This
,
734 IN BOOLEAN DeleteFlag
,
736 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
742 Status
= EFI_SUCCESS
;
744 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
745 return EFI_INVALID_PARAMETER
;
748 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
751 // Update Dns4Cache here.
753 Status
= UpdateDns4Cache (&mDriverData
->Dns4CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
755 gBS
->RestoreTPL (OldTpl
);
761 Polls for incoming data packets and processes outgoing data packets.
763 The Poll() function can be used by network drivers and applications to increase the
764 rate that data packets are moved between the communications device and the transmit
766 In some systems, the periodic timer event in the managed network driver may not poll
767 the underlying communications device fast enough to transmit and/or receive all data
768 packets without missing incoming packets or dropping outgoing packets. Drivers and
769 applications that are experiencing packet loss should try calling the Poll()
772 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
774 @retval EFI_SUCCESS Incoming or outgoing data was processed.
775 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
776 @retval EFI_INVALID_PARAMETER This is NULL.
777 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
778 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
779 queue. Consider increasing the polling rate.
784 IN EFI_DNS4_PROTOCOL
*This
787 DNS_INSTANCE
*Instance
;
788 EFI_UDP4_PROTOCOL
*Udp
;
791 return EFI_INVALID_PARAMETER
;
794 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
796 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
797 return EFI_NOT_STARTED
;
798 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
799 return EFI_DEVICE_ERROR
;
802 Udp
= Instance
->UdpIo
->Protocol
.Udp4
;
804 return Udp
->Poll (Udp
);
808 Abort an asynchronous DNS operation, including translation between IP and Host, and
809 general look up behavior.
811 The Cancel() function is used to abort a pending resolution request. After calling
812 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
813 signaled. If the token is not in one of the queues, which usually means that the
814 asynchronous operation has completed, this function will not signal the token and
815 EFI_NOT_FOUND is returned.
817 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
818 @param[in] Token Pointer to a token that has been issued by
819 EFI_DNS4_PROTOCOL.HostNameToIp (),
820 EFI_DNS4_PROTOCOL.IpToHostName() or
821 EFI_DNS4_PROTOCOL.GeneralLookup().
822 If NULL, all pending tokens are aborted.
824 @retval EFI_SUCCESS Incoming or outgoing data was processed.
825 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
826 @retval EFI_INVALID_PARAMETER This is NULL.
827 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
828 operation was not found in the transmit queue. It
829 was either completed or was not issued by
830 HostNameToIp(), IpToHostName() or GeneralLookup().
835 IN EFI_DNS4_PROTOCOL
*This
,
836 IN EFI_DNS4_COMPLETION_TOKEN
*Token
840 DNS_INSTANCE
*Instance
;
844 return EFI_INVALID_PARAMETER
;
847 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
849 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
850 return EFI_NOT_STARTED
;
853 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
856 // Cancle the tokens specified by Token for this instance.
858 Status
= Dns4InstanceCancelToken (Instance
, Token
);
861 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
865 gBS
->RestoreTPL (OldTpl
);
871 Retrieve mode data of this DNS instance.
873 This function is used to retrieve DNS mode data for this DNS instance.
875 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
876 @param[out] DnsModeData Pointer to the caller-allocated storage for the
877 EFI_DNS6_MODE_DATA data.
879 @retval EFI_SUCCESS The operation completed successfully.
880 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
881 is available because this instance has not been
883 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
884 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
889 IN EFI_DNS6_PROTOCOL
*This
,
890 OUT EFI_DNS6_MODE_DATA
*DnsModeData
893 DNS_INSTANCE
*Instance
;
902 DNS6_SERVER_IP
*ServerItem
;
903 EFI_IPv6_ADDRESS
*ServerList
;
904 DNS6_CACHE
*CacheItem
;
905 EFI_DNS6_CACHE_ENTRY
*CacheList
;
912 Status
= EFI_SUCCESS
;
914 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
915 return EFI_INVALID_PARAMETER
;
918 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
920 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
921 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
922 Status
= EFI_NOT_STARTED
;
926 ZeroMem (DnsModeData
, sizeof (EFI_DNS6_MODE_DATA
));
929 // Get the current configuration data of this instance.
931 Status
= Dns6CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns6CfgData
);
932 if (EFI_ERROR (Status
)) {
937 // Get the DnsServerCount and DnsServerList
940 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
943 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
944 ServerList
= AllocatePool (sizeof(EFI_IPv6_ADDRESS
) * DnsModeData
->DnsServerCount
);
945 if (ServerList
== NULL
) {
946 Status
= EFI_OUT_OF_RESOURCES
;
947 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
952 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
953 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_SERVER_IP
, AllServerLink
);
954 CopyMem (ServerList
+ Index
, &ServerItem
->Dns6ServerIp
, sizeof (EFI_IPv6_ADDRESS
));
957 DnsModeData
->DnsServerList
= ServerList
;
960 // Get the DnsCacheCount and DnsCacheList
963 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
966 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
967 CacheList
= AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
968 if (CacheList
== NULL
) {
969 Status
= EFI_OUT_OF_RESOURCES
;
970 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
971 FreePool (ServerList
);
976 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
977 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
978 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS6_CACHE_ENTRY
));
981 DnsModeData
->DnsCacheList
= CacheList
;
984 gBS
->RestoreTPL (OldTpl
);
989 Configure this DNS instance.
991 The Configure() function is used to set and change the configuration data for this
992 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
994 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
995 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
996 storage to be allocated and released by caller.
998 @retval EFI_SUCCESS The operation completed successfully.
999 @retval EFI_INVALID_PARAMTER This is NULL.
1000 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
1001 DnsServerList is NULL while DnsServerList Count is not ZERO.
1002 DnsServerList Count is ZERO while DnsServerList is not NULL.
1003 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
1004 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
1005 EFI DNSv6 Protocol instance is not configured.
1006 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1007 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1008 reconfigure the instance the caller must call Configure() with
1009 NULL first to return driver to unconfigured state.
1014 IN EFI_DNS6_PROTOCOL
*This
,
1015 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1019 DNS_INSTANCE
*Instance
;
1023 UINT32 ServerListCount
;
1024 EFI_IPv6_ADDRESS
*ServerList
;
1026 Status
= EFI_SUCCESS
;
1030 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
1031 (DnsConfigData
->DnsServerCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
1032 return EFI_INVALID_PARAMETER
;
1035 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
1036 return EFI_UNSUPPORTED
;
1039 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1041 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1043 if (DnsConfigData
== NULL
) {
1044 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
1047 // Reset the Instance if ConfigData is NULL
1049 if (!NetMapIsEmpty(&Instance
->Dns6TxTokens
)) {
1050 Dns6InstanceCancelToken(Instance
, NULL
);
1053 Instance
->MaxRetry
= 0;
1055 if (Instance
->UdpIo
!= NULL
){
1056 UdpIoCleanIo (Instance
->UdpIo
);
1059 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1060 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1062 ZeroMem (&Instance
->Dns6CfgData
, sizeof (EFI_DNS6_CONFIG_DATA
));
1064 Instance
->State
= DNS_STATE_UNCONFIGED
;
1067 // Configure the parameters for new operation.
1069 if (!NetIp6IsUnspecifiedAddr (&DnsConfigData
->StationIp
) && !NetIp6IsValidUnicast (&DnsConfigData
->StationIp
)) {
1070 Status
= EFI_INVALID_PARAMETER
;
1074 Status
= Dns6CopyConfigure (&Instance
->Dns6CfgData
, DnsConfigData
);
1075 if (EFI_ERROR (Status
)) {
1079 if (DnsConfigData
->DnsServerCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
1080 gBS
->RestoreTPL (OldTpl
);
1083 //The DNS instance will retrieve DNS server from DHCP Server.
1085 Status
= GetDns6ServerFromDhcp6 (
1086 Instance
->Service
->ImageHandle
,
1087 Instance
->Service
->ControllerHandle
,
1091 if (EFI_ERROR (Status
)) {
1095 ASSERT(ServerList
!= NULL
);
1097 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1099 CopyMem (&Instance
->SessionDnsServer
.v6
, &ServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1101 CopyMem (&Instance
->SessionDnsServer
.v6
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1107 Status
= Dns6ConfigUdp (Instance
, Instance
->UdpIo
);
1108 if (EFI_ERROR (Status
)) {
1109 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1110 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1116 // Add configured DNS server used by this instance to ServerList.
1118 Status
= AddDns6ServerIp (&mDriverData
->Dns6ServerList
, Instance
->SessionDnsServer
.v6
);
1119 if (EFI_ERROR (Status
)) {
1120 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1121 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1126 Instance
->State
= DNS_STATE_CONFIGED
;
1130 gBS
->RestoreTPL (OldTpl
);
1135 Host name to host address translation.
1137 The HostNameToIp () function is used to translate the host name to host IP address. A
1138 type AAAA query is used to get the one or more IPv6 addresses for this host.
1140 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1141 @param[in] HostName Host name.
1142 @param[in] Token Point to the completion token to translate host name
1145 @retval EFI_SUCCESS The operation completed successfully.
1146 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1149 Token.Event is NULL.
1150 HostName is NULL or buffer contained unsupported characters.
1151 @retval EFI_NO_MAPPING There's no source address is available for use.
1152 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1153 @retval EFI_NOT_STARTED This instance has not been started.
1154 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1159 IN EFI_DNS6_PROTOCOL
*This
,
1160 IN CHAR16
*HostName
,
1161 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1166 DNS_INSTANCE
*Instance
;
1168 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1177 DNS6_TOKEN_ENTRY
*TokenEntry
;
1182 Status
= EFI_SUCCESS
;
1189 // Validate the parameters
1191 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
1192 return EFI_INVALID_PARAMETER
;
1195 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1197 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1199 ConfigData
= &(Instance
->Dns6CfgData
);
1201 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1203 Token
->Status
= EFI_NOT_READY
;
1204 Token
->RetryCount
= 0;
1205 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1207 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1208 Status
= EFI_NOT_STARTED
;
1213 // Check the MaxRetry and RetryInterval values.
1215 if (Instance
->MaxRetry
== 0) {
1216 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1219 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1220 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1226 if (ConfigData
->EnableDnsCache
) {
1228 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1229 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1230 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1236 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS6_HOST_TO_ADDR_DATA
));
1237 if (Token
->RspData
.H2AData
== NULL
) {
1238 Status
= EFI_OUT_OF_RESOURCES
;
1242 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
1243 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv6_ADDRESS
) * Index
);
1244 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
1245 if (Token
->RspData
.H2AData
!= NULL
) {
1246 FreePool (Token
->RspData
.H2AData
);
1249 Status
= EFI_OUT_OF_RESOURCES
;
1254 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1255 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1256 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1257 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv6_ADDRESS
));
1262 Token
->Status
= EFI_SUCCESS
;
1264 if (Token
->Event
!= NULL
) {
1265 gBS
->SignalEvent (Token
->Event
);
1269 Status
= Token
->Status
;
1275 // Construct DNS TokenEntry.
1277 TokenEntry
= AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY
));
1278 if (TokenEntry
== NULL
) {
1279 Status
= EFI_OUT_OF_RESOURCES
;
1283 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1284 TokenEntry
->QueryHostName
= HostName
;
1285 TokenEntry
->Token
= Token
;
1291 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
1292 if (QueryName
== NULL
) {
1293 Status
= EFI_OUT_OF_RESOURCES
;
1298 // Construct DNS Query Packet.
1300 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_AAAA
, DNS_CLASS_INET
, &Packet
);
1301 if (EFI_ERROR (Status
)) {
1302 if (TokenEntry
!= NULL
) {
1303 FreePool (TokenEntry
);
1309 ASSERT (Packet
!= NULL
);
1312 // Save the token into the Dns6TxTokens map.
1314 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1315 if (EFI_ERROR (Status
)) {
1316 if (TokenEntry
!= NULL
) {
1317 FreePool (TokenEntry
);
1320 NetbufFree (Packet
);
1328 Status
= DoDnsQuery (Instance
, Packet
);
1329 if (EFI_ERROR (Status
)) {
1330 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1332 if (TokenEntry
!= NULL
) {
1333 FreePool (TokenEntry
);
1336 NetbufFree (Packet
);
1340 if (QueryName
!= NULL
) {
1341 FreePool (QueryName
);
1344 gBS
->RestoreTPL (OldTpl
);
1349 Host address to host name translation.
1351 The IpToHostName () function is used to translate the host address to host name. A
1352 type PTR query is used to get the primary name of the host. Implementation can choose
1353 to support this function or not.
1355 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1356 @param[in] IpAddress Ip Address.
1357 @param[in] Token Point to the completion token to translate host
1358 address to host name.
1360 @retval EFI_SUCCESS The operation completed successfully.
1361 @retval EFI_UNSUPPORTED This function is not supported.
1362 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1365 Token.Event is NULL.
1366 IpAddress is not valid IP address.
1367 @retval EFI_NO_MAPPING There's no source address is available for use.
1368 @retval EFI_NOT_STARTED This instance has not been started.
1369 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1374 IN EFI_DNS6_PROTOCOL
*This
,
1375 IN EFI_IPv6_ADDRESS IpAddress
,
1376 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1379 return EFI_UNSUPPORTED
;
1383 This function provides capability to retrieve arbitrary information from the DNS
1386 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1387 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1388 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1389 required information. The function is optional. Implementation can choose to support
1392 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1393 @param[in] QName Pointer to Query Name.
1394 @param[in] QType Query Type.
1395 @param[in] QClass Query Name.
1396 @param[in] Token Point to the completion token to retrieve arbitrary
1399 @retval EFI_SUCCESS The operation completed successfully.
1400 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1401 QType is not supported
1402 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1405 Token.Event is NULL.
1407 @retval EFI_NO_MAPPING There's no source address is available for use.
1408 @retval EFI_NOT_STARTED This instance has not been started.
1409 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1414 IN EFI_DNS6_PROTOCOL
*This
,
1418 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1423 DNS_INSTANCE
*Instance
;
1425 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1427 DNS6_TOKEN_ENTRY
*TokenEntry
;
1432 Status
= EFI_SUCCESS
;
1437 // Validate the parameters
1439 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
1440 return EFI_INVALID_PARAMETER
;
1443 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1445 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1447 ConfigData
= &(Instance
->Dns6CfgData
);
1449 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1451 Token
->Status
= EFI_NOT_READY
;
1452 Token
->RetryCount
= 0;
1453 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1455 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1456 Status
= EFI_NOT_STARTED
;
1461 // Check the MaxRetry and RetryInterval values.
1463 if (Instance
->MaxRetry
== 0) {
1464 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1467 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1468 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1472 // Construct DNS TokenEntry.
1474 TokenEntry
= AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY
));
1475 if (TokenEntry
== NULL
) {
1476 Status
= EFI_OUT_OF_RESOURCES
;
1480 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1481 TokenEntry
->GeneralLookUp
= TRUE
;
1482 TokenEntry
->Token
= Token
;
1485 // Construct DNS Query Packet.
1487 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
1488 if (EFI_ERROR (Status
)) {
1489 if (TokenEntry
!= NULL
) {
1490 FreePool (TokenEntry
);
1496 ASSERT (Packet
!= NULL
);
1499 // Save the token into the Dns6TxTokens map.
1501 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1502 if (EFI_ERROR (Status
)) {
1503 if (TokenEntry
!= NULL
) {
1504 FreePool (TokenEntry
);
1507 NetbufFree (Packet
);
1515 Status
= DoDnsQuery (Instance
, Packet
);
1516 if (EFI_ERROR (Status
)) {
1517 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1519 if (TokenEntry
!= NULL
) {
1520 FreePool (TokenEntry
);
1523 NetbufFree (Packet
);
1527 gBS
->RestoreTPL (OldTpl
);
1532 This function is to update the DNS Cache.
1534 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1535 can be normally dynamically updated after the DNS resolve succeeds. This function
1536 provided capability to manually add/delete/modify the DNS cache.
1538 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1539 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1540 DNS Cahce. If TRUE, this function will delete
1541 matching DNS Cache entry.
1542 @param[in] Override If TRUE, the maching DNS cache entry will be
1543 overwritten with the supplied parameter. If FALSE,
1544 EFI_ACCESS_DENIED will be returned if the entry to
1545 be added is already existed.
1546 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1548 @retval EFI_SUCCESS The operation completed successfully.
1549 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1551 DnsCacheEntry.HostName is NULL.
1552 DnsCacheEntry.IpAddress is NULL.
1553 DnsCacheEntry.Timeout is zero.
1554 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1556 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1560 Dns6UpdateDnsCache (
1561 IN EFI_DNS6_PROTOCOL
*This
,
1562 IN BOOLEAN DeleteFlag
,
1563 IN BOOLEAN Override
,
1564 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1570 Status
= EFI_SUCCESS
;
1572 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
1573 return EFI_INVALID_PARAMETER
;
1576 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1579 // Update Dns6Cache here.
1581 Status
= UpdateDns6Cache (&mDriverData
->Dns6CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
1583 gBS
->RestoreTPL (OldTpl
);
1589 Polls for incoming data packets and processes outgoing data packets.
1591 The Poll() function can be used by network drivers and applications to increase the
1592 rate that data packets are moved between the communications device and the transmit
1595 In some systems, the periodic timer event in the managed network driver may not poll
1596 the underlying communications device fast enough to transmit and/or receive all data
1597 packets without missing incoming packets or dropping outgoing packets. Drivers and
1598 applications that are experiencing packet loss should try calling the Poll()
1599 function more often.
1601 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1603 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1604 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1605 @retval EFI_INVALID_PARAMETER This is NULL.
1606 @retval EFI_NO_MAPPING There is no source address is available for use.
1607 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1608 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1609 queue. Consider increasing the polling rate.
1614 IN EFI_DNS6_PROTOCOL
*This
1617 DNS_INSTANCE
*Instance
;
1618 EFI_UDP6_PROTOCOL
*Udp
;
1621 return EFI_INVALID_PARAMETER
;
1624 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1626 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1627 return EFI_NOT_STARTED
;
1628 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
1629 return EFI_DEVICE_ERROR
;
1632 Udp
= Instance
->UdpIo
->Protocol
.Udp6
;
1634 return Udp
->Poll (Udp
);
1638 Abort an asynchronous DNS operation, including translation between IP and Host, and
1639 general look up behavior.
1641 The Cancel() function is used to abort a pending resolution request. After calling
1642 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1643 signaled. If the token is not in one of the queues, which usually means that the
1644 asynchronous operation has completed, this function will not signal the token and
1645 EFI_NOT_FOUND is returned.
1647 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1648 @param[in] Token Pointer to a token that has been issued by
1649 EFI_DNS6_PROTOCOL.HostNameToIp (),
1650 EFI_DNS6_PROTOCOL.IpToHostName() or
1651 EFI_DNS6_PROTOCOL.GeneralLookup().
1652 If NULL, all pending tokens are aborted.
1654 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1655 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1656 @retval EFI_INVALID_PARAMETER This is NULL.
1657 @retval EFI_NO_MAPPING There's no source address is available for use.
1658 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1659 operation was not found in the transmit queue. It
1660 was either completed or was not issued by
1661 HostNameToIp(), IpToHostName() or GeneralLookup().
1666 IN EFI_DNS6_PROTOCOL
*This
,
1667 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1671 DNS_INSTANCE
*Instance
;
1675 return EFI_INVALID_PARAMETER
;
1678 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1680 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1681 return EFI_NOT_STARTED
;
1684 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1687 // Cancle the tokens specified by Token for this instance.
1689 Status
= Dns6InstanceCancelToken (Instance
, Token
);
1692 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
1696 gBS
->RestoreTPL (OldTpl
);