2 Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces.
4 Copyright (c) 2015 - 2017, 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 if (Instance
->UdpIo
!= NULL
){
227 UdpIoCleanIo (Instance
->UdpIo
);
230 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
231 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
233 ZeroMem (&Instance
->Dns4CfgData
, sizeof (EFI_DNS4_CONFIG_DATA
));
235 Instance
->State
= DNS_STATE_UNCONFIGED
;
238 // Configure the parameters for new operation.
240 CopyMem (&Ip
, &DnsConfigData
->StationIp
, sizeof (IP4_ADDR
));
241 CopyMem (&Netmask
, &DnsConfigData
->SubnetMask
, sizeof (IP4_ADDR
));
244 Netmask
= NTOHL (Netmask
);
246 if (!DnsConfigData
->UseDefaultSetting
&&
247 ((!IP4_IS_VALID_NETMASK (Netmask
) || (Netmask
!= 0 && !NetIp4IsUnicast (Ip
, Netmask
))))) {
248 Status
= EFI_INVALID_PARAMETER
;
252 Status
= Dns4CopyConfigure (&Instance
->Dns4CfgData
, DnsConfigData
);
253 if (EFI_ERROR (Status
)) {
257 if (DnsConfigData
->DnsServerListCount
== 0) {
258 gBS
->RestoreTPL (OldTpl
);
261 // The DNS instance will retrieve DNS server from DHCP Server
263 Status
= GetDns4ServerFromDhcp4 (
268 if (EFI_ERROR (Status
)) {
272 ASSERT(ServerList
!= NULL
);
274 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
276 CopyMem (&Instance
->SessionDnsServer
.v4
, &ServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
278 CopyMem (&Instance
->SessionDnsServer
.v4
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv4_ADDRESS
));
284 Status
= Dns4ConfigUdp (Instance
, Instance
->UdpIo
);
285 if (EFI_ERROR (Status
)) {
286 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
287 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
288 Instance
->Dns4CfgData
.DnsServerList
= NULL
;
294 // Add configured DNS server used by this instance to ServerList.
296 Status
= AddDns4ServerIp (&mDriverData
->Dns4ServerList
, Instance
->SessionDnsServer
.v4
);
297 if (EFI_ERROR (Status
)) {
298 if (Instance
->Dns4CfgData
.DnsServerList
!= NULL
) {
299 FreePool (Instance
->Dns4CfgData
.DnsServerList
);
300 Instance
->Dns4CfgData
.DnsServerList
= NULL
;
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 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
379 Status
= EFI_NOT_STARTED
;
383 Token
->Status
= EFI_NOT_READY
;
386 // If zero, use the parameter configured through Dns.Configure() interface.
388 if (Token
->RetryCount
== 0) {
389 Token
->RetryCount
= ConfigData
->RetryCount
;
393 // If zero, use the parameter configured through Dns.Configure() interface.
395 if (Token
->RetryInterval
== 0) {
396 Token
->RetryInterval
= ConfigData
->RetryInterval
;
400 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
402 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
403 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
409 if (ConfigData
->EnableDnsCache
) {
411 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
412 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
413 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
419 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS_HOST_TO_ADDR_DATA
));
420 if (Token
->RspData
.H2AData
== NULL
) {
421 Status
= EFI_OUT_OF_RESOURCES
;
425 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
426 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv4_ADDRESS
) * Index
);
427 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
428 if (Token
->RspData
.H2AData
!= NULL
) {
429 FreePool (Token
->RspData
.H2AData
);
432 Status
= EFI_OUT_OF_RESOURCES
;
437 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns4CacheList
) {
438 Item
= NET_LIST_USER_STRUCT (Entry
, DNS4_CACHE
, AllCacheLink
);
439 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
440 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv4_ADDRESS
));
445 Token
->Status
= EFI_SUCCESS
;
447 if (Token
->Event
!= NULL
) {
448 gBS
->SignalEvent (Token
->Event
);
452 Status
= Token
->Status
;
458 // Construct DNS TokenEntry.
460 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
461 if (TokenEntry
== NULL
) {
462 Status
= EFI_OUT_OF_RESOURCES
;
466 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
467 TokenEntry
->QueryHostName
= HostName
;
468 TokenEntry
->Token
= Token
;
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
)) {
484 if (TokenEntry
!= NULL
) {
485 FreePool (TokenEntry
);
491 ASSERT (Packet
!= NULL
);
494 // Save the token into the Dns4TxTokens map.
496 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
497 if (EFI_ERROR (Status
)) {
498 if (TokenEntry
!= NULL
) {
499 FreePool (TokenEntry
);
510 Status
= DoDnsQuery (Instance
, Packet
);
511 if (EFI_ERROR (Status
)) {
512 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
514 if (TokenEntry
!= NULL
) {
515 FreePool (TokenEntry
);
522 if (QueryName
!= NULL
) {
523 FreePool (QueryName
);
526 gBS
->RestoreTPL (OldTpl
);
531 IPv4 address to host name translation also known as Reverse DNS lookup.
533 The IpToHostName() function is used to translate the host address to host name. A type PTR
534 query is used to get the primary name of the host. Support of this function is optional.
536 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
537 @param[in] IpAddress Ip Address.
538 @param[in] Token Point to the completion token to translate host
539 address to host name.
541 @retval EFI_SUCCESS The operation completed successfully.
542 @retval EFI_UNSUPPORTED This function is not supported.
543 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
547 IpAddress is not valid IP address .
548 @retval EFI_NO_MAPPING There's no source address is available for use.
549 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
550 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
555 IN EFI_DNS4_PROTOCOL
*This
,
556 IN EFI_IPv4_ADDRESS IpAddress
,
557 IN EFI_DNS4_COMPLETION_TOKEN
*Token
560 return EFI_UNSUPPORTED
;
564 Retrieve arbitrary information from the DNS server.
566 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
567 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
568 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
569 required information. The function is optional.
571 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
572 @param[in] QName Pointer to Query Name.
573 @param[in] QType Query Type.
574 @param[in] QClass Query Name.
575 @param[in] Token Point to the completion token to retrieve arbitrary
578 @retval EFI_SUCCESS The operation completed successfully.
579 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
580 QType is not supported
581 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
586 @retval EFI_NO_MAPPING There's no source address is available for use.
587 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
588 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
593 IN EFI_DNS4_PROTOCOL
*This
,
597 IN EFI_DNS4_COMPLETION_TOKEN
*Token
602 DNS_INSTANCE
*Instance
;
604 EFI_DNS4_CONFIG_DATA
*ConfigData
;
606 DNS4_TOKEN_ENTRY
*TokenEntry
;
611 Status
= EFI_SUCCESS
;
616 // Validate the parameters
618 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
619 return EFI_INVALID_PARAMETER
;
622 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
624 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
626 ConfigData
= &(Instance
->Dns4CfgData
);
628 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
629 Status
= EFI_NOT_STARTED
;
633 Token
->Status
= EFI_NOT_READY
;
636 // If zero, use the parameter configured through Dns.Configure() interface.
638 if (Token
->RetryCount
== 0) {
639 Token
->RetryCount
= ConfigData
->RetryCount
;
643 // If zero, use the parameter configured through Dns.Configure() interface.
645 if (Token
->RetryInterval
== 0) {
646 Token
->RetryInterval
= ConfigData
->RetryInterval
;
650 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
652 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
653 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
657 // Construct DNS TokenEntry.
659 TokenEntry
= AllocateZeroPool (sizeof(DNS4_TOKEN_ENTRY
));
660 if (TokenEntry
== NULL
) {
661 Status
= EFI_OUT_OF_RESOURCES
;
665 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
666 TokenEntry
->GeneralLookUp
= TRUE
;
667 TokenEntry
->Token
= Token
;
670 // Construct DNS Query Packet.
672 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
673 if (EFI_ERROR (Status
)) {
674 if (TokenEntry
!= NULL
) {
675 FreePool (TokenEntry
);
681 ASSERT (Packet
!= NULL
);
684 // Save the token into the Dns4TxTokens map.
686 Status
= NetMapInsertTail (&Instance
->Dns4TxTokens
, TokenEntry
, Packet
);
687 if (EFI_ERROR (Status
)) {
688 if (TokenEntry
!= NULL
) {
689 FreePool (TokenEntry
);
700 Status
= DoDnsQuery (Instance
, Packet
);
701 if (EFI_ERROR (Status
)) {
702 Dns4RemoveTokenEntry (&Instance
->Dns4TxTokens
, TokenEntry
);
704 if (TokenEntry
!= NULL
) {
705 FreePool (TokenEntry
);
712 gBS
->RestoreTPL (OldTpl
);
717 This function is to update the DNS Cache.
719 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
720 can be normally dynamically updated after the DNS resolve succeeds. This function
721 provided capability to manually add/delete/modify the DNS cache.
723 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
724 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
725 DNS Cahce. If TRUE, this function will delete
726 matching DNS Cache entry.
727 @param[in] Override If TRUE, the maching DNS cache entry will be
728 overwritten with the supplied parameter. If FALSE,
729 EFI_ACCESS_DENIED will be returned if the entry to
730 be added is already existed.
731 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
733 @retval EFI_SUCCESS The operation completed successfully.
734 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
736 DnsCacheEntry.HostName is NULL.
737 DnsCacheEntry.IpAddress is NULL.
738 DnsCacheEntry.Timeout is zero.
739 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
745 IN EFI_DNS4_PROTOCOL
*This
,
746 IN BOOLEAN DeleteFlag
,
748 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
754 Status
= EFI_SUCCESS
;
756 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
757 return EFI_INVALID_PARAMETER
;
760 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
763 // Update Dns4Cache here.
765 Status
= UpdateDns4Cache (&mDriverData
->Dns4CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
767 gBS
->RestoreTPL (OldTpl
);
773 Polls for incoming data packets and processes outgoing data packets.
775 The Poll() function can be used by network drivers and applications to increase the
776 rate that data packets are moved between the communications device and the transmit
778 In some systems, the periodic timer event in the managed network driver may not poll
779 the underlying communications device fast enough to transmit and/or receive all data
780 packets without missing incoming packets or dropping outgoing packets. Drivers and
781 applications that are experiencing packet loss should try calling the Poll()
784 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
786 @retval EFI_SUCCESS Incoming or outgoing data was processed.
787 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
788 @retval EFI_INVALID_PARAMETER This is NULL.
789 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
790 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
791 queue. Consider increasing the polling rate.
796 IN EFI_DNS4_PROTOCOL
*This
799 DNS_INSTANCE
*Instance
;
800 EFI_UDP4_PROTOCOL
*Udp
;
803 return EFI_INVALID_PARAMETER
;
806 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
808 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
809 return EFI_NOT_STARTED
;
810 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
811 return EFI_DEVICE_ERROR
;
814 Udp
= Instance
->UdpIo
->Protocol
.Udp4
;
816 return Udp
->Poll (Udp
);
820 Abort an asynchronous DNS operation, including translation between IP and Host, and
821 general look up behavior.
823 The Cancel() function is used to abort a pending resolution request. After calling
824 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
825 signaled. If the token is not in one of the queues, which usually means that the
826 asynchronous operation has completed, this function will not signal the token and
827 EFI_NOT_FOUND is returned.
829 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
830 @param[in] Token Pointer to a token that has been issued by
831 EFI_DNS4_PROTOCOL.HostNameToIp (),
832 EFI_DNS4_PROTOCOL.IpToHostName() or
833 EFI_DNS4_PROTOCOL.GeneralLookup().
834 If NULL, all pending tokens are aborted.
836 @retval EFI_SUCCESS Incoming or outgoing data was processed.
837 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
838 @retval EFI_INVALID_PARAMETER This is NULL.
839 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
840 operation was not found in the transmit queue. It
841 was either completed or was not issued by
842 HostNameToIp(), IpToHostName() or GeneralLookup().
847 IN EFI_DNS4_PROTOCOL
*This
,
848 IN EFI_DNS4_COMPLETION_TOKEN
*Token
852 DNS_INSTANCE
*Instance
;
856 return EFI_INVALID_PARAMETER
;
859 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This
);
861 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
862 return EFI_NOT_STARTED
;
865 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
868 // Cancle the tokens specified by Token for this instance.
870 Status
= Dns4InstanceCancelToken (Instance
, Token
);
873 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
877 gBS
->RestoreTPL (OldTpl
);
883 Retrieve mode data of this DNS instance.
885 This function is used to retrieve DNS mode data for this DNS instance.
887 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
888 @param[out] DnsModeData Pointer to the caller-allocated storage for the
889 EFI_DNS6_MODE_DATA data.
891 @retval EFI_SUCCESS The operation completed successfully.
892 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
893 is available because this instance has not been
895 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
896 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
901 IN EFI_DNS6_PROTOCOL
*This
,
902 OUT EFI_DNS6_MODE_DATA
*DnsModeData
905 DNS_INSTANCE
*Instance
;
914 DNS6_SERVER_IP
*ServerItem
;
915 EFI_IPv6_ADDRESS
*ServerList
;
916 DNS6_CACHE
*CacheItem
;
917 EFI_DNS6_CACHE_ENTRY
*CacheList
;
924 Status
= EFI_SUCCESS
;
926 if ((This
== NULL
) || (DnsModeData
== NULL
)) {
927 return EFI_INVALID_PARAMETER
;
930 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
932 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
933 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
934 Status
= EFI_NOT_STARTED
;
938 ZeroMem (DnsModeData
, sizeof (EFI_DNS6_MODE_DATA
));
941 // Get the current configuration data of this instance.
943 Status
= Dns6CopyConfigure (&DnsModeData
->DnsConfigData
, &Instance
->Dns6CfgData
);
944 if (EFI_ERROR (Status
)) {
949 // Get the DnsServerCount and DnsServerList
952 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
955 DnsModeData
->DnsServerCount
= (UINT32
) Index
;
956 ServerList
= AllocatePool (sizeof(EFI_IPv6_ADDRESS
) * DnsModeData
->DnsServerCount
);
957 if (ServerList
== NULL
) {
958 Status
= EFI_OUT_OF_RESOURCES
;
959 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
964 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6ServerList
) {
965 ServerItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_SERVER_IP
, AllServerLink
);
966 CopyMem (ServerList
+ Index
, &ServerItem
->Dns6ServerIp
, sizeof (EFI_IPv6_ADDRESS
));
969 DnsModeData
->DnsServerList
= ServerList
;
972 // Get the DnsCacheCount and DnsCacheList
975 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
978 DnsModeData
->DnsCacheCount
= (UINT32
) Index
;
979 CacheList
= AllocatePool (sizeof(EFI_DNS6_CACHE_ENTRY
) * DnsModeData
->DnsCacheCount
);
980 if (CacheList
== NULL
) {
981 Status
= EFI_OUT_OF_RESOURCES
;
982 Dns6CleanConfigure (&DnsModeData
->DnsConfigData
);
983 FreePool (ServerList
);
988 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
989 CacheItem
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
990 CopyMem (CacheList
+ Index
, &CacheItem
->DnsCache
, sizeof (EFI_DNS6_CACHE_ENTRY
));
993 DnsModeData
->DnsCacheList
= CacheList
;
996 gBS
->RestoreTPL (OldTpl
);
1001 Configure this DNS instance.
1003 The Configure() function is used to set and change the configuration data for this
1004 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
1006 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1007 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
1008 storage to be allocated and released by caller.
1010 @retval EFI_SUCCESS The operation completed successfully.
1011 @retval EFI_INVALID_PARAMTER This is NULL.
1012 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
1013 DnsServerList is NULL while DnsServerList Count is not ZERO.
1014 DnsServerList Count is ZERO while DnsServerList is not NULL.
1015 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
1016 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
1017 EFI DNSv6 Protocol instance is not configured.
1018 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1019 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1020 reconfigure the instance the caller must call Configure() with
1021 NULL first to return driver to unconfigured state.
1026 IN EFI_DNS6_PROTOCOL
*This
,
1027 IN EFI_DNS6_CONFIG_DATA
*DnsConfigData
1031 DNS_INSTANCE
*Instance
;
1035 UINT32 ServerListCount
;
1036 EFI_IPv6_ADDRESS
*ServerList
;
1038 Status
= EFI_SUCCESS
;
1042 (DnsConfigData
!= NULL
&& ((DnsConfigData
->DnsServerCount
!= 0 && DnsConfigData
->DnsServerList
== NULL
) ||
1043 (DnsConfigData
->DnsServerCount
== 0 && DnsConfigData
->DnsServerList
!= NULL
)))) {
1044 return EFI_INVALID_PARAMETER
;
1047 if (DnsConfigData
!= NULL
&& DnsConfigData
->Protocol
!= DNS_PROTOCOL_UDP
) {
1048 return EFI_UNSUPPORTED
;
1051 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1053 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1055 if (DnsConfigData
== NULL
) {
1056 ZeroMem (&Instance
->SessionDnsServer
, sizeof (EFI_IP_ADDRESS
));
1059 // Reset the Instance if ConfigData is NULL
1061 if (!NetMapIsEmpty(&Instance
->Dns6TxTokens
)) {
1062 Dns6InstanceCancelToken(Instance
, NULL
);
1065 if (Instance
->UdpIo
!= NULL
){
1066 UdpIoCleanIo (Instance
->UdpIo
);
1069 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1070 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1072 ZeroMem (&Instance
->Dns6CfgData
, sizeof (EFI_DNS6_CONFIG_DATA
));
1074 Instance
->State
= DNS_STATE_UNCONFIGED
;
1077 // Configure the parameters for new operation.
1079 if (!NetIp6IsUnspecifiedAddr (&DnsConfigData
->StationIp
) && !NetIp6IsValidUnicast (&DnsConfigData
->StationIp
)) {
1080 Status
= EFI_INVALID_PARAMETER
;
1084 Status
= Dns6CopyConfigure (&Instance
->Dns6CfgData
, DnsConfigData
);
1085 if (EFI_ERROR (Status
)) {
1089 if (DnsConfigData
->DnsServerCount
== 0) {
1090 gBS
->RestoreTPL (OldTpl
);
1093 //The DNS instance will retrieve DNS server from DHCP Server.
1095 Status
= GetDns6ServerFromDhcp6 (
1096 Instance
->Service
->ImageHandle
,
1097 Instance
->Service
->ControllerHandle
,
1101 if (EFI_ERROR (Status
)) {
1105 ASSERT(ServerList
!= NULL
);
1107 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1109 CopyMem (&Instance
->SessionDnsServer
.v6
, &ServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1111 CopyMem (&Instance
->SessionDnsServer
.v6
, &DnsConfigData
->DnsServerList
[0], sizeof (EFI_IPv6_ADDRESS
));
1117 gBS
->RestoreTPL (OldTpl
);
1118 Status
= Dns6ConfigUdp (Instance
, Instance
->UdpIo
);
1119 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1120 if (EFI_ERROR (Status
)) {
1121 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1122 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1123 Instance
->Dns6CfgData
.DnsServerList
= NULL
;
1129 // Add configured DNS server used by this instance to ServerList.
1131 Status
= AddDns6ServerIp (&mDriverData
->Dns6ServerList
, Instance
->SessionDnsServer
.v6
);
1132 if (EFI_ERROR (Status
)) {
1133 if (Instance
->Dns6CfgData
.DnsServerList
!= NULL
) {
1134 FreePool (Instance
->Dns6CfgData
.DnsServerList
);
1135 Instance
->Dns6CfgData
.DnsServerList
= NULL
;
1140 Instance
->State
= DNS_STATE_CONFIGED
;
1144 gBS
->RestoreTPL (OldTpl
);
1149 Host name to host address translation.
1151 The HostNameToIp () function is used to translate the host name to host IP address. A
1152 type AAAA query is used to get the one or more IPv6 addresses for this host.
1154 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1155 @param[in] HostName Host name.
1156 @param[in] Token Point to the completion token to translate host name
1159 @retval EFI_SUCCESS The operation completed successfully.
1160 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1163 Token.Event is NULL.
1164 HostName is NULL or buffer contained unsupported characters.
1165 @retval EFI_NO_MAPPING There's no source address is available for use.
1166 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1167 @retval EFI_NOT_STARTED This instance has not been started.
1168 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1173 IN EFI_DNS6_PROTOCOL
*This
,
1174 IN CHAR16
*HostName
,
1175 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1180 DNS_INSTANCE
*Instance
;
1182 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1191 DNS6_TOKEN_ENTRY
*TokenEntry
;
1196 Status
= EFI_SUCCESS
;
1203 // Validate the parameters
1205 if ((This
== NULL
) || (HostName
== NULL
) || Token
== NULL
) {
1206 return EFI_INVALID_PARAMETER
;
1209 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1211 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1213 ConfigData
= &(Instance
->Dns6CfgData
);
1215 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1216 Status
= EFI_NOT_STARTED
;
1220 Token
->Status
= EFI_NOT_READY
;
1223 // If zero, use the parameter configured through Dns.Configure() interface.
1225 if (Token
->RetryCount
== 0) {
1226 Token
->RetryCount
= ConfigData
->RetryCount
;
1230 // If zero, use the parameter configured through Dns.Configure() interface.
1232 if (Token
->RetryInterval
== 0) {
1233 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1237 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
1239 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1240 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1246 if (ConfigData
->EnableDnsCache
) {
1248 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1249 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1250 if (StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1256 Token
->RspData
.H2AData
= AllocatePool (sizeof (DNS6_HOST_TO_ADDR_DATA
));
1257 if (Token
->RspData
.H2AData
== NULL
) {
1258 Status
= EFI_OUT_OF_RESOURCES
;
1262 Token
->RspData
.H2AData
->IpCount
= (UINT32
)Index
;
1263 Token
->RspData
.H2AData
->IpList
= AllocatePool (sizeof (EFI_IPv6_ADDRESS
) * Index
);
1264 if (Token
->RspData
.H2AData
->IpList
== NULL
) {
1265 if (Token
->RspData
.H2AData
!= NULL
) {
1266 FreePool (Token
->RspData
.H2AData
);
1269 Status
= EFI_OUT_OF_RESOURCES
;
1274 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &mDriverData
->Dns6CacheList
) {
1275 Item
= NET_LIST_USER_STRUCT (Entry
, DNS6_CACHE
, AllCacheLink
);
1276 if ((UINT32
)Index
< Token
->RspData
.H2AData
->IpCount
&& StrCmp (HostName
, Item
->DnsCache
.HostName
) == 0) {
1277 CopyMem ((Token
->RspData
.H2AData
->IpList
) + Index
, Item
->DnsCache
.IpAddress
, sizeof (EFI_IPv6_ADDRESS
));
1282 Token
->Status
= EFI_SUCCESS
;
1284 if (Token
->Event
!= NULL
) {
1285 gBS
->SignalEvent (Token
->Event
);
1289 Status
= Token
->Status
;
1295 // Construct DNS TokenEntry.
1297 TokenEntry
= AllocateZeroPool (sizeof (DNS6_TOKEN_ENTRY
));
1298 if (TokenEntry
== NULL
) {
1299 Status
= EFI_OUT_OF_RESOURCES
;
1303 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1304 TokenEntry
->QueryHostName
= HostName
;
1305 TokenEntry
->Token
= Token
;
1311 QueryName
= NetLibCreateDnsQName (TokenEntry
->QueryHostName
);
1312 if (QueryName
== NULL
) {
1313 Status
= EFI_OUT_OF_RESOURCES
;
1318 // Construct DNS Query Packet.
1320 Status
= ConstructDNSQuery (Instance
, QueryName
, DNS_TYPE_AAAA
, DNS_CLASS_INET
, &Packet
);
1321 if (EFI_ERROR (Status
)) {
1322 if (TokenEntry
!= NULL
) {
1323 FreePool (TokenEntry
);
1329 ASSERT (Packet
!= NULL
);
1332 // Save the token into the Dns6TxTokens map.
1334 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1335 if (EFI_ERROR (Status
)) {
1336 if (TokenEntry
!= NULL
) {
1337 FreePool (TokenEntry
);
1340 NetbufFree (Packet
);
1348 Status
= DoDnsQuery (Instance
, Packet
);
1349 if (EFI_ERROR (Status
)) {
1350 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1352 if (TokenEntry
!= NULL
) {
1353 FreePool (TokenEntry
);
1356 NetbufFree (Packet
);
1360 if (QueryName
!= NULL
) {
1361 FreePool (QueryName
);
1364 gBS
->RestoreTPL (OldTpl
);
1369 Host address to host name translation.
1371 The IpToHostName () function is used to translate the host address to host name. A
1372 type PTR query is used to get the primary name of the host. Implementation can choose
1373 to support this function or not.
1375 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1376 @param[in] IpAddress Ip Address.
1377 @param[in] Token Point to the completion token to translate host
1378 address to host name.
1380 @retval EFI_SUCCESS The operation completed successfully.
1381 @retval EFI_UNSUPPORTED This function is not supported.
1382 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1385 Token.Event is NULL.
1386 IpAddress is not valid IP address.
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
,
1395 IN EFI_IPv6_ADDRESS IpAddress
,
1396 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1399 return EFI_UNSUPPORTED
;
1403 This function provides capability to retrieve arbitrary information from the DNS
1406 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1407 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1408 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1409 required information. The function is optional. Implementation can choose to support
1412 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1413 @param[in] QName Pointer to Query Name.
1414 @param[in] QType Query Type.
1415 @param[in] QClass Query Name.
1416 @param[in] Token Point to the completion token to retrieve arbitrary
1419 @retval EFI_SUCCESS The operation completed successfully.
1420 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1421 QType is not supported
1422 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1425 Token.Event is NULL.
1427 @retval EFI_NO_MAPPING There's no source address is available for use.
1428 @retval EFI_NOT_STARTED This instance has not been started.
1429 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1434 IN EFI_DNS6_PROTOCOL
*This
,
1438 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1443 DNS_INSTANCE
*Instance
;
1445 EFI_DNS6_CONFIG_DATA
*ConfigData
;
1447 DNS6_TOKEN_ENTRY
*TokenEntry
;
1452 Status
= EFI_SUCCESS
;
1457 // Validate the parameters
1459 if ((This
== NULL
) || (QName
== NULL
) || Token
== NULL
) {
1460 return EFI_INVALID_PARAMETER
;
1463 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1465 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1467 ConfigData
= &(Instance
->Dns6CfgData
);
1469 if (Instance
->State
!= DNS_STATE_CONFIGED
) {
1470 Status
= EFI_NOT_STARTED
;
1474 Token
->Status
= EFI_NOT_READY
;
1477 // If zero, use the parameter configured through Dns.Configure() interface.
1479 if (Token
->RetryCount
== 0) {
1480 Token
->RetryCount
= ConfigData
->RetryCount
;
1484 // If zero, use the parameter configured through Dns.Configure() interface.
1486 if (Token
->RetryInterval
== 0) {
1487 Token
->RetryInterval
= ConfigData
->RetryInterval
;
1491 // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second.
1493 if (Token
->RetryInterval
< DNS_DEFAULT_TIMEOUT
) {
1494 Token
->RetryInterval
= DNS_DEFAULT_TIMEOUT
;
1498 // Construct DNS TokenEntry.
1500 TokenEntry
= AllocateZeroPool (sizeof(DNS6_TOKEN_ENTRY
));
1501 if (TokenEntry
== NULL
) {
1502 Status
= EFI_OUT_OF_RESOURCES
;
1506 TokenEntry
->PacketToLive
= Token
->RetryInterval
;
1507 TokenEntry
->GeneralLookUp
= TRUE
;
1508 TokenEntry
->Token
= Token
;
1511 // Construct DNS Query Packet.
1513 Status
= ConstructDNSQuery (Instance
, QName
, QType
, QClass
, &Packet
);
1514 if (EFI_ERROR (Status
)) {
1515 if (TokenEntry
!= NULL
) {
1516 FreePool (TokenEntry
);
1522 ASSERT (Packet
!= NULL
);
1525 // Save the token into the Dns6TxTokens map.
1527 Status
= NetMapInsertTail (&Instance
->Dns6TxTokens
, TokenEntry
, Packet
);
1528 if (EFI_ERROR (Status
)) {
1529 if (TokenEntry
!= NULL
) {
1530 FreePool (TokenEntry
);
1533 NetbufFree (Packet
);
1541 Status
= DoDnsQuery (Instance
, Packet
);
1542 if (EFI_ERROR (Status
)) {
1543 Dns6RemoveTokenEntry (&Instance
->Dns6TxTokens
, TokenEntry
);
1545 if (TokenEntry
!= NULL
) {
1546 FreePool (TokenEntry
);
1549 NetbufFree (Packet
);
1553 gBS
->RestoreTPL (OldTpl
);
1558 This function is to update the DNS Cache.
1560 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1561 can be normally dynamically updated after the DNS resolve succeeds. This function
1562 provided capability to manually add/delete/modify the DNS cache.
1564 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1565 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1566 DNS Cahce. If TRUE, this function will delete
1567 matching DNS Cache entry.
1568 @param[in] Override If TRUE, the maching DNS cache entry will be
1569 overwritten with the supplied parameter. If FALSE,
1570 EFI_ACCESS_DENIED will be returned if the entry to
1571 be added is already existed.
1572 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1574 @retval EFI_SUCCESS The operation completed successfully.
1575 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1577 DnsCacheEntry.HostName is NULL.
1578 DnsCacheEntry.IpAddress is NULL.
1579 DnsCacheEntry.Timeout is zero.
1580 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1582 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1586 Dns6UpdateDnsCache (
1587 IN EFI_DNS6_PROTOCOL
*This
,
1588 IN BOOLEAN DeleteFlag
,
1589 IN BOOLEAN Override
,
1590 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1596 Status
= EFI_SUCCESS
;
1598 if (DnsCacheEntry
.HostName
== NULL
|| DnsCacheEntry
.IpAddress
== NULL
|| DnsCacheEntry
.Timeout
== 0) {
1599 return EFI_INVALID_PARAMETER
;
1602 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1605 // Update Dns6Cache here.
1607 Status
= UpdateDns6Cache (&mDriverData
->Dns6CacheList
, DeleteFlag
, Override
, DnsCacheEntry
);
1609 gBS
->RestoreTPL (OldTpl
);
1615 Polls for incoming data packets and processes outgoing data packets.
1617 The Poll() function can be used by network drivers and applications to increase the
1618 rate that data packets are moved between the communications device and the transmit
1621 In some systems, the periodic timer event in the managed network driver may not poll
1622 the underlying communications device fast enough to transmit and/or receive all data
1623 packets without missing incoming packets or dropping outgoing packets. Drivers and
1624 applications that are experiencing packet loss should try calling the Poll()
1625 function more often.
1627 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1629 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1630 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1631 @retval EFI_INVALID_PARAMETER This is NULL.
1632 @retval EFI_NO_MAPPING There is no source address is available for use.
1633 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1634 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1635 queue. Consider increasing the polling rate.
1640 IN EFI_DNS6_PROTOCOL
*This
1643 DNS_INSTANCE
*Instance
;
1644 EFI_UDP6_PROTOCOL
*Udp
;
1647 return EFI_INVALID_PARAMETER
;
1650 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1652 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1653 return EFI_NOT_STARTED
;
1654 } else if (Instance
->State
== DNS_STATE_DESTROY
) {
1655 return EFI_DEVICE_ERROR
;
1658 Udp
= Instance
->UdpIo
->Protocol
.Udp6
;
1660 return Udp
->Poll (Udp
);
1664 Abort an asynchronous DNS operation, including translation between IP and Host, and
1665 general look up behavior.
1667 The Cancel() function is used to abort a pending resolution request. After calling
1668 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1669 signaled. If the token is not in one of the queues, which usually means that the
1670 asynchronous operation has completed, this function will not signal the token and
1671 EFI_NOT_FOUND is returned.
1673 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1674 @param[in] Token Pointer to a token that has been issued by
1675 EFI_DNS6_PROTOCOL.HostNameToIp (),
1676 EFI_DNS6_PROTOCOL.IpToHostName() or
1677 EFI_DNS6_PROTOCOL.GeneralLookup().
1678 If NULL, all pending tokens are aborted.
1680 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1681 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1682 @retval EFI_INVALID_PARAMETER This is NULL.
1683 @retval EFI_NO_MAPPING There's no source address is available for use.
1684 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1685 operation was not found in the transmit queue. It
1686 was either completed or was not issued by
1687 HostNameToIp(), IpToHostName() or GeneralLookup().
1692 IN EFI_DNS6_PROTOCOL
*This
,
1693 IN EFI_DNS6_COMPLETION_TOKEN
*Token
1697 DNS_INSTANCE
*Instance
;
1701 return EFI_INVALID_PARAMETER
;
1704 Instance
= DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This
);
1706 if (Instance
->State
== DNS_STATE_UNCONFIGED
) {
1707 return EFI_NOT_STARTED
;
1710 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
1713 // Cancle the tokens specified by Token for this instance.
1715 Status
= Dns6InstanceCancelToken (Instance
, Token
);
1718 // Dispatch the DPC queued by the NotifyFunction of the canceled token's events.
1722 gBS
->RestoreTPL (OldTpl
);