]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Dns6.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / Dns6.h
1 /** @file
2 This file defines the EFI DNSv6 (Domain Name Service version 6) Protocol. It is split
3 into the following two main sections:
4 DNSv6 Service Binding Protocol (DNSv6SB)
5 DNSv6 Protocol (DNSv6)
6
7 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 @par Revision Reference:
11 This Protocol is introduced in UEFI Specification 2.5
12
13 **/
14
15 #ifndef __EFI_DNS6_PROTOCOL_H__
16 #define __EFI_DNS6_PROTOCOL_H__
17
18 #define EFI_DNS6_SERVICE_BINDING_PROTOCOL_GUID \
19 { \
20 0x7f1647c8, 0xb76e, 0x44b2, {0xa5, 0x65, 0xf7, 0xf, 0xf1, 0x9c, 0xd1, 0x9e } \
21 }
22
23 #define EFI_DNS6_PROTOCOL_GUID \
24 { \
25 0xca37bc1f, 0xa327, 0x4ae9, {0x82, 0x8a, 0x8c, 0x40, 0xd8, 0x50, 0x6a, 0x17 } \
26 }
27
28 typedef struct _EFI_DNS6_PROTOCOL EFI_DNS6_PROTOCOL;
29
30 ///
31 /// EFI_DNS6_CONFIG_DATA
32 ///
33 typedef struct {
34 ///
35 /// If TRUE, enable DNS cache function for this DNS instance. If FALSE, all DNS query
36 /// will not lookup local DNS cache.
37 ///
38 BOOLEAN EnableDnsCache;
39 ///
40 /// Use the protocol number defined in
41 /// http://www.iana.org/assignments/protocol-numbers. Beside TCP/UDP, Other protocol
42 /// is invalid value. An implementation can choose to support UDP, or both TCP and UDP.
43 ///
44 UINT8 Protocol;
45 ///
46 /// The local IP address to use. Set to zero to let the underlying IPv6
47 /// driver choose a source address. If not zero it must be one of the
48 /// configured IP addresses in the underlying IPv6 driver.
49 ///
50 EFI_IPv6_ADDRESS StationIp;
51 ///
52 /// Local port number. Set to zero to use the automatically assigned port number.
53 ///
54 UINT16 LocalPort;
55 ///
56 /// Count of the DNS servers. When used with GetModeData(),
57 /// this field is the count of originally configured servers when
58 /// Configure() was called for this instance. When used with
59 /// Configure() this is the count of caller-supplied servers. If the
60 /// DnsServerListCount is zero, the DNS server configuration
61 /// will be retrieved from DHCP server automatically.
62 ///
63 UINT32 DnsServerCount;
64 ///
65 /// Pointer to DNS server list containing DnsServerListCount
66 /// entries or NULL if DnsServerListCount is 0. For Configure(),
67 /// this will be NULL when there are no caller supplied server addresses
68 /// and the DNS instance will retrieve DNS server from DHCP Server.
69 /// The provided DNS server list is recommended to be filled up in the sequence
70 /// of preference. When used with GetModeData(), the buffer containing the list
71 /// will be allocated by the driver implementing this protocol and must be
72 /// freed by the caller. When used with Configure(), the buffer
73 /// containing the list will be allocated and released by the caller.
74 ///
75 EFI_IPv6_ADDRESS *DnsServerList;
76 ///
77 /// Retry number if no response received after RetryInterval.
78 ///
79 UINT32 RetryCount;
80 ///
81 /// Minimum interval of retry is 2 second. If the retry interval is less than 2
82 /// seconds, then use the 2 seconds.
83 UINT32 RetryInterval;
84 } EFI_DNS6_CONFIG_DATA;
85
86 ///
87 /// EFI_DNS6_CACHE_ENTRY
88 ///
89 typedef struct {
90 ///
91 /// Host name. This should be interpreted as Unicode characters.
92 ///
93 CHAR16 *HostName;
94 ///
95 /// IP address of this host.
96 ///
97 EFI_IPv6_ADDRESS *IpAddress;
98 ///
99 /// Time in second unit that this entry will remain in DNS cache. A value of zero means
100 /// that this entry is permanent. A nonzero value will override the existing one if
101 /// this entry to be added is dynamic entry. Implementations may set its default
102 /// timeout value for the dynamically created DNS cache entry after one DNS resolve
103 /// succeeds.
104 UINT32 Timeout;
105 } EFI_DNS6_CACHE_ENTRY;
106
107 ///
108 /// EFI_DNS6_MODE_DATA
109 ///
110 typedef struct {
111 ///
112 /// The configuration data of this instance.
113 ///
114 EFI_DNS6_CONFIG_DATA DnsConfigData;
115 ///
116 /// Number of configured DNS6 servers.
117 ///
118 UINT32 DnsServerCount;
119 ///
120 /// Pointer to common list of addresses of all configured DNS server used by EFI_DNS6_PROTOCOL
121 /// instances. List will include DNS servers configured by this or any other EFI_DNS6_PROTOCOL
122 /// instance. The storage for this list is allocated by the driver publishing this protocol,
123 /// and must be freed by the caller.
124 ///
125 EFI_IPv6_ADDRESS *DnsServerList;
126 ///
127 /// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
128 ///
129 UINT32 DnsCacheCount;
130 ///
131 /// Pointer to a buffer containing DnsCacheCount DNS Cache
132 /// entry structures. The storage for thislist is allocated by the driver
133 /// publishing this protocol and must be freed by caller.
134 ///
135 EFI_DNS6_CACHE_ENTRY *DnsCacheList;
136 } EFI_DNS6_MODE_DATA;
137
138 ///
139 /// DNS6_HOST_TO_ADDR_DATA
140 ///
141 typedef struct {
142 ///
143 /// Number of the returned IP address.
144 ///
145 UINT32 IpCount;
146 ///
147 /// Pointer to the all the returned IP address.
148 ///
149 EFI_IPv6_ADDRESS *IpList;
150 } DNS6_HOST_TO_ADDR_DATA;
151
152 ///
153 /// DNS6_ADDR_TO_HOST_DATA
154 ///
155 typedef struct {
156 ///
157 /// Pointer to the primary name for this host address. It's the caller's
158 /// responsibility to free the response memory.
159 ///
160 CHAR16 *HostName;
161 } DNS6_ADDR_TO_HOST_DATA;
162
163 ///
164 /// DNS6_RESOURCE_RECORD
165 ///
166 typedef struct {
167 ///
168 /// The Owner name.
169 ///
170 CHAR8 *QName;
171 ///
172 /// The Type Code of this RR.
173 ///
174 UINT16 QType;
175 ///
176 /// The CLASS code of this RR.
177 ///
178 UINT16 QClass;
179 ///
180 /// 32 bit integer which specify the time interval that the resource record may be
181 /// cached before the source of the information should again be consulted. Zero means
182 /// this RR cannot be cached.
183 ///
184 UINT32 TTL;
185 ///
186 /// 16 big integer which specify the length of RData.
187 ///
188 UINT16 DataLength;
189 ///
190 /// A string of octets that describe the resource, the format of this information
191 /// varies according to QType and QClass difference.
192 ///
193 CHAR8 *RData;
194 } DNS6_RESOURCE_RECORD;
195
196 ///
197 /// DNS6_GENERAL_LOOKUP_DATA
198 ///
199 typedef struct {
200 ///
201 /// Number of returned matching RRs.
202 ///
203 UINTN RRCount;
204 ///
205 /// Pointer to the all the returned matching RRs. It's caller responsibility to free
206 /// the allocated memory to hold the returned RRs.
207 ///
208 DNS6_RESOURCE_RECORD *RRList;
209 } DNS6_GENERAL_LOOKUP_DATA;
210
211 ///
212 /// EFI_DNS6_COMPLETION_TOKEN
213 ///
214 typedef struct {
215 ///
216 /// This Event will be signaled after the Status field is updated by the EFI DNSv6
217 /// protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
218 ///
219 EFI_EVENT Event;
220 ///
221 /// Will be set to one of the following values:
222 /// EFI_SUCCESS: The host name to address translation completed successfully.
223 /// EFI_NOT_FOUND: No matching Resource Record (RR) is found.
224 /// EFI_TIMEOUT: No DNS server reachable, or RetryCount was exhausted without
225 /// response from all specified DNS servers.
226 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
227 /// EFI_NO_MEDIA: There was a media error.
228 ///
229 EFI_STATUS Status;
230 ///
231 /// The parameter configured through DNSv6.Configure() interface. Retry number if no
232 /// response received after RetryInterval.
233 ///
234 UINT32 RetryCount;
235 ///
236 /// The parameter configured through DNSv6.Configure() interface. Minimum interval of
237 /// retry is 2 seconds. If the retry interval is less than 2 seconds, then use the 2
238 /// seconds.
239 ///
240 UINT32 RetryInterval;
241 ///
242 /// DNSv6 completion token data
243 ///
244 union {
245 ///
246 /// When the Token is used for host name to address translation, H2AData is a pointer
247 /// to the DNS6_HOST_TO_ADDR_DATA.
248 ///
249 DNS6_HOST_TO_ADDR_DATA *H2AData;
250 ///
251 /// When the Token is used for host address to host name translation, A2HData is a
252 /// pointer to the DNS6_ADDR_TO_HOST_DATA.
253 ///
254 DNS6_ADDR_TO_HOST_DATA *A2HData;
255 ///
256 /// When the Token is used for a general lookup function, GLookupDATA is a pointer to
257 /// the DNS6_GENERAL_LOOKUP_DATA.
258 ///
259 DNS6_GENERAL_LOOKUP_DATA *GLookupData;
260 } RspData;
261 } EFI_DNS6_COMPLETION_TOKEN;
262
263 /**
264 Retrieve mode data of this DNS instance.
265
266 This function is used to retrieve DNS mode data for this DNS instance.
267
268 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
269 @param[out] DnsModeData Pointer to the caller-allocated storage for the
270 EFI_DNS6_MODE_DATA data.
271
272 @retval EFI_SUCCESS The operation completed successfully.
273 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
274 is available because this instance has not been
275 configured.
276 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
277 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
278 **/
279 typedef
280 EFI_STATUS
281 (EFIAPI *EFI_DNS6_GET_MODE_DATA)(
282 IN EFI_DNS6_PROTOCOL *This,
283 OUT EFI_DNS6_MODE_DATA *DnsModeData
284 );
285
286 /**
287 Configure this DNS instance.
288
289 The Configure() function is used to set and change the configuration data for this
290 EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
291
292 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
293 @param[in] DnsConfigData Pointer to the configuration data structure. All associated
294 storage to be allocated and released by caller.
295
296 @retval EFI_SUCCESS The operation completed successfully.
297 @retval EFI_INVALID_PARAMETER This is NULL.
298 The StationIp address provided in DnsConfigData is not zero and not a valid unicast.
299 DnsServerList is NULL while DnsServerList Count is not ZERO.
300 DnsServerList Count is ZERO while DnsServerList is not NULL.
301 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
302 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
303 EFI DNSv6 Protocol instance is not configured.
304 @retval EFI_UNSUPPORTED The designated protocol is not supported.
305 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
306 reconfigure the instance the caller must call Configure() with
307 NULL first to return driver to unconfigured state.
308 **/
309 typedef
310 EFI_STATUS
311 (EFIAPI *EFI_DNS6_CONFIGURE)(
312 IN EFI_DNS6_PROTOCOL *This,
313 IN EFI_DNS6_CONFIG_DATA *DnsConfigData
314 );
315
316 /**
317 Host name to host address translation.
318
319 The HostNameToIp () function is used to translate the host name to host IP address. A
320 type AAAA query is used to get the one or more IPv6 addresses for this host.
321
322 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
323 @param[in] HostName Host name.
324 @param[in] Token Point to the completion token to translate host name
325 to host address.
326
327 @retval EFI_SUCCESS The operation completed successfully.
328 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
329 This is NULL.
330 Token is NULL.
331 Token.Event is NULL.
332 HostName is NULL or buffer contained unsupported characters.
333 @retval EFI_NO_MAPPING There's no source address is available for use.
334 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
335 @retval EFI_NOT_STARTED This instance has not been started.
336 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
337 **/
338 typedef
339 EFI_STATUS
340 (EFIAPI *EFI_DNS6_HOST_NAME_TO_IP)(
341 IN EFI_DNS6_PROTOCOL *This,
342 IN CHAR16 *HostName,
343 IN EFI_DNS6_COMPLETION_TOKEN *Token
344 );
345
346 /**
347 Host address to host name translation.
348
349 The IpToHostName () function is used to translate the host address to host name. A
350 type PTR query is used to get the primary name of the host. Implementation can choose
351 to support this function or not.
352
353 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
354 @param[in] IpAddress Ip Address.
355 @param[in] Token Point to the completion token to translate host
356 address to host name.
357
358 @retval EFI_SUCCESS The operation completed successfully.
359 @retval EFI_UNSUPPORTED This function is not supported.
360 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
361 This is NULL.
362 Token is NULL.
363 Token.Event is NULL.
364 IpAddress is not valid IP address.
365 @retval EFI_NO_MAPPING There's no source address is available for use.
366 @retval EFI_NOT_STARTED This instance has not been started.
367 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
368 **/
369 typedef
370 EFI_STATUS
371 (EFIAPI *EFI_DNS6_IP_TO_HOST_NAME)(
372 IN EFI_DNS6_PROTOCOL *This,
373 IN EFI_IPv6_ADDRESS IpAddress,
374 IN EFI_DNS6_COMPLETION_TOKEN *Token
375 );
376
377 /**
378 This function provides capability to retrieve arbitrary information from the DNS
379 server.
380
381 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
382 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
383 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
384 required information. The function is optional. Implementation can choose to support
385 it or not.
386
387 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
388 @param[in] QName Pointer to Query Name.
389 @param[in] QType Query Type.
390 @param[in] QClass Query Name.
391 @param[in] Token Point to the completion token to retrieve arbitrary
392 information.
393
394 @retval EFI_SUCCESS The operation completed successfully.
395 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
396 QType is not supported
397 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
398 This is NULL.
399 Token is NULL.
400 Token.Event is NULL.
401 QName is NULL.
402 @retval EFI_NO_MAPPING There's no source address is available for use.
403 @retval EFI_NOT_STARTED This instance has not been started.
404 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
405 **/
406 typedef
407 EFI_STATUS
408 (EFIAPI *EFI_DNS6_GENERAL_LOOKUP)(
409 IN EFI_DNS6_PROTOCOL *This,
410 IN CHAR8 *QName,
411 IN UINT16 QType,
412 IN UINT16 QClass,
413 IN EFI_DNS6_COMPLETION_TOKEN *Token
414 );
415
416 /**
417 This function is to update the DNS Cache.
418
419 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
420 can be normally dynamically updated after the DNS resolve succeeds. This function
421 provided capability to manually add/delete/modify the DNS cache.
422
423 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
424 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
425 DNS Cahce. If TRUE, this function will delete
426 matching DNS Cache entry.
427 @param[in] Override If TRUE, the maching DNS cache entry will be
428 overwritten with the supplied parameter. If FALSE,
429 EFI_ACCESS_DENIED will be returned if the entry to
430 be added is already existed.
431 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
432
433 @retval EFI_SUCCESS The operation completed successfully.
434 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
435 This is NULL.
436 DnsCacheEntry.HostName is NULL.
437 DnsCacheEntry.IpAddress is NULL.
438 DnsCacheEntry.Timeout is zero.
439 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
440 not TRUE.
441 @retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
442 **/
443 typedef
444 EFI_STATUS
445 (EFIAPI *EFI_DNS6_UPDATE_DNS_CACHE)(
446 IN EFI_DNS6_PROTOCOL *This,
447 IN BOOLEAN DeleteFlag,
448 IN BOOLEAN Override,
449 IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
450 );
451
452 /**
453 Polls for incoming data packets and processes outgoing data packets.
454
455 The Poll() function can be used by network drivers and applications to increase the
456 rate that data packets are moved between the communications device and the transmit
457 and receive queues.
458
459 In some systems, the periodic timer event in the managed network driver may not poll
460 the underlying communications device fast enough to transmit and/or receive all data
461 packets without missing incoming packets or dropping outgoing packets. Drivers and
462 applications that are experiencing packet loss should try calling the Poll()
463 function more often.
464
465 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
466
467 @retval EFI_SUCCESS Incoming or outgoing data was processed.
468 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
469 @retval EFI_INVALID_PARAMETER This is NULL.
470 @retval EFI_NO_MAPPING There is no source address is available for use.
471 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
472 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
473 queue. Consider increasing the polling rate.
474 **/
475 typedef
476 EFI_STATUS
477 (EFIAPI *EFI_DNS6_POLL)(
478 IN EFI_DNS6_PROTOCOL *This
479 );
480
481 /**
482 Abort an asynchronous DNS operation, including translation between IP and Host, and
483 general look up behavior.
484
485 The Cancel() function is used to abort a pending resolution request. After calling
486 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
487 signaled. If the token is not in one of the queues, which usually means that the
488 asynchronous operation has completed, this function will not signal the token and
489 EFI_NOT_FOUND is returned.
490
491 @param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
492 @param[in] Token Pointer to a token that has been issued by
493 EFI_DNS6_PROTOCOL.HostNameToIp (),
494 EFI_DNS6_PROTOCOL.IpToHostName() or
495 EFI_DNS6_PROTOCOL.GeneralLookup().
496 If NULL, all pending tokens are aborted.
497
498 @retval EFI_SUCCESS Incoming or outgoing data was processed.
499 @retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
500 @retval EFI_INVALID_PARAMETER This is NULL.
501 @retval EFI_NO_MAPPING There's no source address is available for use.
502 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
503 operation was not found in the transmit queue. It
504 was either completed or was not issued by
505 HostNameToIp(), IpToHostName() or GeneralLookup().
506 **/
507 typedef
508 EFI_STATUS
509 (EFIAPI *EFI_DNS6_CANCEL)(
510 IN EFI_DNS6_PROTOCOL *This,
511 IN EFI_DNS6_COMPLETION_TOKEN *Token
512 );
513
514 ///
515 /// The EFI_DNS6_PROTOCOL provides the function to get the host name and address
516 /// mapping, also provide pass through interface to retrieve arbitrary information from
517 /// DNSv6.
518 ///
519 struct _EFI_DNS6_PROTOCOL {
520 EFI_DNS6_GET_MODE_DATA GetModeData;
521 EFI_DNS6_CONFIGURE Configure;
522 EFI_DNS6_HOST_NAME_TO_IP HostNameToIp;
523 EFI_DNS6_IP_TO_HOST_NAME IpToHostName;
524 EFI_DNS6_GENERAL_LOOKUP GeneralLookUp;
525 EFI_DNS6_UPDATE_DNS_CACHE UpdateDnsCache;
526 EFI_DNS6_POLL Poll;
527 EFI_DNS6_CANCEL Cancel;
528 };
529
530 extern EFI_GUID gEfiDns6ServiceBindingProtocolGuid;
531 extern EFI_GUID gEfiDns6ProtocolGuid;
532
533 #endif