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