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 gBS
->RestoreTPL (OldTpl
);
92 return 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
)) {
102 gBS
->RestoreTPL (OldTpl
);
107 // Get the DnsServerCount and DnsServerList
110 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
113 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
114 ServerList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * DnsModeData
->DnsServerCount
);
115 ASSERT (ServerList
!= NULL
);
117 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
118 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_SERVER_IP
, AllServerLink
);
119 CopyMem (ServerList
+ Index
, &ServerItem
->Dns4ServerIp
, sizeof (EFI_IPv4_ADDRESS
));
122 DnsModeData
->DnsServerList
= ServerList
;
125 // Get the DnsCacheCount and DnsCacheList
128 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
131 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
132 CacheList
= AllocatePool (sizeof (EFI_DNS4_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
133 ASSERT (CacheList
!= NULL
);
135 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
136 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
137 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS4_CACHE_ENTRY
));
140 DnsModeData
->DnsCacheList
= CacheList
;
142 gBS
->RestoreTPL (OldTpl
);
148 Configure this DNS instance.
150 This function is used to configure DNS mode data for this DNS instance.
152 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
153 @param[in] DnsConfigData Point to the Configuration data.
155 @retval EFI_SUCCESS The operation completed successfully.
156 @retval EFI_UNSUPPORTED The designated protocol is not supported.
157 @retval EFI_INVALID_PARAMTER Thisis NULL.
158 The StationIp address provided in DnsConfigData is not a
160 DnsServerList is NULL while DnsServerListCount
162 DnsServerListCount is ZERO while DnsServerList
164 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
166 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
167 EFI DNSv4 Protocol instance is not configured.
168 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
169 reconfigure the instance the caller must call Configure()
170 with NULL first to return driver to unconfigured state.
175 IN EFI_DNS4_PROTOCOL
*This
,
176 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
180 DNS_INSTANCE
*Instance
;
186 UINT32 ServerListCount
;
187 EFI_IPv4_ADDRESS
*ServerList
;
189 Status
= EFI_SUCCESS
;
193 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerListCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
194 (DnsConfigData
->DnsServerListCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
195 return EFI_INVALID_PARAMETER
;
198 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
199 return EFI_UNSUPPORTED
;
202 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
204 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
206 if (DnsConfigData
== NULL
) {
207 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
210 // Reset the Instance if ConfigData is NULL
212 if (!NetMapIsEmpty(&Instance
->Dns4TxTokens
)) {
213 Dns4InstanceCancelToken(Instance
, NULL
);
216 Instance
->MaxRetry
= 0;
218 if (Instance
->UdpIo
!= NULL
){
219 UdpIoCleanIo (Instance
->UdpIo
);
222 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
223 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
225 ZeroMem (&Instance
->Dns4CfgData
, sizeof (EFI_DNS4_CONFIG_DATA
));
227 Instance
->State
= DNS_STATE_UNCONFIGED
;
230 // Configure the parameters for new operation.
232 CopyMem (&Ip
, &DnsConfigData
->StationIp
, sizeof (IP4_ADDR
));
233 CopyMem (&Netmask
, &DnsConfigData
->SubnetMask
, sizeof (IP4_ADDR
));
236 Netmask
= NTOHL (Netmask
);
238 if (!DnsConfigData
->UseDefaultSetting
&&
239 ((!IP4_IS_VALID_NETMASK (Netmask
) || !NetIp4IsUnicast (Ip
, Netmask
)))) {
240 Status
= EFI_INVALID_PARAMETER
;
244 Status
= Dns4CopyConfigure (&Instance
->Dns4CfgData
, DnsConfigData
);
245 if (EFI_ERROR (Status
)) {
249 if (DnsConfigData
->DnsServerListCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
250 gBS
->RestoreTPL (OldTpl
);
253 // The DNS instance will retrieve DNS server from DHCP Server
255 Status
= GetDns4ServerFromDhcp4 (
260 if (EFI_ERROR (Status
)) {
264 ASSERT(ServerList
!= NULL
);
266 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
268 CopyMem (&Instance
->SessionDnsServer
.v4
, &ServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
270 CopyMem (&Instance
->SessionDnsServer
.v4
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
276 Status
= Dns4ConfigUdp (Instance
, Instance
->UdpIo
);
277 if (EFI_ERROR (Status
)) {
278 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
279 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
285 // Add configured DNS server used by this instance to ServerList.
287 Status
= AddDns4ServerIp (&mDriverData
->Dns4ServerList
, Instance
->SessionDnsServer
.v4
);
288 if (EFI_ERROR (Status
)) {
289 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
290 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
295 Instance
->State
= DNS_STATE_CONFIGED
;
299 gBS
->RestoreTPL (OldTpl
);
304 Host name to host address translation.
306 The HostNameToIp () function is used to translate the host name to host IP address. A
307 type A query is used to get the one or more IP addresses for this host.
309 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
310 @param[in] HostName Host name.
311 @param[in] Token Point to the completion token to translate host name
314 @retval EFI_SUCCESS The operation completed successfully.
315 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
319 HostName is NULL. HostName string is unsupported format.
320 @retval EFI_NO_MAPPING There's no source address is available for use.
321 @retval EFI_NOT_STARTED This instance has not been started.
326 IN EFI_DNS4_PROTOCOL
*This
,
328 IN EFI_DNS4_COMPLETION_TOKEN
*Token
333 DNS_INSTANCE
*Instance
;
335 EFI_DNS4_CONFIG_DATA
*ConfigData
;
344 DNS4_TOKEN_ENTRY
*TokenEntry
;
349 Status
= EFI_SUCCESS
;
356 // Validate the parameters
358 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
359 return EFI_INVALID_PARAMETER
;
362 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
364 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
366 ConfigData
= &(Instance
->Dns4CfgData
);
368 Instance
->MaxRetry
= ConfigData
->RetryCount
;
370 Token
->Status
= EFI_NOT_READY
;
371 Token
->RetryCount
= 0;
372 Token
->RetryInterval
= ConfigData
->RetryInterval
;
374 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
375 Status
= EFI_NOT_STARTED
;
380 // Check the MaxRetry and RetryInterval values.
382 if (Instance
->MaxRetry
== 0) {
383 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
386 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
387 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
393 if (ConfigData
->EnableDnsCache
) {
395 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
396 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
397 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
403 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS_HOST_TO_ADDR_DATA
));
404 if (Token
->RspData
.H2AData
== NULL
) {
405 Status
= EFI_OUT_OF_RESOURCES
;
409 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
410 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * Index
);
411 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
412 if (Token
->RspData
.H2AData
!= NULL
) {
413 FreePool (Token
->RspData
.H2AData
);
416 Status
= EFI_OUT_OF_RESOURCES
;
421 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
422 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
423 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
424 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv4_ADDRESS
));
429 Token
->Status
= EFI_SUCCESS
;
431 if (Token
->Event
!= NULL
) {
432 gBS
->SignalEvent (Token
->Event
);
436 Status
= Token
->Status
;
442 // Construct DNS TokenEntry.
444 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
445 if (TokenEntry
== NULL
) {
446 Status
= EFI_OUT_OF_RESOURCES
;
450 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
451 TokenEntry
->QueryHostName
= HostName
;
452 TokenEntry
->Token
= Token
;
457 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
458 if (QueryName
== NULL
) {
459 Status
= EFI_OUT_OF_RESOURCES
;
464 // Construct DNS Query Packet.
466 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_A
, DNS_CLASS_INET
, &Packet
);
467 if (EFI_ERROR (Status
)) {
468 if (TokenEntry
!= NULL
) {
469 FreePool (TokenEntry
);
475 ASSERT (Packet
!= NULL
);
478 // Save the token into the Dns4TxTokens map.
480 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
481 if (EFI_ERROR (Status
)) {
482 if (TokenEntry
!= NULL
) {
483 FreePool (TokenEntry
);
494 Status
= DoDnsQuery (Instance
, Packet
);
495 if (EFI_ERROR (Status
)) {
496 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
498 if (TokenEntry
!= NULL
) {
499 FreePool (TokenEntry
);
506 if (QueryName
!= NULL
) {
507 FreePool (QueryName
);
510 gBS
->RestoreTPL (OldTpl
);
515 IPv4 address to host name translation also known as Reverse DNS lookup.
517 The IpToHostName() function is used to translate the host address to host name. A type PTR
518 query is used to get the primary name of the host. Support of this function is optional.
520 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
521 @param[in] IpAddress Ip Address.
522 @param[in] Token Point to the completion token to translate host
523 address to host name.
525 @retval EFI_SUCCESS The operation completed successfully.
526 @retval EFI_UNSUPPORTED This function is not supported.
527 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
531 IpAddress is not valid IP address .
532 @retval EFI_NO_MAPPING There's no source address is available for use.
533 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
534 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
539 IN EFI_DNS4_PROTOCOL
*This
,
540 IN EFI_IPv4_ADDRESS IpAddress
,
541 IN EFI_DNS4_COMPLETION_TOKEN
*Token
544 return EFI_UNSUPPORTED
;
548 Retrieve arbitrary information from the DNS server.
550 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
551 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
552 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
553 required information. The function is optional.
555 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
556 @param[in] QName Pointer to Query Name.
557 @param[in] QType Query Type.
558 @param[in] QClass Query Name.
559 @param[in] Token Point to the completion token to retrieve arbitrary
562 @retval EFI_SUCCESS The operation completed successfully.
563 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
564 QType is not supported
565 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
570 @retval EFI_NO_MAPPING There's no source address is available for use.
571 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
572 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
577 IN EFI_DNS4_PROTOCOL
*This
,
581 IN EFI_DNS4_COMPLETION_TOKEN
*Token
586 DNS_INSTANCE
*Instance
;
588 EFI_DNS4_CONFIG_DATA
*ConfigData
;
590 DNS4_TOKEN_ENTRY
*TokenEntry
;
595 Status
= EFI_SUCCESS
;
600 // Validate the parameters
602 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
603 return EFI_INVALID_PARAMETER
;
606 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
608 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
610 ConfigData
= &(Instance
->Dns4CfgData
);
612 Instance
->MaxRetry
= ConfigData
->RetryCount
;
614 Token
->Status
= EFI_NOT_READY
;
615 Token
->RetryCount
= 0;
616 Token
->RetryInterval
= ConfigData
->RetryInterval
;
618 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
619 Status
= EFI_NOT_STARTED
;
624 // Check the MaxRetry and RetryInterval values.
626 if (Instance
->MaxRetry
== 0) {
627 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
630 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
631 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
635 // Construct DNS TokenEntry.
637 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
638 if (TokenEntry
== NULL
) {
639 Status
= EFI_OUT_OF_RESOURCES
;
643 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
644 TokenEntry
->GeneralLookUp
= TRUE
;
645 TokenEntry
->Token
= Token
;
648 // Construct DNS Query Packet.
650 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
651 if (EFI_ERROR (Status
)) {
652 if (TokenEntry
!= NULL
) {
653 FreePool (TokenEntry
);
659 ASSERT (Packet
!= NULL
);
662 // Save the token into the Dns4TxTokens map.
664 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
665 if (EFI_ERROR (Status
)) {
666 if (TokenEntry
!= NULL
) {
667 FreePool (TokenEntry
);
678 Status
= DoDnsQuery (Instance
, Packet
);
679 if (EFI_ERROR (Status
)) {
680 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
682 if (TokenEntry
!= NULL
) {
683 FreePool (TokenEntry
);
690 gBS
->RestoreTPL (OldTpl
);
695 This function is to update the DNS Cache.
697 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
698 can be normally dynamically updated after the DNS resolve succeeds. This function
699 provided capability to manually add/delete/modify the DNS cache.
701 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
702 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
703 DNS Cahce. If TRUE, this function will delete
704 matching DNS Cache entry.
705 @param[in] Override If TRUE, the maching DNS cache entry will be
706 overwritten with the supplied parameter. If FALSE,
707 EFI_ACCESS_DENIED will be returned if the entry to
708 be added is already existed.
709 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
711 @retval EFI_SUCCESS The operation completed successfully.
712 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
714 DnsCacheEntry.HostName is NULL.
715 DnsCacheEntry.IpAddress is NULL.
716 DnsCacheEntry.Timeout is zero.
717 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
723 IN EFI_DNS4_PROTOCOL
*This
,
724 IN BOOLEAN DeleteFlag
,
726 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
732 Status
= EFI_SUCCESS
;
734 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
735 return EFI_INVALID_PARAMETER
;
738 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
741 // Update Dns4Cache here.
743 Status
= UpdateDns4Cache (&mDriverData
->Dns4CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
745 gBS
->RestoreTPL (OldTpl
);
751 Polls for incoming data packets and processes outgoing data packets.
753 The Poll() function can be used by network drivers and applications to increase the
754 rate that data packets are moved between the communications device and the transmit
756 In some systems, the periodic timer event in the managed network driver may not poll
757 the underlying communications device fast enough to transmit and/or receive all data
758 packets without missing incoming packets or dropping outgoing packets. Drivers and
759 applications that are experiencing packet loss should try calling the Poll()
762 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
764 @retval EFI_SUCCESS Incoming or outgoing data was processed.
765 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
766 @retval EFI_INVALID_PARAMETER This is NULL.
767 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
768 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
769 queue. Consider increasing the polling rate.
774 IN EFI_DNS4_PROTOCOL
*This
777 DNS_INSTANCE
*Instance
;
778 EFI_UDP4_PROTOCOL
*Udp
;
781 return EFI_INVALID_PARAMETER
;
784 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
786 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
787 return EFI_NOT_STARTED
;
788 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
789 return EFI_DEVICE_ERROR
;
792 Udp
= Instance
->UdpIo
->Protocol
.Udp4
;
794 return Udp
->Poll (Udp
);
798 Abort an asynchronous DNS operation, including translation between IP and Host, and
799 general look up behavior.
801 The Cancel() function is used to abort a pending resolution request. After calling
802 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
803 signaled. If the token is not in one of the queues, which usually means that the
804 asynchronous operation has completed, this function will not signal the token and
805 EFI_NOT_FOUND is returned.
807 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
808 @param[in] Token Pointer to a token that has been issued by
809 EFI_DNS4_PROTOCOL.HostNameToIp (),
810 EFI_DNS4_PROTOCOL.IpToHostName() or
811 EFI_DNS4_PROTOCOL.GeneralLookup().
812 If NULL, all pending tokens are aborted.
814 @retval EFI_SUCCESS Incoming or outgoing data was processed.
815 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
816 @retval EFI_INVALID_PARAMETER This is NULL.
817 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
818 operation was not found in the transmit queue. It
819 was either completed or was not issued by
820 HostNameToIp(), IpToHostName() or GeneralLookup().
825 IN EFI_DNS4_PROTOCOL
*This
,
826 IN EFI_DNS4_COMPLETION_TOKEN
*Token
830 DNS_INSTANCE
*Instance
;
834 return EFI_INVALID_PARAMETER
;
837 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
839 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
840 return EFI_NOT_STARTED
;
843 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
846 // Cancle the tokens specified by Token for this instance.
848 Status
= Dns4InstanceCancelToken (Instance
, Token
);
851 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
855 gBS
->RestoreTPL (OldTpl
);
861 Retrieve mode data of this DNS instance.
863 This function is used to retrieve DNS mode data for this DNS instance.
865 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
866 @param[out] DnsModeData Pointer to the caller-allocated storage for the
867 EFI_DNS6_MODE_DATA data.
869 @retval EFI_SUCCESS The operation completed successfully.
870 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
871 is available because this instance has not been
873 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
874 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
879 IN EFI_DNS6_PROTOCOL
*This
,
880 OUT EFI_DNS6_MODE_DATA
*DnsModeData
883 DNS_INSTANCE
*Instance
;
892 DNS6_SERVER_IP
*ServerItem
;
893 EFI_IPv6_ADDRESS
*ServerList
;
894 DNS6_CACHE
*CacheItem
;
895 EFI_DNS6_CACHE_ENTRY
*CacheList
;
902 Status
= EFI_SUCCESS
;
904 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
905 return EFI_INVALID_PARAMETER
;
908 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
910 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
911 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
912 gBS
->RestoreTPL (OldTpl
);
913 return EFI_NOT_STARTED
;
916 ZeroMem (DnsModeData
, sizeof (EFI_DNS6_MODE_DATA
));
919 // Get the current configuration data of this instance.
921 Status
= Dns6CopyConfigure(&DnsModeData
->DnsConfigData
, &Instance
->Dns6CfgData
);
922 if (EFI_ERROR (Status
)) {
923 gBS
->RestoreTPL (OldTpl
);
928 // Get the DnsServerCount and DnsServerList
931 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
934 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
935 ServerList
= AllocatePool (sizeof(EFI_IPv6_ADDRESS
) * DnsModeData
->DnsServerCount
);
936 ASSERT (ServerList
!= NULL
);
938 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
939 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_SERVER_IP
, AllServerLink
);
940 CopyMem (ServerList
+ Index
, &ServerItem
->Dns6ServerIp
, sizeof (EFI_IPv6_ADDRESS
));
943 DnsModeData
->DnsServerList
= ServerList
;
946 // Get the DnsCacheCount and DnsCacheList
949 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
952 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
953 CacheList
= AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
954 ASSERT (CacheList
!= NULL
);
956 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
957 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
958 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS6_CACHE_ENTRY
));
961 DnsModeData
->DnsCacheList
= CacheList
;
963 gBS
->RestoreTPL (OldTpl
);
969 Configure this DNS instance.
971 The Configure() function is used to set and change the configuration data for this
972 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
974 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
975 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
976 storage to be allocated and released by caller.
978 @retval EFI_SUCCESS The operation completed successfully.
979 @retval EFI_INVALID_PARAMTER This is NULL.
980 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
981 DnsServerList is NULL while DnsServerList Count is not ZERO.
982 DnsServerList Count is ZERO while DnsServerList is not NULL.
983 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
984 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
985 EFI DNSv6 Protocol instance is not configured.
986 @retval EFI_UNSUPPORTED The designated protocol is not supported.
987 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
988 reconfigure the instance the caller must call Configure() with
989 NULL first to return driver to unconfigured state.
994 IN EFI_DNS6_PROTOCOL
*This
,
995 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
999 DNS_INSTANCE
*Instance
;
1003 UINT32 ServerListCount
;
1004 EFI_IPv6_ADDRESS
*ServerList
;
1006 Status
= EFI_SUCCESS
;
1010 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
1011 (DnsConfigData
->DnsServerCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
1012 return EFI_INVALID_PARAMETER
;
1015 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
1016 return EFI_UNSUPPORTED
;
1019 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1021 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1023 if (DnsConfigData
== NULL
) {
1024 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
1027 // Reset the Instance if ConfigData is NULL
1029 if (!NetMapIsEmpty(&Instance
->Dns6TxTokens
)) {
1030 Dns6InstanceCancelToken(Instance
, NULL
);
1033 Instance
->MaxRetry
= 0;
1035 if (Instance
->UdpIo
!= NULL
){
1036 UdpIoCleanIo (Instance
->UdpIo
);
1039 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1040 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1042 ZeroMem (&Instance
->Dns6CfgData
, sizeof (EFI_DNS6_CONFIG_DATA
));
1044 Instance
->State
= DNS_STATE_UNCONFIGED
;
1047 // Configure the parameters for new operation.
1049 if (!NetIp6IsUnspecifiedAddr (&DnsConfigData
->StationIp
) && !NetIp6IsValidUnicast (&DnsConfigData
->StationIp
)) {
1050 Status
= EFI_INVALID_PARAMETER
;
1054 Status
= Dns6CopyConfigure (&Instance
->Dns6CfgData
, DnsConfigData
);
1055 if (EFI_ERROR (Status
)) {
1059 if (DnsConfigData
->DnsServerCount
== 0 || DnsConfigData
->DnsServerList
== NULL
) {
1060 gBS
->RestoreTPL (OldTpl
);
1063 //The DNS instance will retrieve DNS server from DHCP Server.
1065 Status
= GetDns6ServerFromDhcp6 (
1066 Instance
->Service
->ImageHandle
,
1067 Instance
->Service
->ControllerHandle
,
1071 if (EFI_ERROR (Status
)) {
1075 ASSERT(ServerList
!= NULL
);
1077 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1079 CopyMem (&Instance
->SessionDnsServer
.v6
, &ServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1081 CopyMem (&Instance
->SessionDnsServer
.v6
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1087 Status
= Dns6ConfigUdp (Instance
, Instance
->UdpIo
);
1088 if (EFI_ERROR (Status
)) {
1089 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1090 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1096 // Add configured DNS server used by this instance to ServerList.
1098 Status
= AddDns6ServerIp (&mDriverData
->Dns6ServerList
, Instance
->SessionDnsServer
.v6
);
1099 if (EFI_ERROR (Status
)) {
1100 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1101 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1106 Instance
->State
= DNS_STATE_CONFIGED
;
1110 gBS
->RestoreTPL (OldTpl
);
1115 Host name to host address translation.
1117 The HostNameToIp () function is used to translate the host name to host IP address. A
1118 type AAAA query is used to get the one or more IPv6 addresses for this host.
1120 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1121 @param[in] HostName Host name.
1122 @param[in] Token Point to the completion token to translate host name
1125 @retval EFI_SUCCESS The operation completed successfully.
1126 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1129 Token.Event is NULL.
1130 HostName is NULL or buffer contained unsupported characters.
1131 @retval EFI_NO_MAPPING There's no source address is available for use.
1132 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1133 @retval EFI_NOT_STARTED This instance has not been started.
1134 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1139 IN EFI_DNS6_PROTOCOL
*This
,
1140 IN CHAR16
*HostName
,
1141 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1146 DNS_INSTANCE
*Instance
;
1148 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1157 DNS6_TOKEN_ENTRY
*TokenEntry
;
1162 Status
= EFI_SUCCESS
;
1169 // Validate the parameters
1171 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
1172 return EFI_INVALID_PARAMETER
;
1175 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1177 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1179 ConfigData
= &(Instance
->Dns6CfgData
);
1181 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1183 Token
->Status
= EFI_NOT_READY
;
1184 Token
->RetryCount
= 0;
1185 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1187 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1188 Status
= EFI_NOT_STARTED
;
1193 // Check the MaxRetry and RetryInterval values.
1195 if (Instance
->MaxRetry
== 0) {
1196 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1199 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1200 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1206 if (ConfigData
->EnableDnsCache
) {
1208 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1209 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1210 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1216 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS6_HOST_TO_ADDR_DATA
));
1217 if (Token
->RspData
.H2AData
== NULL
) {
1218 Status
= EFI_OUT_OF_RESOURCES
;
1222 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
1223 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv6_ADDRESS
) * Index
);
1224 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
1225 if (Token
->RspData
.H2AData
!= NULL
) {
1226 FreePool (Token
->RspData
.H2AData
);
1229 Status
= EFI_OUT_OF_RESOURCES
;
1234 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1235 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1236 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1237 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv6_ADDRESS
));
1242 Token
->Status
= EFI_SUCCESS
;
1244 if (Token
->Event
!= NULL
) {
1245 gBS
->SignalEvent (Token
->Event
);
1249 Status
= Token
->Status
;
1255 // Construct DNS TokenEntry.
1257 TokenEntry
= AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY
));
1258 if (TokenEntry
== NULL
) {
1259 Status
= EFI_OUT_OF_RESOURCES
;
1263 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1264 TokenEntry
->QueryHostName
= HostName
;
1265 TokenEntry
->Token
= Token
;
1271 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
1272 if (QueryName
== NULL
) {
1273 Status
= EFI_OUT_OF_RESOURCES
;
1278 // Construct DNS Query Packet.
1280 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_AAAA
, DNS_CLASS_INET
, &Packet
);
1281 if (EFI_ERROR (Status
)) {
1282 if (TokenEntry
!= NULL
) {
1283 FreePool (TokenEntry
);
1289 ASSERT (Packet
!= NULL
);
1292 // Save the token into the Dns6TxTokens map.
1294 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1295 if (EFI_ERROR (Status
)) {
1296 if (TokenEntry
!= NULL
) {
1297 FreePool (TokenEntry
);
1300 NetbufFree (Packet
);
1308 Status
= DoDnsQuery (Instance
, Packet
);
1309 if (EFI_ERROR (Status
)) {
1310 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1312 if (TokenEntry
!= NULL
) {
1313 FreePool (TokenEntry
);
1316 NetbufFree (Packet
);
1320 if (QueryName
!= NULL
) {
1321 FreePool (QueryName
);
1324 gBS
->RestoreTPL (OldTpl
);
1329 Host address to host name translation.
1331 The IpToHostName () function is used to translate the host address to host name. A
1332 type PTR query is used to get the primary name of the host. Implementation can choose
1333 to support this function or not.
1335 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1336 @param[in] IpAddress Ip Address.
1337 @param[in] Token Point to the completion token to translate host
1338 address to host name.
1340 @retval EFI_SUCCESS The operation completed successfully.
1341 @retval EFI_UNSUPPORTED This function is not supported.
1342 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1345 Token.Event is NULL.
1346 IpAddress is not valid IP address.
1347 @retval EFI_NO_MAPPING There's no source address is available for use.
1348 @retval EFI_NOT_STARTED This instance has not been started.
1349 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1354 IN EFI_DNS6_PROTOCOL
*This
,
1355 IN EFI_IPv6_ADDRESS IpAddress
,
1356 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1359 return EFI_UNSUPPORTED
;
1363 This function provides capability to retrieve arbitrary information from the DNS
1366 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1367 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1368 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1369 required information. The function is optional. Implementation can choose to support
1372 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1373 @param[in] QName Pointer to Query Name.
1374 @param[in] QType Query Type.
1375 @param[in] QClass Query Name.
1376 @param[in] Token Point to the completion token to retrieve arbitrary
1379 @retval EFI_SUCCESS The operation completed successfully.
1380 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1381 QType is not supported
1382 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1385 Token.Event is NULL.
1387 @retval EFI_NO_MAPPING There's no source address is available for use.
1388 @retval EFI_NOT_STARTED This instance has not been started.
1389 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1394 IN EFI_DNS6_PROTOCOL
*This
,
1398 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1403 DNS_INSTANCE
*Instance
;
1405 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1407 DNS6_TOKEN_ENTRY
*TokenEntry
;
1412 Status
= EFI_SUCCESS
;
1417 // Validate the parameters
1419 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
1420 return EFI_INVALID_PARAMETER
;
1423 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1425 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1427 ConfigData
= &(Instance
->Dns6CfgData
);
1429 Instance
->MaxRetry
= ConfigData
->RetryCount
;
1431 Token
->Status
= EFI_NOT_READY
;
1432 Token
->RetryCount
= 0;
1433 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1435 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1436 Status
= EFI_NOT_STARTED
;
1441 // Check the MaxRetry and RetryInterval values.
1443 if (Instance
->MaxRetry
== 0) {
1444 Instance
->MaxRetry
= DNS_DEFAULT_RETRY
;
1447 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1448 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1452 // Construct DNS TokenEntry.
1454 TokenEntry
= AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY
));
1455 if (TokenEntry
== NULL
) {
1456 Status
= EFI_OUT_OF_RESOURCES
;
1460 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1461 TokenEntry
->GeneralLookUp
= TRUE
;
1462 TokenEntry
->Token
= Token
;
1465 // Construct DNS Query Packet.
1467 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
1468 if (EFI_ERROR (Status
)) {
1469 if (TokenEntry
!= NULL
) {
1470 FreePool (TokenEntry
);
1476 ASSERT (Packet
!= NULL
);
1479 // Save the token into the Dns6TxTokens map.
1481 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1482 if (EFI_ERROR (Status
)) {
1483 if (TokenEntry
!= NULL
) {
1484 FreePool (TokenEntry
);
1487 NetbufFree (Packet
);
1495 Status
= DoDnsQuery (Instance
, Packet
);
1496 if (EFI_ERROR (Status
)) {
1497 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1499 if (TokenEntry
!= NULL
) {
1500 FreePool (TokenEntry
);
1503 NetbufFree (Packet
);
1507 gBS
->RestoreTPL (OldTpl
);
1512 This function is to update the DNS Cache.
1514 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1515 can be normally dynamically updated after the DNS resolve succeeds. This function
1516 provided capability to manually add/delete/modify the DNS cache.
1518 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1519 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1520 DNS Cahce. If TRUE, this function will delete
1521 matching DNS Cache entry.
1522 @param[in] Override If TRUE, the maching DNS cache entry will be
1523 overwritten with the supplied parameter. If FALSE,
1524 EFI_ACCESS_DENIED will be returned if the entry to
1525 be added is already existed.
1526 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1528 @retval EFI_SUCCESS The operation completed successfully.
1529 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1531 DnsCacheEntry.HostName is NULL.
1532 DnsCacheEntry.IpAddress is NULL.
1533 DnsCacheEntry.Timeout is zero.
1534 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1536 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1540 Dns6UpdateDnsCache (
1541 IN EFI_DNS6_PROTOCOL
*This
,
1542 IN BOOLEAN DeleteFlag
,
1543 IN BOOLEAN Override
,
1544 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1550 Status
= EFI_SUCCESS
;
1552 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
1553 return EFI_INVALID_PARAMETER
;
1556 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1559 // Update Dns6Cache here.
1561 Status
= UpdateDns6Cache (&mDriverData
->Dns6CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
1563 gBS
->RestoreTPL (OldTpl
);
1569 Polls for incoming data packets and processes outgoing data packets.
1571 The Poll() function can be used by network drivers and applications to increase the
1572 rate that data packets are moved between the communications device and the transmit
1575 In some systems, the periodic timer event in the managed network driver may not poll
1576 the underlying communications device fast enough to transmit and/or receive all data
1577 packets without missing incoming packets or dropping outgoing packets. Drivers and
1578 applications that are experiencing packet loss should try calling the Poll()
1579 function more often.
1581 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1583 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1584 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1585 @retval EFI_INVALID_PARAMETER This is NULL.
1586 @retval EFI_NO_MAPPING There is no source address is available for use.
1587 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1588 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1589 queue. Consider increasing the polling rate.
1594 IN EFI_DNS6_PROTOCOL
*This
1597 DNS_INSTANCE
*Instance
;
1598 EFI_UDP6_PROTOCOL
*Udp
;
1601 return EFI_INVALID_PARAMETER
;
1604 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1606 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1607 return EFI_NOT_STARTED
;
1608 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
1609 return EFI_DEVICE_ERROR
;
1612 Udp
= Instance
->UdpIo
->Protocol
.Udp6
;
1614 return Udp
->Poll (Udp
);
1618 Abort an asynchronous DNS operation, including translation between IP and Host, and
1619 general look up behavior.
1621 The Cancel() function is used to abort a pending resolution request. After calling
1622 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1623 signaled. If the token is not in one of the queues, which usually means that the
1624 asynchronous operation has completed, this function will not signal the token and
1625 EFI_NOT_FOUND is returned.
1627 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1628 @param[in] Token Pointer to a token that has been issued by
1629 EFI_DNS6_PROTOCOL.HostNameToIp (),
1630 EFI_DNS6_PROTOCOL.IpToHostName() or
1631 EFI_DNS6_PROTOCOL.GeneralLookup().
1632 If NULL, all pending tokens are aborted.
1634 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1635 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1636 @retval EFI_INVALID_PARAMETER This is NULL.
1637 @retval EFI_NO_MAPPING There's no source address is available for use.
1638 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1639 operation was not found in the transmit queue. It
1640 was either completed or was not issued by
1641 HostNameToIp(), IpToHostName() or GeneralLookup().
1646 IN EFI_DNS6_PROTOCOL
*This
,
1647 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1651 DNS_INSTANCE
*Instance
;
1655 return EFI_INVALID_PARAMETER
;
1658 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1660 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1661 return EFI_NOT_STARTED
;
1664 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1667 // Cancle the tokens specified by Token for this instance.
1669 Status
= Dns6InstanceCancelToken (Instance
, Token
);
1672 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
1676 gBS
->RestoreTPL (OldTpl
);