VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.h@ 99396

最後變更 在這個檔案從99396是 89983,由 vboxsync 提交於 3 年 前

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 41.6 KB
 
1/** @file
2DnsDxe support functions implementation.
3
4Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#ifndef __EFI_DNS_IMPL_H_
10#define __EFI_DNS_IMPL_H_
11
12#include <Uefi.h>
13
14//
15// Libraries classes
16//
17#include <Library/BaseLib.h>
18#include <Library/UefiLib.h>
19#include <Library/UefiBootServicesTableLib.h>
20#include <Library/UefiDriverEntryPoint.h>
21#include <Library/UefiRuntimeServicesTableLib.h>
22#include <Library/BaseMemoryLib.h>
23#include <Library/MemoryAllocationLib.h>
24#include <Library/NetLib.h>
25#include <Library/DebugLib.h>
26#include <Library/DpcLib.h>
27#include <Library/PrintLib.h>
28#include <Library/UdpIoLib.h>
29
30//
31// UEFI Driver Model Protocols
32//
33#include <Protocol/DriverBinding.h>
34#include <Protocol/ComponentName2.h>
35#include <Protocol/ComponentName.h>
36
37#include <Protocol/Udp4.h>
38#include <Protocol/Dhcp4.h>
39#include <Protocol/Dns4.h>
40
41#include <Protocol/Udp6.h>
42#include <Protocol/Dhcp6.h>
43#include <Protocol/Dns6.h>
44
45#include <Protocol/Ip4Config2.h>
46
47#include "DnsDriver.h"
48#include "DnsDhcp.h"
49
50//
51// Driver Version
52//
53#define DNS_VERSION 0x00000000
54
55//
56// Protocol instances
57//
58extern EFI_COMPONENT_NAME_PROTOCOL gDnsComponentName;
59extern EFI_COMPONENT_NAME2_PROTOCOL gDnsComponentName2;
60extern EFI_UNICODE_STRING_TABLE *gDnsControllerNameTable;
61
62extern EFI_DRIVER_BINDING_PROTOCOL gDns4DriverBinding;
63extern EFI_SERVICE_BINDING_PROTOCOL mDns4ServiceBinding;
64extern EFI_DNS4_PROTOCOL mDns4Protocol;
65
66extern EFI_DRIVER_BINDING_PROTOCOL gDns6DriverBinding;
67extern EFI_SERVICE_BINDING_PROTOCOL mDns6ServiceBinding;
68extern EFI_DNS6_PROTOCOL mDns6Protocol;
69
70//
71// DNS related
72//
73#define DNS_SERVER_PORT 53
74
75#define DNS_PROTOCOL_UDP EFI_IP_PROTO_UDP
76#define DNS_PROTOCOL_TCP EFI_IP_PROTO_TCP
77
78#define DNS_STATE_UNCONFIGED 0
79#define DNS_STATE_CONFIGED 1
80#define DNS_STATE_DESTROY 2
81
82#define DNS_DEFAULT_TIMEOUT 2
83
84#define DNS_TIME_TO_GETMAP 5
85
86#pragma pack(1)
87
88typedef union _DNS_FLAGS DNS_FLAGS;
89
90typedef struct {
91 LIST_ENTRY AllCacheLink;
92 EFI_DNS4_CACHE_ENTRY DnsCache;
93} DNS4_CACHE;
94
95typedef struct {
96 LIST_ENTRY AllCacheLink;
97 EFI_DNS6_CACHE_ENTRY DnsCache;
98} DNS6_CACHE;
99
100typedef struct {
101 LIST_ENTRY AllServerLink;
102 EFI_IPv4_ADDRESS Dns4ServerIp;
103} DNS4_SERVER_IP;
104
105typedef struct {
106 LIST_ENTRY AllServerLink;
107 EFI_IPv6_ADDRESS Dns6ServerIp;
108} DNS6_SERVER_IP;
109
110typedef struct {
111 UINT32 RetryCounting;
112 UINT32 PacketToLive;
113 CHAR16 *QueryHostName;
114 EFI_IPv4_ADDRESS QueryIpAddress;
115 BOOLEAN GeneralLookUp;
116 EFI_DNS4_COMPLETION_TOKEN *Token;
117} DNS4_TOKEN_ENTRY;
118
119typedef struct {
120 UINT32 RetryCounting;
121 UINT32 PacketToLive;
122 CHAR16 *QueryHostName;
123 EFI_IPv6_ADDRESS QueryIpAddress;
124 BOOLEAN GeneralLookUp;
125 EFI_DNS6_COMPLETION_TOKEN *Token;
126} DNS6_TOKEN_ENTRY;
127
128union _DNS_FLAGS {
129 struct {
130 UINT16 RCode:4;
131 UINT16 Zero:3;
132 UINT16 RA:1;
133 UINT16 RD:1;
134 UINT16 TC:1;
135 UINT16 AA:1;
136 UINT16 OpCode:4;
137 UINT16 QR:1;
138 } Bits;
139 UINT16 Uint16;
140};
141
142#define DNS_FLAGS_QR_QUERY 0
143#define DNS_FLAGS_QR_RESPONSE 1
144
145#define DNS_FLAGS_OPCODE_STANDARD 0
146#define DNS_FLAGS_OPCODE_INVERSE 1
147#define DNS_FLAGS_OPCODE_SERVER_STATE 2
148
149#define DNS_FLAGS_RCODE_NO_ERROR 0
150#define DNS_FLAGS_RCODE_NAME_ERROR 3
151
152typedef struct {
153 UINT16 Identification;
154 DNS_FLAGS Flags;
155 UINT16 QuestionsNum;
156 UINT16 AnswersNum;
157 UINT16 AuthorityNum;
158 UINT16 AditionalNum;
159} DNS_HEADER;
160
161typedef struct {
162 UINT16 Type;
163 UINT16 Class;
164} DNS_QUERY_SECTION;
165
166typedef struct {
167 UINT16 Type;
168 UINT16 Class;
169 UINT32 Ttl;
170 UINT16 DataLength;
171} DNS_ANSWER_SECTION;
172
173#define DNS4_DOMAIN L"in-addr.arpa"
174#define DNS6_DOMAIN L"IP6.ARPA"
175
176
177#pragma pack()
178
179/**
180 Remove TokenEntry from TokenMap.
181
182 @param[in] TokenMap All DNSv4 Token entrys.
183 @param[in] TokenEntry TokenEntry need to be removed.
184
185 @retval EFI_SUCCESS Remove TokenEntry from TokenMap successfully.
186 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
187
188**/
189EFI_STATUS
190Dns4RemoveTokenEntry (
191 IN NET_MAP *TokenMap,
192 IN DNS4_TOKEN_ENTRY *TokenEntry
193 );
194
195/**
196 Remove TokenEntry from TokenMap.
197
198 @param[in] TokenMap All DNSv6 Token entrys.
199 @param[in] TokenEntry TokenEntry need to be removed.
200
201 @retval EFI_SUCCESS Remove TokenEntry from TokenMap successfully.
202 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
203
204**/
205EFI_STATUS
206Dns6RemoveTokenEntry (
207 IN NET_MAP *TokenMap,
208 IN DNS6_TOKEN_ENTRY *TokenEntry
209 );
210
211/**
212 This function cancel the token specified by Arg in the Map.
213
214 @param[in] Map Pointer to the NET_MAP.
215 @param[in] Item Pointer to the NET_MAP_ITEM.
216 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
217 the tokens in this Map will be cancelled.
218 This parameter is optional and may be NULL.
219
220 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
221 is not the same as that in the Item, if Arg is not
222 NULL.
223 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
224 cancelled.
225
226**/
227EFI_STATUS
228EFIAPI
229Dns4CancelTokens (
230 IN NET_MAP *Map,
231 IN NET_MAP_ITEM *Item,
232 IN VOID *Arg OPTIONAL
233 );
234
235/**
236 This function cancel the token specified by Arg in the Map.
237
238 @param[in] Map Pointer to the NET_MAP.
239 @param[in] Item Pointer to the NET_MAP_ITEM.
240 @param[in] Arg Pointer to the token to be cancelled. If NULL, all
241 the tokens in this Map will be cancelled.
242 This parameter is optional and may be NULL.
243
244 @retval EFI_SUCCESS The token is cancelled if Arg is NULL, or the token
245 is not the same as that in the Item, if Arg is not
246 NULL.
247 @retval EFI_ABORTED Arg is not NULL, and the token specified by Arg is
248 cancelled.
249
250**/
251EFI_STATUS
252EFIAPI
253Dns6CancelTokens (
254 IN NET_MAP *Map,
255 IN NET_MAP_ITEM *Item,
256 IN VOID *Arg OPTIONAL
257 );
258
259/**
260 Get the TokenEntry from the TokensMap.
261
262 @param[in] TokensMap All DNSv4 Token entrys
263 @param[in] Token Pointer to the token to be get.
264 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
265
266 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap successfully.
267 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
268
269**/
270EFI_STATUS
271EFIAPI
272GetDns4TokenEntry (
273 IN NET_MAP *TokensMap,
274 IN EFI_DNS4_COMPLETION_TOKEN *Token,
275 OUT DNS4_TOKEN_ENTRY **TokenEntry
276 );
277
278/**
279 Get the TokenEntry from the TokensMap.
280
281 @param[in] TokensMap All DNSv6 Token entrys
282 @param[in] Token Pointer to the token to be get.
283 @param[out] TokenEntry Pointer to TokenEntry corresponding Token.
284
285 @retval EFI_SUCCESS Get the TokenEntry from the TokensMap successfully.
286 @retval EFI_NOT_FOUND TokenEntry is not found in TokenMap.
287
288**/
289EFI_STATUS
290EFIAPI
291GetDns6TokenEntry (
292 IN NET_MAP *TokensMap,
293 IN EFI_DNS6_COMPLETION_TOKEN *Token,
294 OUT DNS6_TOKEN_ENTRY **TokenEntry
295 );
296
297/**
298 Cancel DNS4 tokens from the DNS4 instance.
299
300 @param[in] Instance Pointer to the DNS instance context data.
301 @param[in] Token Pointer to the token to be canceled. If NULL, all
302 tokens in this instance will be cancelled.
303 This parameter is optional and may be NULL.
304
305 @retval EFI_SUCCESS The Token is cancelled.
306 @retval EFI_NOT_FOUND The Token is not found.
307
308**/
309EFI_STATUS
310Dns4InstanceCancelToken (
311 IN DNS_INSTANCE *Instance,
312 IN EFI_DNS4_COMPLETION_TOKEN *Token
313 );
314
315/**
316 Cancel DNS6 tokens from the DNS6 instance.
317
318 @param[in] Instance Pointer to the DNS instance context data.
319 @param[in] Token Pointer to the token to be canceled. If NULL, all
320 tokens in this instance will be cancelled.
321 This parameter is optional and may be NULL.
322
323 @retval EFI_SUCCESS The Token is cancelled.
324 @retval EFI_NOT_FOUND The Token is not found.
325
326**/
327EFI_STATUS
328Dns6InstanceCancelToken (
329 IN DNS_INSTANCE *Instance,
330 IN EFI_DNS6_COMPLETION_TOKEN *Token
331 );
332
333/**
334 Free the resource related to the configure parameters.
335
336 @param Config The DNS configure data
337
338**/
339VOID
340Dns4CleanConfigure (
341 IN OUT EFI_DNS4_CONFIG_DATA *Config
342 );
343
344/**
345 Free the resource related to the configure parameters.
346
347 @param Config The DNS configure data
348
349**/
350VOID
351Dns6CleanConfigure (
352 IN OUT EFI_DNS6_CONFIG_DATA *Config
353 );
354
355/**
356 Allocate memory for configure parameter such as timeout value for Dst,
357 then copy the configure parameter from Src to Dst.
358
359 @param[out] Dst The destination DHCP configure data.
360 @param[in] Src The source DHCP configure data.
361
362 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
363 @retval EFI_SUCCESS The configure is copied.
364
365**/
366EFI_STATUS
367Dns4CopyConfigure (
368 OUT EFI_DNS4_CONFIG_DATA *Dst,
369 IN EFI_DNS4_CONFIG_DATA *Src
370 );
371
372/**
373 Allocate memory for configure parameter such as timeout value for Dst,
374 then copy the configure parameter from Src to Dst.
375
376 @param[out] Dst The destination DHCP configure data.
377 @param[in] Src The source DHCP configure data.
378
379 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
380 @retval EFI_SUCCESS The configure is copied.
381
382**/
383EFI_STATUS
384Dns6CopyConfigure (
385 OUT EFI_DNS6_CONFIG_DATA *Dst,
386 IN EFI_DNS6_CONFIG_DATA *Src
387 );
388
389/**
390 Callback of Dns packet. Does nothing.
391
392 @param Arg The context.
393
394**/
395VOID
396EFIAPI
397DnsDummyExtFree (
398 IN VOID *Arg
399 );
400
401/**
402 Poll the UDP to get the IP4 default address, which may be retrieved
403 by DHCP.
404
405 The default time out value is 5 seconds. If IP has retrieved the default address,
406 the UDP is reconfigured.
407
408 @param Instance The DNS instance
409 @param UdpIo The UDP_IO to poll
410 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
411
412 @retval TRUE The default address is retrieved and UDP is reconfigured.
413 @retval FALSE Some error occurred.
414
415**/
416BOOLEAN
417Dns4GetMapping (
418 IN DNS_INSTANCE *Instance,
419 IN UDP_IO *UdpIo,
420 IN EFI_UDP4_CONFIG_DATA *UdpCfgData
421 );
422
423/**
424 Configure the opened Udp6 instance until the corresponding Ip6 instance
425 has been configured.
426
427 @param Instance The DNS instance
428 @param UdpIo The UDP_IO to poll
429 @param UdpCfgData The UDP configure data to reconfigure the UDP_IO
430
431 @retval TRUE Configure the Udp6 instance successfully.
432 @retval FALSE Some error occurred.
433
434**/
435BOOLEAN
436Dns6GetMapping (
437 IN DNS_INSTANCE *Instance,
438 IN UDP_IO *UdpIo,
439 IN EFI_UDP6_CONFIG_DATA *UdpCfgData
440 );
441
442/**
443 Configure the UDP.
444
445 @param Instance The DNS session
446 @param UdpIo The UDP_IO instance
447
448 @retval EFI_SUCCESS The UDP is successfully configured for the
449 session.
450
451**/
452EFI_STATUS
453Dns4ConfigUdp (
454 IN DNS_INSTANCE *Instance,
455 IN UDP_IO *UdpIo
456 );
457
458/**
459 Configure the UDP.
460
461 @param Instance The DNS session
462 @param UdpIo The UDP_IO instance
463
464 @retval EFI_SUCCESS The UDP is successfully configured for the
465 session.
466
467**/
468EFI_STATUS
469Dns6ConfigUdp (
470 IN DNS_INSTANCE *Instance,
471 IN UDP_IO *UdpIo
472 );
473
474/**
475 Update Dns4 cache to shared list of caches of all DNSv4 instances.
476
477 @param Dns4CacheList All Dns4 cache list.
478 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
479 If TRUE, this function will delete matching DNS Cache entry.
480 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
481 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
482 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
483
484 @retval EFI_SUCCESS Update Dns4 cache successfully.
485 @retval Others Failed to update Dns4 cache.
486
487**/
488EFI_STATUS
489EFIAPI
490UpdateDns4Cache (
491 IN LIST_ENTRY *Dns4CacheList,
492 IN BOOLEAN DeleteFlag,
493 IN BOOLEAN Override,
494 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
495 );
496
497/**
498 Update Dns6 cache to shared list of caches of all DNSv6 instances.
499
500 @param Dns6CacheList All Dns6 cache list.
501 @param DeleteFlag If FALSE, this function is to add one entry to the DNS Cache.
502 If TRUE, this function will delete matching DNS Cache entry.
503 @param Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter.
504 If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
505 @param DnsCacheEntry Entry Pointer to DNS Cache entry.
506
507 @retval EFI_SUCCESS Update Dns6 cache successfully.
508 @retval Others Failed to update Dns6 cache.
509**/
510EFI_STATUS
511EFIAPI
512UpdateDns6Cache (
513 IN LIST_ENTRY *Dns6CacheList,
514 IN BOOLEAN DeleteFlag,
515 IN BOOLEAN Override,
516 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
517 );
518
519/**
520 Add Dns4 ServerIp to common list of addresses of all configured DNSv4 server.
521
522 @param Dns4ServerList Common list of addresses of all configured DNSv4 server.
523 @param ServerIp DNS server Ip.
524
525 @retval EFI_SUCCESS Add Dns4 ServerIp to common list successfully.
526 @retval Others Failed to add Dns4 ServerIp to common list.
527
528**/
529EFI_STATUS
530EFIAPI
531AddDns4ServerIp (
532 IN LIST_ENTRY *Dns4ServerList,
533 IN EFI_IPv4_ADDRESS ServerIp
534 );
535
536/**
537 Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server.
538
539 @param Dns6ServerList Common list of addresses of all configured DNSv6 server.
540 @param ServerIp DNS server Ip.
541
542 @retval EFI_SUCCESS Add Dns6 ServerIp to common list successfully.
543 @retval Others Failed to add Dns6 ServerIp to common list.
544
545**/
546EFI_STATUS
547EFIAPI
548AddDns6ServerIp (
549 IN LIST_ENTRY *Dns6ServerList,
550 IN EFI_IPv6_ADDRESS ServerIp
551 );
552
553/**
554 Find out whether the response is valid or invalid.
555
556 @param TokensMap All DNS transmittal Tokens entry.
557 @param Identification Identification for queried packet.
558 @param Type Type for queried packet.
559 @param Class Class for queried packet.
560 @param Item Return corresponding Token entry.
561
562 @retval TRUE The response is valid.
563 @retval FALSE The response is invalid.
564
565**/
566BOOLEAN
567IsValidDnsResponse (
568 IN NET_MAP *TokensMap,
569 IN UINT16 Identification,
570 IN UINT16 Type,
571 IN UINT16 Class,
572 OUT NET_MAP_ITEM **Item
573 );
574
575/**
576 Parse Dns Response.
577
578 @param Instance The DNS instance
579 @param RxString Received buffer.
580 @param Length Received buffer length.
581 @param Completed Flag to indicate that Dns response is valid.
582
583 @retval EFI_SUCCESS Parse Dns Response successfully.
584 @retval Others Failed to parse Dns Response.
585
586**/
587EFI_STATUS
588ParseDnsResponse (
589 IN OUT DNS_INSTANCE *Instance,
590 IN UINT8 *RxString,
591 IN UINT32 Length,
592 OUT BOOLEAN *Completed
593 );
594
595/**
596 Parse response packet.
597
598 @param Packet The packets received.
599 @param EndPoint The local/remote UDP access point
600 @param IoStatus The status of the UDP receive
601 @param Context The opaque parameter to the function.
602
603**/
604VOID
605EFIAPI
606DnsOnPacketReceived (
607 NET_BUF *Packet,
608 UDP_END_POINT *EndPoint,
609 EFI_STATUS IoStatus,
610 VOID *Context
611 );
612
613/**
614 Release the net buffer when packet is sent.
615
616 @param Packet The packets received.
617 @param EndPoint The local/remote UDP access point
618 @param IoStatus The status of the UDP receive
619 @param Context The opaque parameter to the function.
620
621**/
622VOID
623EFIAPI
624DnsOnPacketSent (
625 NET_BUF *Packet,
626 UDP_END_POINT *EndPoint,
627 EFI_STATUS IoStatus,
628 VOID *Context
629 );
630
631/**
632 Query request information.
633
634 @param Instance The DNS instance
635 @param Packet The packet for querying request information.
636
637 @retval EFI_SUCCESS Query request information successfully.
638 @retval Others Failed to query request information.
639
640**/
641EFI_STATUS
642DoDnsQuery (
643 IN DNS_INSTANCE *Instance,
644 IN NET_BUF *Packet
645 );
646
647/**
648 Construct the Packet according query section.
649
650 @param Instance The DNS instance
651 @param QueryName Queried Name
652 @param Type Queried Type
653 @param Class Queried Class
654 @param Packet The packet for query
655
656 @retval EFI_SUCCESS The packet is constructed.
657 @retval Others Failed to construct the Packet.
658
659**/
660EFI_STATUS
661ConstructDNSQuery (
662 IN DNS_INSTANCE *Instance,
663 IN CHAR8 *QueryName,
664 IN UINT16 Type,
665 IN UINT16 Class,
666 OUT NET_BUF **Packet
667 );
668
669/**
670 Retransmit the packet.
671
672 @param Instance The DNS instance
673 @param Packet Retransmit the packet
674
675 @retval EFI_SUCCESS The packet is retransmitted.
676 @retval Others Failed to retransmit.
677
678**/
679EFI_STATUS
680DnsRetransmit (
681 IN DNS_INSTANCE *Instance,
682 IN NET_BUF *Packet
683 );
684
685/**
686 The timer ticking function for the DNS service.
687
688 @param Event The ticking event
689 @param Context The DNS service instance
690
691**/
692VOID
693EFIAPI
694DnsOnTimerRetransmit (
695 IN EFI_EVENT Event,
696 IN VOID *Context
697 );
698
699/**
700 The timer ticking function for the DNS driver.
701
702 @param Event The ticking event
703 @param Context NULL
704
705**/
706VOID
707EFIAPI
708DnsOnTimerUpdate (
709 IN EFI_EVENT Event,
710 IN VOID *Context
711 );
712
713
714/**
715 Retrieve mode data of this DNS instance.
716
717 This function is used to retrieve DNS mode data for this DNS instance.
718
719 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
720 @param[out] DnsModeData Point to the mode data.
721
722 @retval EFI_SUCCESS The operation completed successfully.
723 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
724 is available because this instance has not been
725 configured.
726 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
727 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
728**/
729EFI_STATUS
730EFIAPI
731Dns4GetModeData (
732 IN EFI_DNS4_PROTOCOL *This,
733 OUT EFI_DNS4_MODE_DATA *DnsModeData
734 );
735
736/**
737 Configure this DNS instance.
738
739 This function is used to configure DNS mode data for this DNS instance.
740
741 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
742 @param[in] DnsConfigData Point to the Configuration data.
743
744 @retval EFI_SUCCESS The operation completed successfully.
745 @retval EFI_UNSUPPORTED The designated protocol is not supported.
746 @retval EFI_INVALID_PARAMETER This is NULL.
747 The StationIp address provided in DnsConfigData is not a
748 valid unicast.
749 DnsServerList is NULL while DnsServerListCount
750 is not ZERO.
751 DnsServerListCount is ZERO while DnsServerList
752 is not NULL
753 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
754 allocated.
755 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
756 EFI DNSv4 Protocol instance is not configured.
757 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
758 reconfigure the instance the caller must call Configure()
759 with NULL first to return driver to unconfigured state.
760**/
761EFI_STATUS
762EFIAPI
763Dns4Configure (
764 IN EFI_DNS4_PROTOCOL *This,
765 IN EFI_DNS4_CONFIG_DATA *DnsConfigData
766 );
767
768/**
769 Host name to host address translation.
770
771 The HostNameToIp () function is used to translate the host name to host IP address. A
772 type A query is used to get the one or more IP addresses for this host.
773
774 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
775 @param[in] HostName Host name.
776 @param[in] Token Point to the completion token to translate host name
777 to host address.
778
779 @retval EFI_SUCCESS The operation completed successfully.
780 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
781 This is NULL.
782 Token is NULL.
783 Token.Event is NULL.
784 HostName is NULL. HostName string is unsupported format.
785 @retval EFI_NO_MAPPING There's no source address is available for use.
786 @retval EFI_NOT_STARTED This instance has not been started.
787**/
788EFI_STATUS
789EFIAPI
790Dns4HostNameToIp (
791 IN EFI_DNS4_PROTOCOL *This,
792 IN CHAR16 *HostName,
793 IN EFI_DNS4_COMPLETION_TOKEN *Token
794 );
795
796/**
797 IPv4 address to host name translation also known as Reverse DNS lookup.
798
799 The IpToHostName() function is used to translate the host address to host name. A type PTR
800 query is used to get the primary name of the host. Support of this function is optional.
801
802 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
803 @param[in] IpAddress Ip Address.
804 @param[in] Token Point to the completion token to translate host
805 address to host name.
806
807 @retval EFI_SUCCESS The operation completed successfully.
808 @retval EFI_UNSUPPORTED This function is not supported.
809 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
810 This is NULL.
811 Token is NULL.
812 Token.Event is NULL.
813 IpAddress is not valid IP address .
814 @retval EFI_NO_MAPPING There's no source address is available for use.
815 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
816 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
817**/
818EFI_STATUS
819EFIAPI
820Dns4IpToHostName (
821 IN EFI_DNS4_PROTOCOL *This,
822 IN EFI_IPv4_ADDRESS IpAddress,
823 IN EFI_DNS4_COMPLETION_TOKEN *Token
824 );
825
826/**
827 Retrieve arbitrary information from the DNS server.
828
829 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
830 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
831 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
832 required information. The function is optional.
833
834 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
835 @param[in] QName Pointer to Query Name.
836 @param[in] QType Query Type.
837 @param[in] QClass Query Name.
838 @param[in] Token Point to the completion token to retrieve arbitrary
839 information.
840
841 @retval EFI_SUCCESS The operation completed successfully.
842 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
843 QType is not supported
844 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
845 This is NULL.
846 Token is NULL.
847 Token.Event is NULL.
848 QName is NULL.
849 @retval EFI_NO_MAPPING There's no source address is available for use.
850 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
851 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
852**/
853EFI_STATUS
854EFIAPI
855Dns4GeneralLookUp (
856 IN EFI_DNS4_PROTOCOL *This,
857 IN CHAR8 *QName,
858 IN UINT16 QType,
859 IN UINT16 QClass,
860 IN EFI_DNS4_COMPLETION_TOKEN *Token
861 );
862
863/**
864 This function is to update the DNS Cache.
865
866 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
867 can be normally dynamically updated after the DNS resolve succeeds. This function
868 provided capability to manually add/delete/modify the DNS cache.
869
870 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
871 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
872 DNS Cache. If TRUE, this function will delete
873 matching DNS Cache entry.
874 @param[in] Override If TRUE, the matching DNS cache entry will be
875 overwritten with the supplied parameter. If FALSE,
876 EFI_ACCESS_DENIED will be returned if the entry to
877 be added is already existed.
878 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
879
880 @retval EFI_SUCCESS The operation completed successfully.
881 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
882 This is NULL.
883 DnsCacheEntry.HostName is NULL.
884 DnsCacheEntry.IpAddress is NULL.
885 DnsCacheEntry.Timeout is zero.
886 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
887 not TRUE.
888**/
889EFI_STATUS
890EFIAPI
891Dns4UpdateDnsCache (
892 IN EFI_DNS4_PROTOCOL *This,
893 IN BOOLEAN DeleteFlag,
894 IN BOOLEAN Override,
895 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
896 );
897
898/**
899 Polls for incoming data packets and processes outgoing data packets.
900
901 The Poll() function can be used by network drivers and applications to increase the
902 rate that data packets are moved between the communications device and the transmit
903 and receive queues.
904 In some systems, the periodic timer event in the managed network driver may not poll
905 the underlying communications device fast enough to transmit and/or receive all data
906 packets without missing incoming packets or dropping outgoing packets. Drivers and
907 applications that are experiencing packet loss should try calling the Poll()
908 function more often.
909
910 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
911
912 @retval EFI_SUCCESS Incoming or outgoing data was processed.
913 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
914 @retval EFI_INVALID_PARAMETER This is NULL.
915 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
916 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
917 queue. Consider increasing the polling rate.
918**/
919EFI_STATUS
920EFIAPI
921Dns4Poll (
922 IN EFI_DNS4_PROTOCOL *This
923 );
924
925/**
926 Abort an asynchronous DNS operation, including translation between IP and Host, and
927 general look up behavior.
928
929 The Cancel() function is used to abort a pending resolution request. After calling
930 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
931 signaled. If the token is not in one of the queues, which usually means that the
932 asynchronous operation has completed, this function will not signal the token and
933 EFI_NOT_FOUND is returned.
934
935 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
936 @param[in] Token Pointer to a token that has been issued by
937 EFI_DNS4_PROTOCOL.HostNameToIp (),
938 EFI_DNS4_PROTOCOL.IpToHostName() or
939 EFI_DNS4_PROTOCOL.GeneralLookup().
940 If NULL, all pending tokens are aborted.
941
942 @retval EFI_SUCCESS Incoming or outgoing data was processed.
943 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
944 @retval EFI_INVALID_PARAMETER This is NULL.
945 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
946 operation was not found in the transmit queue. It
947 was either completed or was not issued by
948 HostNameToIp(), IpToHostName() or GeneralLookup().
949**/
950EFI_STATUS
951EFIAPI
952Dns4Cancel (
953 IN EFI_DNS4_PROTOCOL *This,
954 IN EFI_DNS4_COMPLETION_TOKEN *Token
955 );
956
957
958/**
959 Retrieve mode data of this DNS instance.
960
961 This function is used to retrieve DNS mode data for this DNS instance.
962
963 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
964 @param[out] DnsModeData Pointer to the caller-allocated storage for the
965 EFI_DNS6_MODE_DATA data.
966
967 @retval EFI_SUCCESS The operation completed successfully.
968 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
969 is available because this instance has not been
970 configured.
971 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
972 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
973**/
974EFI_STATUS
975EFIAPI
976Dns6GetModeData (
977 IN EFI_DNS6_PROTOCOL *This,
978 OUT EFI_DNS6_MODE_DATA *DnsModeData
979 );
980
981/**
982 Configure this DNS instance.
983
984 The Configure() function is used to set and change the configuration data for this
985 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
986
987 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
988 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
989 storage to be allocated and released by caller.
990
991 @retval EFI_SUCCESS The operation completed successfully.
992 @retval EFI_INVALID_PARAMETER This is NULL.
993 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
994 DnsServerList is NULL while DnsServerList Count is not ZERO.
995 DnsServerList Count is ZERO while DnsServerList is not NULL.
996 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
997 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
998 EFI DNSv6 Protocol instance is not configured.
999 @retval EFI_UNSUPPORTED The designated protocol is not supported.
1000 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
1001 reconfigure the instance the caller must call Configure() with
1002 NULL first to return driver to unconfigured state.
1003**/
1004EFI_STATUS
1005EFIAPI
1006Dns6Configure (
1007 IN EFI_DNS6_PROTOCOL *This,
1008 IN EFI_DNS6_CONFIG_DATA *DnsConfigData
1009 );
1010
1011/**
1012 Host name to host address translation.
1013
1014 The HostNameToIp () function is used to translate the host name to host IP address. A
1015 type AAAA query is used to get the one or more IPv6 addresses for this host.
1016
1017 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1018 @param[in] HostName Host name.
1019 @param[in] Token Point to the completion token to translate host name
1020 to host address.
1021
1022 @retval EFI_SUCCESS The operation completed successfully.
1023 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1024 This is NULL.
1025 Token is NULL.
1026 Token.Event is NULL.
1027 HostName is NULL or buffer contained unsupported characters.
1028 @retval EFI_NO_MAPPING There's no source address is available for use.
1029 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
1030 @retval EFI_NOT_STARTED This instance has not been started.
1031 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1032**/
1033EFI_STATUS
1034EFIAPI
1035Dns6HostNameToIp (
1036 IN EFI_DNS6_PROTOCOL *This,
1037 IN CHAR16 *HostName,
1038 IN EFI_DNS6_COMPLETION_TOKEN *Token
1039 );
1040
1041/**
1042 Host address to host name translation.
1043
1044 The IpToHostName () function is used to translate the host address to host name. A
1045 type PTR query is used to get the primary name of the host. Implementation can choose
1046 to support this function or not.
1047
1048 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1049 @param[in] IpAddress Ip Address.
1050 @param[in] Token Point to the completion token to translate host
1051 address to host name.
1052
1053 @retval EFI_SUCCESS The operation completed successfully.
1054 @retval EFI_UNSUPPORTED This function is not supported.
1055 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1056 This is NULL.
1057 Token is NULL.
1058 Token.Event is NULL.
1059 IpAddress is not valid IP address.
1060 @retval EFI_NO_MAPPING There's no source address is available for use.
1061 @retval EFI_NOT_STARTED This instance has not been started.
1062 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1063**/
1064EFI_STATUS
1065EFIAPI
1066Dns6IpToHostName (
1067 IN EFI_DNS6_PROTOCOL *This,
1068 IN EFI_IPv6_ADDRESS IpAddress,
1069 IN EFI_DNS6_COMPLETION_TOKEN *Token
1070 );
1071
1072/**
1073 This function provides capability to retrieve arbitrary information from the DNS
1074 server.
1075
1076 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
1077 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
1078 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
1079 required information. The function is optional. Implementation can choose to support
1080 it or not.
1081
1082 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1083 @param[in] QName Pointer to Query Name.
1084 @param[in] QType Query Type.
1085 @param[in] QClass Query Name.
1086 @param[in] Token Point to the completion token to retrieve arbitrary
1087 information.
1088
1089 @retval EFI_SUCCESS The operation completed successfully.
1090 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
1091 QType is not supported
1092 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1093 This is NULL.
1094 Token is NULL.
1095 Token.Event is NULL.
1096 QName is NULL.
1097 @retval EFI_NO_MAPPING There's no source address is available for use.
1098 @retval EFI_NOT_STARTED This instance has not been started.
1099 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
1100**/
1101EFI_STATUS
1102EFIAPI
1103Dns6GeneralLookUp (
1104 IN EFI_DNS6_PROTOCOL *This,
1105 IN CHAR8 *QName,
1106 IN UINT16 QType,
1107 IN UINT16 QClass,
1108 IN EFI_DNS6_COMPLETION_TOKEN *Token
1109 );
1110
1111/**
1112 This function is to update the DNS Cache.
1113
1114 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
1115 can be normally dynamically updated after the DNS resolve succeeds. This function
1116 provided capability to manually add/delete/modify the DNS cache.
1117
1118 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1119 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
1120 DNS Cache. If TRUE, this function will delete
1121 matching DNS Cache entry.
1122 @param[in] Override If TRUE, the matching DNS cache entry will be
1123 overwritten with the supplied parameter. If FALSE,
1124 EFI_ACCESS_DENIED will be returned if the entry to
1125 be added is already existed.
1126 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
1127
1128 @retval EFI_SUCCESS The operation completed successfully.
1129 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
1130 This is NULL.
1131 DnsCacheEntry.HostName is NULL.
1132 DnsCacheEntry.IpAddress is NULL.
1133 DnsCacheEntry.Timeout is zero.
1134 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
1135 not TRUE.
1136 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
1137**/
1138EFI_STATUS
1139EFIAPI
1140Dns6UpdateDnsCache (
1141 IN EFI_DNS6_PROTOCOL *This,
1142 IN BOOLEAN DeleteFlag,
1143 IN BOOLEAN Override,
1144 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
1145 );
1146
1147/**
1148 Polls for incoming data packets and processes outgoing data packets.
1149
1150 The Poll() function can be used by network drivers and applications to increase the
1151 rate that data packets are moved between the communications device and the transmit
1152 and receive queues.
1153
1154 In some systems, the periodic timer event in the managed network driver may not poll
1155 the underlying communications device fast enough to transmit and/or receive all data
1156 packets without missing incoming packets or dropping outgoing packets. Drivers and
1157 applications that are experiencing packet loss should try calling the Poll()
1158 function more often.
1159
1160 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1161
1162 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1163 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
1164 @retval EFI_INVALID_PARAMETER This is NULL.
1165 @retval EFI_NO_MAPPING There is no source address is available for use.
1166 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
1167 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
1168 queue. Consider increasing the polling rate.
1169**/
1170EFI_STATUS
1171EFIAPI
1172Dns6Poll (
1173 IN EFI_DNS6_PROTOCOL *This
1174 );
1175
1176/**
1177 Abort an asynchronous DNS operation, including translation between IP and Host, and
1178 general look up behavior.
1179
1180 The Cancel() function is used to abort a pending resolution request. After calling
1181 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
1182 signaled. If the token is not in one of the queues, which usually means that the
1183 asynchronous operation has completed, this function will not signal the token and
1184 EFI_NOT_FOUND is returned.
1185
1186 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
1187 @param[in] Token Pointer to a token that has been issued by
1188 EFI_DNS6_PROTOCOL.HostNameToIp (),
1189 EFI_DNS6_PROTOCOL.IpToHostName() or
1190 EFI_DNS6_PROTOCOL.GeneralLookup().
1191 If NULL, all pending tokens are aborted.
1192
1193 @retval EFI_SUCCESS Incoming or outgoing data was processed.
1194 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
1195 @retval EFI_INVALID_PARAMETER This is NULL.
1196 @retval EFI_NO_MAPPING There's no source address is available for use.
1197 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
1198 operation was not found in the transmit queue. It
1199 was either completed or was not issued by
1200 HostNameToIp(), IpToHostName() or GeneralLookup().
1201**/
1202EFI_STATUS
1203EFIAPI
1204Dns6Cancel (
1205 IN EFI_DNS6_PROTOCOL *This,
1206 IN EFI_DNS6_COMPLETION_TOKEN *Token
1207 );
1208
1209#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette