2 Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces.
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 EFI_DNS4_PROTOCOL mDns4Protocol
= {
22 EFI_DNS6_PROTOCOL mDns6Protocol
= {
34 Retrieve mode data of this DNS instance.
36 This function is used to retrieve DNS mode data for this DNS instance.
38 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
39 @param[out] DnsModeData Point to the mode data.
41 @retval EFI_SUCCESS The operation completed successfully.
42 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
43 is available because this instance has not been
45 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
46 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
51 IN EFI_DNS4_PROTOCOL
*This
,
52 OUT EFI_DNS4_MODE_DATA
*DnsModeData
55 DNS_INSTANCE
*Instance
;
64 DNS4_SERVER_IP
*ServerItem
;
65 EFI_IPv4_ADDRESS
*ServerList
;
66 DNS4_CACHE
*CacheItem
;
67 EFI_DNS4_CACHE_ENTRY
*CacheList
;
77 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
78 return EFI_INVALID_PARAMETER
;
81 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
83 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
84 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
85 Status
= EFI_NOT_STARTED
;
89 ZeroMem (DnsModeData
, sizeof (EFI_DNS4_MODE_DATA
));
92 // Get the current configuration data of this instance.
94 Status
= Dns4CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns4CfgData
);
95 if (EFI_ERROR (Status
)) {
100 // Get the DnsServerCount and DnsServerList
103 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4ServerList
) {
106 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
107 ServerList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * DnsModeData
->DnsServerCount
);
108 if (ServerList
== NULL
) {
109 Status
= EFI_OUT_OF_RESOURCES
;
110 Dns4CleanConfigure (&DnsModeData
->DnsConfigData
);
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 if (CacheList
== NULL
) {
132 Status
= EFI_OUT_OF_RESOURCES
;
133 Dns4CleanConfigure (&DnsModeData
->DnsConfigData
);
134 FreePool (ServerList
);
139 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
140 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
141 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS4_CACHE_ENTRY
));
144 DnsModeData
->DnsCacheList
= CacheList
;
147 gBS
->RestoreTPL (OldTpl
);
152 Configure this DNS instance.
154 This function is used to configure DNS mode data for this DNS instance.
156 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
157 @param[in] DnsConfigData Point to the Configuration data.
159 @retval EFI_SUCCESS The operation completed successfully.
160 @retval EFI_UNSUPPORTED The designated protocol is not supported.
161 @retval EFI_INVALID_PARAMTER Thisis NULL.
162 The StationIp address provided in DnsConfigData is not a
164 DnsServerList is NULL while DnsServerListCount
166 DnsServerListCount is ZERO while DnsServerList
168 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
170 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
171 EFI DNSv4 Protocol instance is not configured.
172 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
173 reconfigure the instance the caller must call Configure()
174 with NULL first to return driver to unconfigured state.
179 IN EFI_DNS4_PROTOCOL
*This
,
180 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
184 DNS_INSTANCE
*Instance
;
190 UINT32 ServerListCount
;
191 EFI_IPv4_ADDRESS
*ServerList
;
193 Status
= EFI_SUCCESS
;
197 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerListCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
198 (DnsConfigData
->DnsServerListCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
199 return EFI_INVALID_PARAMETER
;
202 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
203 return EFI_UNSUPPORTED
;
206 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
208 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
210 if (DnsConfigData
== NULL
) {
211 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
214 // Reset the Instance if ConfigData is NULL
216 if (!NetMapIsEmpty(&Instance
->Dns4TxTokens
)) {
217 Dns4InstanceCancelToken(Instance
, NULL
);
220 if (Instance
->UdpIo
!= NULL
){
221 UdpIoCleanIo (Instance
->UdpIo
);
224 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
225 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
227 ZeroMem (&Instance
->Dns4CfgData
, sizeof (EFI_DNS4_CONFIG_DATA
));
229 Instance
->State
= DNS_STATE_UNCONFIGED
;
232 // Configure the parameters for new operation.
234 CopyMem (&Ip
, &DnsConfigData
->StationIp
, sizeof (IP4_ADDR
));
235 CopyMem (&Netmask
, &DnsConfigData
->SubnetMask
, sizeof (IP4_ADDR
));
238 Netmask
= NTOHL (Netmask
);
240 if (!DnsConfigData
->UseDefaultSetting
&&
241 ((!IP4_IS_VALID_NETMASK (Netmask
) || (Netmask
!= 0 && !NetIp4IsUnicast (Ip
, Netmask
))))) {
242 Status
= EFI_INVALID_PARAMETER
;
246 Status
= Dns4CopyConfigure (&Instance
->Dns4CfgData
, DnsConfigData
);
247 if (EFI_ERROR (Status
)) {
251 if (DnsConfigData
->DnsServerListCount
== 0) {
252 gBS
->RestoreTPL (OldTpl
);
255 // The DNS instance will retrieve DNS server from DHCP Server
257 Status
= GetDns4ServerFromDhcp4 (
262 if (EFI_ERROR (Status
)) {
266 ASSERT(ServerList
!= NULL
);
268 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
270 CopyMem (&Instance
->SessionDnsServer
.v4
, &ServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
272 CopyMem (&Instance
->SessionDnsServer
.v4
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
278 Status
= Dns4ConfigUdp (Instance
, Instance
->UdpIo
);
279 if (EFI_ERROR (Status
)) {
280 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
281 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
282 Instance
->Dns4CfgData
.DnsServerList
= NULL
;
288 // Add configured DNS server used by this instance to ServerList.
290 Status
= AddDns4ServerIp (&mDriverData
->Dns4ServerList
, Instance
->SessionDnsServer
.v4
);
291 if (EFI_ERROR (Status
)) {
292 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
293 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
294 Instance
->Dns4CfgData
.DnsServerList
= NULL
;
299 Instance
->State
= DNS_STATE_CONFIGED
;
303 gBS
->RestoreTPL (OldTpl
);
308 Host name to host address translation.
310 The HostNameToIp () function is used to translate the host name to host IP address. A
311 type A query is used to get the one or more IP addresses for this host.
313 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
314 @param[in] HostName Host name.
315 @param[in] Token Point to the completion token to translate host name
318 @retval EFI_SUCCESS The operation completed successfully.
319 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
323 HostName is NULL. HostName string is unsupported format.
324 @retval EFI_NO_MAPPING There's no source address is available for use.
325 @retval EFI_NOT_STARTED This instance has not been started.
330 IN EFI_DNS4_PROTOCOL
*This
,
332 IN EFI_DNS4_COMPLETION_TOKEN
*Token
337 DNS_INSTANCE
*Instance
;
339 EFI_DNS4_CONFIG_DATA
*ConfigData
;
348 DNS4_TOKEN_ENTRY
*TokenEntry
;
353 Status
= EFI_SUCCESS
;
360 // Validate the parameters
362 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
363 return EFI_INVALID_PARAMETER
;
366 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
368 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
370 ConfigData
= &(Instance
->Dns4CfgData
);
372 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
373 Status
= EFI_NOT_STARTED
;
377 Token
->Status
= EFI_NOT_READY
;
380 // If zero, use the parameter configured through Dns.Configure() interface.
382 if (Token
->RetryCount
== 0) {
383 Token
->RetryCount
= ConfigData
->RetryCount
;
387 // If zero, use the parameter configured through Dns.Configure() interface.
389 if (Token
->RetryInterval
== 0) {
390 Token
->RetryInterval
= ConfigData
->RetryInterval
;
394 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
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
->Token
= Token
;
462 TokenEntry
->QueryHostName
= AllocateZeroPool (StrSize (HostName
));
463 if (TokenEntry
->QueryHostName
== NULL
) {
464 Status
= EFI_OUT_OF_RESOURCES
;
468 CopyMem (TokenEntry
->QueryHostName
, HostName
, StrSize (HostName
));
473 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
474 if (QueryName
== NULL
) {
475 Status
= EFI_OUT_OF_RESOURCES
;
480 // Construct DNS Query Packet.
482 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_A
, DNS_CLASS_INET
, &Packet
);
483 if (EFI_ERROR (Status
)) {
487 ASSERT (Packet
!= NULL
);
490 // Save the token into the Dns4TxTokens map.
492 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
493 if (EFI_ERROR (Status
)) {
500 Status
= DoDnsQuery (Instance
, Packet
);
501 if (EFI_ERROR (Status
)) {
502 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
507 if (EFI_ERROR (Status
)) {
508 if (TokenEntry
!= NULL
) {
509 if (TokenEntry
->QueryHostName
!= NULL
) {
510 FreePool (TokenEntry
->QueryHostName
);
513 FreePool (TokenEntry
);
516 if (Packet
!= NULL
) {
521 if (QueryName
!= NULL
) {
522 FreePool (QueryName
);
525 gBS
->RestoreTPL (OldTpl
);
530 IPv4 address to host name translation also known as Reverse DNS lookup.
532 The IpToHostName() function is used to translate the host address to host name. A type PTR
533 query is used to get the primary name of the host. Support of this function is optional.
535 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
536 @param[in] IpAddress Ip Address.
537 @param[in] Token Point to the completion token to translate host
538 address to host name.
540 @retval EFI_SUCCESS The operation completed successfully.
541 @retval EFI_UNSUPPORTED This function is not supported.
542 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
546 IpAddress is not valid IP address .
547 @retval EFI_NO_MAPPING There's no source address is available for use.
548 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
549 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
554 IN EFI_DNS4_PROTOCOL
*This
,
555 IN EFI_IPv4_ADDRESS IpAddress
,
556 IN EFI_DNS4_COMPLETION_TOKEN
*Token
559 return EFI_UNSUPPORTED
;
563 Retrieve arbitrary information from the DNS server.
565 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
566 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
567 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
568 required information. The function is optional.
570 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
571 @param[in] QName Pointer to Query Name.
572 @param[in] QType Query Type.
573 @param[in] QClass Query Name.
574 @param[in] Token Point to the completion token to retrieve arbitrary
577 @retval EFI_SUCCESS The operation completed successfully.
578 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
579 QType is not supported
580 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
585 @retval EFI_NO_MAPPING There's no source address is available for use.
586 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
587 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
592 IN EFI_DNS4_PROTOCOL
*This
,
596 IN EFI_DNS4_COMPLETION_TOKEN
*Token
601 DNS_INSTANCE
*Instance
;
603 EFI_DNS4_CONFIG_DATA
*ConfigData
;
605 DNS4_TOKEN_ENTRY
*TokenEntry
;
610 Status
= EFI_SUCCESS
;
615 // Validate the parameters
617 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
618 return EFI_INVALID_PARAMETER
;
621 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
623 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
625 ConfigData
= &(Instance
->Dns4CfgData
);
627 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
628 Status
= EFI_NOT_STARTED
;
632 Token
->Status
= EFI_NOT_READY
;
635 // If zero, use the parameter configured through Dns.Configure() interface.
637 if (Token
->RetryCount
== 0) {
638 Token
->RetryCount
= ConfigData
->RetryCount
;
642 // If zero, use the parameter configured through Dns.Configure() interface.
644 if (Token
->RetryInterval
== 0) {
645 Token
->RetryInterval
= ConfigData
->RetryInterval
;
649 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
651 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
652 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
656 // Construct DNS TokenEntry.
658 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
659 if (TokenEntry
== NULL
) {
660 Status
= EFI_OUT_OF_RESOURCES
;
664 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
665 TokenEntry
->GeneralLookUp
= TRUE
;
666 TokenEntry
->Token
= Token
;
669 // Construct DNS Query Packet.
671 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
672 if (EFI_ERROR (Status
)) {
673 if (TokenEntry
!= NULL
) {
674 FreePool (TokenEntry
);
680 ASSERT (Packet
!= NULL
);
683 // Save the token into the Dns4TxTokens map.
685 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
686 if (EFI_ERROR (Status
)) {
687 if (TokenEntry
!= NULL
) {
688 FreePool (TokenEntry
);
699 Status
= DoDnsQuery (Instance
, Packet
);
700 if (EFI_ERROR (Status
)) {
701 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
703 if (TokenEntry
!= NULL
) {
704 FreePool (TokenEntry
);
711 gBS
->RestoreTPL (OldTpl
);
716 This function is to update the DNS Cache.
718 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
719 can be normally dynamically updated after the DNS resolve succeeds. This function
720 provided capability to manually add/delete/modify the DNS cache.
722 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
723 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
724 DNS Cahce. If TRUE, this function will delete
725 matching DNS Cache entry.
726 @param[in] Override If TRUE, the maching DNS cache entry will be
727 overwritten with the supplied parameter. If FALSE,
728 EFI_ACCESS_DENIED will be returned if the entry to
729 be added is already existed.
730 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
732 @retval EFI_SUCCESS The operation completed successfully.
733 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
735 DnsCacheEntry.HostName is NULL.
736 DnsCacheEntry.IpAddress is NULL.
737 DnsCacheEntry.Timeout is zero.
738 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
744 IN EFI_DNS4_PROTOCOL
*This
,
745 IN BOOLEAN DeleteFlag
,
747 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
753 Status
= EFI_SUCCESS
;
755 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
756 return EFI_INVALID_PARAMETER
;
759 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
762 // Update Dns4Cache here.
764 Status
= UpdateDns4Cache (&mDriverData
->Dns4CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
766 gBS
->RestoreTPL (OldTpl
);
772 Polls for incoming data packets and processes outgoing data packets.
774 The Poll() function can be used by network drivers and applications to increase the
775 rate that data packets are moved between the communications device and the transmit
777 In some systems, the periodic timer event in the managed network driver may not poll
778 the underlying communications device fast enough to transmit and/or receive all data
779 packets without missing incoming packets or dropping outgoing packets. Drivers and
780 applications that are experiencing packet loss should try calling the Poll()
783 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
785 @retval EFI_SUCCESS Incoming or outgoing data was processed.
786 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
787 @retval EFI_INVALID_PARAMETER This is NULL.
788 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
789 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
790 queue. Consider increasing the polling rate.
795 IN EFI_DNS4_PROTOCOL
*This
798 DNS_INSTANCE
*Instance
;
799 EFI_UDP4_PROTOCOL
*Udp
;
802 return EFI_INVALID_PARAMETER
;
805 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
807 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
808 return EFI_NOT_STARTED
;
809 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
810 return EFI_DEVICE_ERROR
;
813 Udp
= Instance
->UdpIo
->Protocol
.Udp4
;
815 return Udp
->Poll (Udp
);
819 Abort an asynchronous DNS operation, including translation between IP and Host, and
820 general look up behavior.
822 The Cancel() function is used to abort a pending resolution request. After calling
823 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
824 signaled. If the token is not in one of the queues, which usually means that the
825 asynchronous operation has completed, this function will not signal the token and
826 EFI_NOT_FOUND is returned.
828 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
829 @param[in] Token Pointer to a token that has been issued by
830 EFI_DNS4_PROTOCOL.HostNameToIp (),
831 EFI_DNS4_PROTOCOL.IpToHostName() or
832 EFI_DNS4_PROTOCOL.GeneralLookup().
833 If NULL, all pending tokens are aborted.
835 @retval EFI_SUCCESS Incoming or outgoing data was processed.
836 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
837 @retval EFI_INVALID_PARAMETER This is NULL.
838 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
839 operation was not found in the transmit queue. It
840 was either completed or was not issued by
841 HostNameToIp(), IpToHostName() or GeneralLookup().
846 IN EFI_DNS4_PROTOCOL
*This
,
847 IN EFI_DNS4_COMPLETION_TOKEN
*Token
851 DNS_INSTANCE
*Instance
;
855 return EFI_INVALID_PARAMETER
;
858 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
860 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
861 return EFI_NOT_STARTED
;
864 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
867 // Cancle the tokens specified by Token for this instance.
869 Status
= Dns4InstanceCancelToken (Instance
, Token
);
872 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
876 gBS
->RestoreTPL (OldTpl
);
882 Retrieve mode data of this DNS instance.
884 This function is used to retrieve DNS mode data for this DNS instance.
886 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
887 @param[out] DnsModeData Pointer to the caller-allocated storage for the
888 EFI_DNS6_MODE_DATA data.
890 @retval EFI_SUCCESS The operation completed successfully.
891 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
892 is available because this instance has not been
894 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
895 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
900 IN EFI_DNS6_PROTOCOL
*This
,
901 OUT EFI_DNS6_MODE_DATA
*DnsModeData
904 DNS_INSTANCE
*Instance
;
913 DNS6_SERVER_IP
*ServerItem
;
914 EFI_IPv6_ADDRESS
*ServerList
;
915 DNS6_CACHE
*CacheItem
;
916 EFI_DNS6_CACHE_ENTRY
*CacheList
;
923 Status
= EFI_SUCCESS
;
925 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
926 return EFI_INVALID_PARAMETER
;
929 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
931 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
932 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
933 Status
= EFI_NOT_STARTED
;
937 ZeroMem (DnsModeData
, sizeof (EFI_DNS6_MODE_DATA
));
940 // Get the current configuration data of this instance.
942 Status
= Dns6CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns6CfgData
);
943 if (EFI_ERROR (Status
)) {
948 // Get the DnsServerCount and DnsServerList
951 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
954 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
955 ServerList
= AllocatePool (sizeof(EFI_IPv6_ADDRESS
) * DnsModeData
->DnsServerCount
);
956 if (ServerList
== NULL
) {
957 Status
= EFI_OUT_OF_RESOURCES
;
958 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
963 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
964 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_SERVER_IP
, AllServerLink
);
965 CopyMem (ServerList
+ Index
, &ServerItem
->Dns6ServerIp
, sizeof (EFI_IPv6_ADDRESS
));
968 DnsModeData
->DnsServerList
= ServerList
;
971 // Get the DnsCacheCount and DnsCacheList
974 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
977 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
978 CacheList
= AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
979 if (CacheList
== NULL
) {
980 Status
= EFI_OUT_OF_RESOURCES
;
981 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
982 FreePool (ServerList
);
987 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
988 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
989 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS6_CACHE_ENTRY
));
992 DnsModeData
->DnsCacheList
= CacheList
;
995 gBS
->RestoreTPL (OldTpl
);
1000 Configure this DNS instance.
1002 The Configure() function is used to set and change the configuration data for this
1003 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
1005 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1006 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
1007 storage to be allocated and released by caller.
1009 @retval EFI_SUCCESS The operation completed successfully.
1010 @retval EFI_INVALID_PARAMTER This is NULL.
1011 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
1012 DnsServerList is NULL while DnsServerList Count is not ZERO.
1013 DnsServerList Count is ZERO while DnsServerList is not NULL.
1014 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
1015 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
1016 EFI DNSv6 Protocol instance is not configured.
1017 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1018 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1019 reconfigure the instance the caller must call Configure() with
1020 NULL first to return driver to unconfigured state.
1025 IN EFI_DNS6_PROTOCOL
*This
,
1026 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1030 DNS_INSTANCE
*Instance
;
1034 UINT32 ServerListCount
;
1035 EFI_IPv6_ADDRESS
*ServerList
;
1037 Status
= EFI_SUCCESS
;
1041 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
1042 (DnsConfigData
->DnsServerCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
1043 return EFI_INVALID_PARAMETER
;
1046 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
1047 return EFI_UNSUPPORTED
;
1050 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1052 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1054 if (DnsConfigData
== NULL
) {
1055 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
1058 // Reset the Instance if ConfigData is NULL
1060 if (!NetMapIsEmpty(&Instance
->Dns6TxTokens
)) {
1061 Dns6InstanceCancelToken(Instance
, NULL
);
1064 if (Instance
->UdpIo
!= NULL
){
1065 UdpIoCleanIo (Instance
->UdpIo
);
1068 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1069 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1071 ZeroMem (&Instance
->Dns6CfgData
, sizeof (EFI_DNS6_CONFIG_DATA
));
1073 Instance
->State
= DNS_STATE_UNCONFIGED
;
1076 // Configure the parameters for new operation.
1078 if (!NetIp6IsUnspecifiedAddr (&DnsConfigData
->StationIp
) && !NetIp6IsValidUnicast (&DnsConfigData
->StationIp
)) {
1079 Status
= EFI_INVALID_PARAMETER
;
1083 Status
= Dns6CopyConfigure (&Instance
->Dns6CfgData
, DnsConfigData
);
1084 if (EFI_ERROR (Status
)) {
1088 if (DnsConfigData
->DnsServerCount
== 0) {
1089 gBS
->RestoreTPL (OldTpl
);
1092 //The DNS instance will retrieve DNS server from DHCP Server.
1094 Status
= GetDns6ServerFromDhcp6 (
1095 Instance
->Service
->ImageHandle
,
1096 Instance
->Service
->ControllerHandle
,
1100 if (EFI_ERROR (Status
)) {
1104 ASSERT(ServerList
!= NULL
);
1106 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1108 CopyMem (&Instance
->SessionDnsServer
.v6
, &ServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1110 CopyMem (&Instance
->SessionDnsServer
.v6
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1116 gBS
->RestoreTPL (OldTpl
);
1117 Status
= Dns6ConfigUdp (Instance
, Instance
->UdpIo
);
1118 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1119 if (EFI_ERROR (Status
)) {
1120 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1121 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1122 Instance
->Dns6CfgData
.DnsServerList
= NULL
;
1128 // Add configured DNS server used by this instance to ServerList.
1130 Status
= AddDns6ServerIp (&mDriverData
->Dns6ServerList
, Instance
->SessionDnsServer
.v6
);
1131 if (EFI_ERROR (Status
)) {
1132 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1133 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1134 Instance
->Dns6CfgData
.DnsServerList
= NULL
;
1139 Instance
->State
= DNS_STATE_CONFIGED
;
1143 gBS
->RestoreTPL (OldTpl
);
1148 Host name to host address translation.
1150 The HostNameToIp () function is used to translate the host name to host IP address. A
1151 type AAAA query is used to get the one or more IPv6 addresses for this host.
1153 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1154 @param[in] HostName Host name.
1155 @param[in] Token Point to the completion token to translate host name
1158 @retval EFI_SUCCESS The operation completed successfully.
1159 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1162 Token.Event is NULL.
1163 HostName is NULL or buffer contained unsupported characters.
1164 @retval EFI_NO_MAPPING There's no source address is available for use.
1165 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1166 @retval EFI_NOT_STARTED This instance has not been started.
1167 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1172 IN EFI_DNS6_PROTOCOL
*This
,
1173 IN CHAR16
*HostName
,
1174 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1179 DNS_INSTANCE
*Instance
;
1181 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1190 DNS6_TOKEN_ENTRY
*TokenEntry
;
1195 Status
= EFI_SUCCESS
;
1202 // Validate the parameters
1204 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
1205 return EFI_INVALID_PARAMETER
;
1208 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1210 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1212 ConfigData
= &(Instance
->Dns6CfgData
);
1214 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1215 Status
= EFI_NOT_STARTED
;
1219 Token
->Status
= EFI_NOT_READY
;
1222 // If zero, use the parameter configured through Dns.Configure() interface.
1224 if (Token
->RetryCount
== 0) {
1225 Token
->RetryCount
= ConfigData
->RetryCount
;
1229 // If zero, use the parameter configured through Dns.Configure() interface.
1231 if (Token
->RetryInterval
== 0) {
1232 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1236 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
1238 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1239 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1245 if (ConfigData
->EnableDnsCache
) {
1247 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1248 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1249 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1255 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS6_HOST_TO_ADDR_DATA
));
1256 if (Token
->RspData
.H2AData
== NULL
) {
1257 Status
= EFI_OUT_OF_RESOURCES
;
1261 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
1262 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv6_ADDRESS
) * Index
);
1263 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
1264 if (Token
->RspData
.H2AData
!= NULL
) {
1265 FreePool (Token
->RspData
.H2AData
);
1268 Status
= EFI_OUT_OF_RESOURCES
;
1273 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1274 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1275 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1276 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv6_ADDRESS
));
1281 Token
->Status
= EFI_SUCCESS
;
1283 if (Token
->Event
!= NULL
) {
1284 gBS
->SignalEvent (Token
->Event
);
1288 Status
= Token
->Status
;
1294 // Construct DNS TokenEntry.
1296 TokenEntry
= AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY
));
1297 if (TokenEntry
== NULL
) {
1298 Status
= EFI_OUT_OF_RESOURCES
;
1302 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1303 TokenEntry
->Token
= Token
;
1304 TokenEntry
->QueryHostName
= AllocateZeroPool (StrSize (HostName
));
1305 if (TokenEntry
->QueryHostName
== NULL
) {
1306 Status
= EFI_OUT_OF_RESOURCES
;
1310 CopyMem (TokenEntry
->QueryHostName
, HostName
, StrSize (HostName
));
1315 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
1316 if (QueryName
== NULL
) {
1317 Status
= EFI_OUT_OF_RESOURCES
;
1322 // Construct DNS Query Packet.
1324 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_AAAA
, DNS_CLASS_INET
, &Packet
);
1325 if (EFI_ERROR (Status
)) {
1329 ASSERT (Packet
!= NULL
);
1332 // Save the token into the Dns6TxTokens map.
1334 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1335 if (EFI_ERROR (Status
)) {
1342 Status
= DoDnsQuery (Instance
, Packet
);
1343 if (EFI_ERROR (Status
)) {
1344 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1349 if (EFI_ERROR (Status
)) {
1350 if (TokenEntry
!= NULL
) {
1351 if (TokenEntry
->QueryHostName
!= NULL
) {
1352 FreePool (TokenEntry
->QueryHostName
);
1355 FreePool (TokenEntry
);
1358 if (Packet
!= NULL
) {
1359 NetbufFree (Packet
);
1363 if (QueryName
!= NULL
) {
1364 FreePool (QueryName
);
1367 gBS
->RestoreTPL (OldTpl
);
1372 Host address to host name translation.
1374 The IpToHostName () function is used to translate the host address to host name. A
1375 type PTR query is used to get the primary name of the host. Implementation can choose
1376 to support this function or not.
1378 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1379 @param[in] IpAddress Ip Address.
1380 @param[in] Token Point to the completion token to translate host
1381 address to host name.
1383 @retval EFI_SUCCESS The operation completed successfully.
1384 @retval EFI_UNSUPPORTED This function is not supported.
1385 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1388 Token.Event is NULL.
1389 IpAddress is not valid IP address.
1390 @retval EFI_NO_MAPPING There's no source address is available for use.
1391 @retval EFI_NOT_STARTED This instance has not been started.
1392 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1397 IN EFI_DNS6_PROTOCOL
*This
,
1398 IN EFI_IPv6_ADDRESS IpAddress
,
1399 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1402 return EFI_UNSUPPORTED
;
1406 This function provides capability to retrieve arbitrary information from the DNS
1409 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1410 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1411 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1412 required information. The function is optional. Implementation can choose to support
1415 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1416 @param[in] QName Pointer to Query Name.
1417 @param[in] QType Query Type.
1418 @param[in] QClass Query Name.
1419 @param[in] Token Point to the completion token to retrieve arbitrary
1422 @retval EFI_SUCCESS The operation completed successfully.
1423 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1424 QType is not supported
1425 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1428 Token.Event is NULL.
1430 @retval EFI_NO_MAPPING There's no source address is available for use.
1431 @retval EFI_NOT_STARTED This instance has not been started.
1432 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1437 IN EFI_DNS6_PROTOCOL
*This
,
1441 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1446 DNS_INSTANCE
*Instance
;
1448 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1450 DNS6_TOKEN_ENTRY
*TokenEntry
;
1455 Status
= EFI_SUCCESS
;
1460 // Validate the parameters
1462 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
1463 return EFI_INVALID_PARAMETER
;
1466 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1468 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1470 ConfigData
= &(Instance
->Dns6CfgData
);
1472 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1473 Status
= EFI_NOT_STARTED
;
1477 Token
->Status
= EFI_NOT_READY
;
1480 // If zero, use the parameter configured through Dns.Configure() interface.
1482 if (Token
->RetryCount
== 0) {
1483 Token
->RetryCount
= ConfigData
->RetryCount
;
1487 // If zero, use the parameter configured through Dns.Configure() interface.
1489 if (Token
->RetryInterval
== 0) {
1490 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1494 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
1496 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1497 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1501 // Construct DNS TokenEntry.
1503 TokenEntry
= AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY
));
1504 if (TokenEntry
== NULL
) {
1505 Status
= EFI_OUT_OF_RESOURCES
;
1509 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1510 TokenEntry
->GeneralLookUp
= TRUE
;
1511 TokenEntry
->Token
= Token
;
1514 // Construct DNS Query Packet.
1516 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
1517 if (EFI_ERROR (Status
)) {
1518 if (TokenEntry
!= NULL
) {
1519 FreePool (TokenEntry
);
1525 ASSERT (Packet
!= NULL
);
1528 // Save the token into the Dns6TxTokens map.
1530 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1531 if (EFI_ERROR (Status
)) {
1532 if (TokenEntry
!= NULL
) {
1533 FreePool (TokenEntry
);
1536 NetbufFree (Packet
);
1544 Status
= DoDnsQuery (Instance
, Packet
);
1545 if (EFI_ERROR (Status
)) {
1546 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1548 if (TokenEntry
!= NULL
) {
1549 FreePool (TokenEntry
);
1552 NetbufFree (Packet
);
1556 gBS
->RestoreTPL (OldTpl
);
1561 This function is to update the DNS Cache.
1563 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1564 can be normally dynamically updated after the DNS resolve succeeds. This function
1565 provided capability to manually add/delete/modify the DNS cache.
1567 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1568 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1569 DNS Cahce. If TRUE, this function will delete
1570 matching DNS Cache entry.
1571 @param[in] Override If TRUE, the maching DNS cache entry will be
1572 overwritten with the supplied parameter. If FALSE,
1573 EFI_ACCESS_DENIED will be returned if the entry to
1574 be added is already existed.
1575 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1577 @retval EFI_SUCCESS The operation completed successfully.
1578 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1580 DnsCacheEntry.HostName is NULL.
1581 DnsCacheEntry.IpAddress is NULL.
1582 DnsCacheEntry.Timeout is zero.
1583 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1585 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1589 Dns6UpdateDnsCache (
1590 IN EFI_DNS6_PROTOCOL
*This
,
1591 IN BOOLEAN DeleteFlag
,
1592 IN BOOLEAN Override
,
1593 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1599 Status
= EFI_SUCCESS
;
1601 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
1602 return EFI_INVALID_PARAMETER
;
1605 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1608 // Update Dns6Cache here.
1610 Status
= UpdateDns6Cache (&mDriverData
->Dns6CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
1612 gBS
->RestoreTPL (OldTpl
);
1618 Polls for incoming data packets and processes outgoing data packets.
1620 The Poll() function can be used by network drivers and applications to increase the
1621 rate that data packets are moved between the communications device and the transmit
1624 In some systems, the periodic timer event in the managed network driver may not poll
1625 the underlying communications device fast enough to transmit and/or receive all data
1626 packets without missing incoming packets or dropping outgoing packets. Drivers and
1627 applications that are experiencing packet loss should try calling the Poll()
1628 function more often.
1630 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1632 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1633 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1634 @retval EFI_INVALID_PARAMETER This is NULL.
1635 @retval EFI_NO_MAPPING There is no source address is available for use.
1636 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1637 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1638 queue. Consider increasing the polling rate.
1643 IN EFI_DNS6_PROTOCOL
*This
1646 DNS_INSTANCE
*Instance
;
1647 EFI_UDP6_PROTOCOL
*Udp
;
1650 return EFI_INVALID_PARAMETER
;
1653 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1655 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1656 return EFI_NOT_STARTED
;
1657 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
1658 return EFI_DEVICE_ERROR
;
1661 Udp
= Instance
->UdpIo
->Protocol
.Udp6
;
1663 return Udp
->Poll (Udp
);
1667 Abort an asynchronous DNS operation, including translation between IP and Host, and
1668 general look up behavior.
1670 The Cancel() function is used to abort a pending resolution request. After calling
1671 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1672 signaled. If the token is not in one of the queues, which usually means that the
1673 asynchronous operation has completed, this function will not signal the token and
1674 EFI_NOT_FOUND is returned.
1676 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1677 @param[in] Token Pointer to a token that has been issued by
1678 EFI_DNS6_PROTOCOL.HostNameToIp (),
1679 EFI_DNS6_PROTOCOL.IpToHostName() or
1680 EFI_DNS6_PROTOCOL.GeneralLookup().
1681 If NULL, all pending tokens are aborted.
1683 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1684 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1685 @retval EFI_INVALID_PARAMETER This is NULL.
1686 @retval EFI_NO_MAPPING There's no source address is available for use.
1687 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1688 operation was not found in the transmit queue. It
1689 was either completed or was not issued by
1690 HostNameToIp(), IpToHostName() or GeneralLookup().
1695 IN EFI_DNS6_PROTOCOL
*This
,
1696 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1700 DNS_INSTANCE
*Instance
;
1704 return EFI_INVALID_PARAMETER
;
1707 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1709 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1710 return EFI_NOT_STARTED
;
1713 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1716 // Cancle the tokens specified by Token for this instance.
1718 Status
= Dns6InstanceCancelToken (Instance
, Token
);
1721 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
1725 gBS
->RestoreTPL (OldTpl
);