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)
7 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
10 @par Revision Reference:
11 This Protocol is introduced in UEFI Specification 2.5
15 #ifndef __EFI_DNS4_PROTOCOL_H__
16 #define __EFI_DNS4_PROTOCOL_H__
18 #define EFI_DNS4_SERVICE_BINDING_PROTOCOL_GUID \
20 0xb625b186, 0xe063, 0x44f7, {0x89, 0x5, 0x6a, 0x74, 0xdc, 0x6f, 0x52, 0xb4 } \
23 #define EFI_DNS4_PROTOCOL_GUID \
25 0xae3d28cc, 0xe05b, 0x4fa1, {0xa0, 0x11, 0x7e, 0xb5, 0x5a, 0x3f, 0x14, 0x1 } \
28 typedef struct _EFI_DNS4_PROTOCOL EFI_DNS4_PROTOCOL
;
31 /// EFI_DNS4_CONFIG_DATA
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.
42 UINTN DnsServerListCount
;
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.
54 EFI_IPv4_ADDRESS
*DnsServerList
;
56 /// Set to TRUE to use the default IP address/subnet mask and default routing table.
58 BOOLEAN UseDefaultSetting
;
60 /// If TRUE, enable DNS cache function for this DNS instance. If FALSE, all DNS
61 /// query will not lookup local DNS cache.
63 BOOLEAN EnableDnsCache
;
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.
73 /// If UseDefaultSetting is FALSE indicates the station address to use.
75 EFI_IPv4_ADDRESS StationIp
;
77 /// If UseDefaultSetting is FALSE indicates the subnet mask to use.
79 EFI_IPv4_ADDRESS SubnetMask
;
81 /// Local port number. Set to zero to use the automatically assigned port number.
85 /// Retry number if no response received after RetryInterval.
89 /// Minimum interval of retry is 2 second. If the retry interval is less than 2
90 /// seconds, then use the 2 seconds.
93 } EFI_DNS4_CONFIG_DATA
;
96 /// EFI_DNS4_CACHE_ENTRY
104 /// IP address of this host.
106 EFI_IPv4_ADDRESS
*IpAddress
;
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.
115 } EFI_DNS4_CACHE_ENTRY
;
118 /// EFI_DNS4_MODE_DATA
122 /// The configuration data of this instance.
124 EFI_DNS4_CONFIG_DATA DnsConfigData
;
126 /// Number of configured DNS server. Each DNS instance has its own DNS server
129 UINT32 DnsServerCount
;
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.
137 EFI_IPv4_ADDRESS
*DnsServerList
;
139 /// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
141 UINT32 DnsCacheCount
;
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.
147 EFI_DNS4_CACHE_ENTRY
*DnsCacheList
;
148 } EFI_DNS4_MODE_DATA
;
151 /// DNS_HOST_TO_ADDR_DATA
155 /// Number of the returned IP addresses.
159 /// Pointer to the all the returned IP addresses.
161 EFI_IPv4_ADDRESS
*IpList
;
162 } DNS_HOST_TO_ADDR_DATA
;
165 /// DNS_ADDR_TO_HOST_DATA
169 /// Pointer to the primary name for this host address. It's the caller's
170 /// responsibility to free the response memory.
173 } DNS_ADDR_TO_HOST_DATA
;
176 /// DNS_RESOURCE_RECORD
184 /// The Type Code of this RR.
188 /// The CLASS code of this RR.
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.
198 /// 16 big integer which specify the length of RData.
202 /// A string of octets that describe the resource, the format of this information
203 /// varies according to QType and QClass difference.
206 } DNS_RESOURCE_RECORD
;
209 /// DNS_GENERAL_LOOKUP_DATA
213 /// Number of returned matching RRs.
217 /// Pointer to the all the returned matching RRs. It's caller responsibility to free
218 /// the allocated memory to hold the returned RRs.
220 DNS_RESOURCE_RECORD
*RRList
;
221 } DNS_GENERAL_LOOKUP_DATA
;
224 /// EFI_DNS4_COMPLETION_TOKEN
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.
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.
243 /// Retry number if no response received after RetryInterval. If zero, use the
244 /// parameter configured through Dns.Configure() interface.
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
;
253 /// DNSv4 completion token data
257 /// When the Token is used for host name to address translation, H2AData is a pointer
258 /// to the DNS_HOST_TO_ADDR_DATA.
260 DNS_HOST_TO_ADDR_DATA
*H2AData
;
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.
265 DNS_ADDR_TO_HOST_DATA
*A2HData
;
267 /// When the Token is used for a general lookup function, GLookupDATA is a pointer to
268 /// the DNS_GENERAL_LOOKUP_DATA.
270 DNS_GENERAL_LOOKUP_DATA
*GLookupData
;
272 } EFI_DNS4_COMPLETION_TOKEN
;
275 Retrieve mode data of this DNS instance.
277 This function is used to retrieve DNS mode data for this DNS instance.
279 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
280 @param[out] DnsModeData Point to the mode data.
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
286 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
287 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
291 (EFIAPI
*EFI_DNS4_GET_MODE_DATA
)(
292 IN EFI_DNS4_PROTOCOL
*This
,
293 OUT EFI_DNS4_MODE_DATA
*DnsModeData
297 Configure this DNS instance.
299 This function is used to configure DNS mode data for this DNS instance.
301 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
302 @param[in] DnsConfigData Point to the Configuration data.
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
309 DnsServerList is NULL while DnsServerListCount
311 DnsServerListCount is ZERO while DnsServerList
313 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
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.
323 (EFIAPI
*EFI_DNS4_CONFIGURE
)(
324 IN EFI_DNS4_PROTOCOL
*This
,
325 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
329 Host name to host address translation.
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.
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
339 @retval EFI_SUCCESS The operation completed successfully.
340 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
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.
350 (EFIAPI
*EFI_DNS4_HOST_NAME_TO_IP
)(
351 IN EFI_DNS4_PROTOCOL
*This
,
353 IN EFI_DNS4_COMPLETION_TOKEN
*Token
357 IPv4 address to host name translation also known as Reverse DNS lookup.
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.
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.
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:
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.
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
387 Retrieve arbitrary information from the DNS server.
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.
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
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:
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.
415 (EFIAPI
*EFI_DNS4_GENERAL_LOOKUP
)(
416 IN EFI_DNS4_PROTOCOL
*This
,
420 IN EFI_DNS4_COMPLETION_TOKEN
*Token
424 This function is to update the DNS Cache.
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.
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.
440 @retval EFI_SUCCESS The operation completed successfully.
441 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
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
451 (EFIAPI
*EFI_DNS4_UPDATE_DNS_CACHE
)(
452 IN EFI_DNS4_PROTOCOL
*This
,
453 IN BOOLEAN DeleteFlag
,
455 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
459 Polls for incoming data packets and processes outgoing data packets.
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
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()
470 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
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.
481 (EFIAPI
*EFI_DNS4_POLL
)(
482 IN EFI_DNS4_PROTOCOL
*This
486 Abort an asynchronous DNS operation, including translation between IP and Host, and
487 general look up behavior.
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.
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.
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().
512 (EFIAPI
*EFI_DNS4_CANCEL
)(
513 IN EFI_DNS4_PROTOCOL
*This
,
514 IN EFI_DNS4_COMPLETION_TOKEN
*Token
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
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
;
530 EFI_DNS4_CANCEL Cancel
;
533 extern EFI_GUID gEfiDns4ServiceBindingProtocolGuid
;
534 extern EFI_GUID gEfiDns4ProtocolGuid
;