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