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