VirtualBox

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

Last change on this file since 77662 was 77662, checked in by vboxsync, 6 years ago

EFI: First step in UDK2018 merge. Does not build yet.

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

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