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
;
97 /// EFI_DNS4_CACHE_ENTRY
105 /// IP address of this host.
107 EFI_IPv4_ADDRESS
*IpAddress
;
109 /// Time in second unit that this entry will remain in DNS cache. A value of zero
110 /// means that this entry is permanent. A nonzero value will override the existing
111 /// one if this entry to be added is dynamic entry. Implementations may set its
112 /// default timeout value for the dynamically created DNS cache entry after one DNS
113 /// resolve succeeds.
116 } EFI_DNS4_CACHE_ENTRY
;
119 /// EFI_DNS4_MODE_DATA
123 /// The configuration data of this instance.
125 EFI_DNS4_CONFIG_DATA DnsConfigData
;
127 /// Number of configured DNS server. Each DNS instance has its own DNS server
130 UINT32 DnsServerCount
;
132 /// Pointer to common list of addresses of all configured DNS server
133 /// used by EFI_DNS4_PROTOCOL instances. List will include
134 /// DNS servers configured by this or any other EFI_DNS4_PROTOCOL instance.
135 /// The storage for this list is allocated by the driver publishing this
136 /// protocol, and must be freed by the caller.
138 EFI_IPv4_ADDRESS
*DnsServerList
;
140 /// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
142 UINT32 DnsCacheCount
;
144 /// Pointer to a buffer containing DnsCacheCount DNS Cache
145 /// entry structures. The storage for this list is allocated by the driver
146 /// publishing this protocol and must be freed by caller.
148 EFI_DNS4_CACHE_ENTRY
*DnsCacheList
;
149 } EFI_DNS4_MODE_DATA
;
152 /// DNS_HOST_TO_ADDR_DATA
156 /// Number of the returned IP addresses.
160 /// Pointer to the all the returned IP addresses.
162 EFI_IPv4_ADDRESS
*IpList
;
163 } DNS_HOST_TO_ADDR_DATA
;
166 /// DNS_ADDR_TO_HOST_DATA
170 /// Pointer to the primary name for this host address. It's the caller's
171 /// responsibility to free the response memory.
174 } DNS_ADDR_TO_HOST_DATA
;
177 /// DNS_RESOURCE_RECORD
185 /// The Type Code of this RR.
189 /// The CLASS code of this RR.
193 /// 32 bit integer which specify the time interval that the resource record may be
194 /// cached before the source of the information should again be consulted. Zero means
195 /// this RR can not be cached.
199 /// 16 big integer which specify the length of RData.
203 /// A string of octets that describe the resource, the format of this information
204 /// varies according to QType and QClass difference.
207 } DNS_RESOURCE_RECORD
;
210 /// DNS_GENERAL_LOOKUP_DATA
214 /// Number of returned matching RRs.
218 /// Pointer to the all the returned matching RRs. It's caller responsibility to free
219 /// the allocated memory to hold the returned RRs.
221 DNS_RESOURCE_RECORD
*RRList
;
222 } DNS_GENERAL_LOOKUP_DATA
;
225 /// EFI_DNS4_COMPLETION_TOKEN
229 /// This Event will be signaled after the Status field is updated by the EFI DNS
230 /// protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
234 /// Will be set to one of the following values:
235 /// EFI_SUCCESS: The host name to address translation completed successfully.
236 /// EFI_NOT_FOUND: No matching Resource Record (RR) is found.
237 /// EFI_TIMEOUT: No DNS server reachable, or RetryCount was exhausted without
238 /// response from all specified DNS servers.
239 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
240 /// EFI_NO_MEDIA: There was a media error.
244 /// Retry number if no response received after RetryInterval. If zero, use the
245 /// parameter configured through Dns.Configure() interface.
249 /// Minimum interval of retry is 2 second. If the retry interval is less than 2
250 /// seconds, then use the 2 seconds. If zero, use the parameter configured through
251 /// Dns.Configure() interface.
252 UINT32 RetryInterval
;
254 /// DNSv4 completion token data
258 /// When the Token is used for host name to address translation, H2AData is a pointer
259 /// to the DNS_HOST_TO_ADDR_DATA.
261 DNS_HOST_TO_ADDR_DATA
*H2AData
;
263 /// When the Token is used for host address to host name translation, A2HData is a
264 /// pointer to the DNS_ADDR_TO_HOST_DATA.
266 DNS_ADDR_TO_HOST_DATA
*A2HData
;
268 /// When the Token is used for a general lookup function, GLookupDATA is a pointer to
269 /// the DNS_GENERAL_LOOKUP_DATA.
271 DNS_GENERAL_LOOKUP_DATA
*GLookupData
;
273 } EFI_DNS4_COMPLETION_TOKEN
;
276 Retrieve mode data of this DNS instance.
278 This function is used to retrieve DNS mode data for this DNS instance.
280 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
281 @param[out] DnsModeData Point to the mode data.
283 @retval EFI_SUCCESS The operation completed successfully.
284 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
285 is available because this instance has not been
287 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
288 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
292 (EFIAPI
*EFI_DNS4_GET_MODE_DATA
) (
293 IN EFI_DNS4_PROTOCOL
*This
,
294 OUT EFI_DNS4_MODE_DATA
*DnsModeData
298 Configure this DNS instance.
300 This function is used to configure DNS mode data for this DNS instance.
302 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
303 @param[in] DnsConfigData Point to the Configuration data.
305 @retval EFI_SUCCESS The operation completed successfully.
306 @retval EFI_UNSUPPORTED The designated protocol is not supported.
307 @retval EFI_INVALID_PARAMETER This is NULL.
308 The StationIp address provided in DnsConfigData is not a
310 DnsServerList is NULL while DnsServerListCount
312 DnsServerListCount is ZERO while DnsServerList
314 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
316 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
317 EFI DNSv4 Protocol instance is not configured.
318 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
319 reconfigure the instance the caller must call Configure()
320 with NULL first to return driver to unconfigured state.
324 (EFIAPI
*EFI_DNS4_CONFIGURE
) (
325 IN EFI_DNS4_PROTOCOL
*This
,
326 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
330 Host name to host address translation.
332 The HostNameToIp () function is used to translate the host name to host IP address. A
333 type A query is used to get the one or more IP addresses for this host.
335 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
336 @param[in] HostName Host name.
337 @param[in] Token Point to the completion token to translate host name
340 @retval EFI_SUCCESS The operation completed successfully.
341 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
345 HostName is NULL. HostName string is unsupported format.
346 @retval EFI_NO_MAPPING There's no source address is available for use.
347 @retval EFI_NOT_STARTED This instance has not been started.
351 (EFIAPI
*EFI_DNS4_HOST_NAME_TO_IP
) (
352 IN EFI_DNS4_PROTOCOL
*This
,
354 IN EFI_DNS4_COMPLETION_TOKEN
*Token
358 IPv4 address to host name translation also known as Reverse DNS lookup.
360 The IpToHostName() function is used to translate the host address to host name. A type PTR
361 query is used to get the primary name of the host. Support of this function is optional.
363 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
364 @param[in] IpAddress Ip Address.
365 @param[in] Token Point to the completion token to translate host
366 address to host name.
368 @retval EFI_SUCCESS The operation completed successfully.
369 @retval EFI_UNSUPPORTED This function is not supported.
370 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
374 IpAddress is not valid IP address .
375 @retval EFI_NO_MAPPING There's no source address is available for use.
376 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
377 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
381 (EFIAPI
*EFI_DNS4_IP_TO_HOST_NAME
) (
382 IN EFI_DNS4_PROTOCOL
*This
,
383 IN EFI_IPv4_ADDRESS IpAddress
,
384 IN EFI_DNS4_COMPLETION_TOKEN
*Token
388 Retrieve arbitrary information from the DNS server.
390 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
391 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
392 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
393 required information. The function is optional.
395 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
396 @param[in] QName Pointer to Query Name.
397 @param[in] QType Query Type.
398 @param[in] QClass Query Name.
399 @param[in] Token Point to the completion token to retrieve arbitrary
402 @retval EFI_SUCCESS The operation completed successfully.
403 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
404 QType is not supported
405 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
410 @retval EFI_NO_MAPPING There's no source address is available for use.
411 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
412 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
416 (EFIAPI
*EFI_DNS4_GENERAL_LOOKUP
) (
417 IN EFI_DNS4_PROTOCOL
*This
,
421 IN EFI_DNS4_COMPLETION_TOKEN
*Token
425 This function is to update the DNS Cache.
427 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
428 can be normally dynamically updated after the DNS resolve succeeds. This function
429 provided capability to manually add/delete/modify the DNS cache.
431 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
432 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
433 DNS Cahce. If TRUE, this function will delete
434 matching DNS Cache entry.
435 @param[in] Override If TRUE, the maching DNS cache entry will be
436 overwritten with the supplied parameter. If FALSE,
437 EFI_ACCESS_DENIED will be returned if the entry to
438 be added is already existed.
439 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
441 @retval EFI_SUCCESS The operation completed successfully.
442 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
444 DnsCacheEntry.HostName is NULL.
445 DnsCacheEntry.IpAddress is NULL.
446 DnsCacheEntry.Timeout is zero.
447 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
452 (EFIAPI
*EFI_DNS4_UPDATE_DNS_CACHE
) (
453 IN EFI_DNS4_PROTOCOL
*This
,
454 IN BOOLEAN DeleteFlag
,
456 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
460 Polls for incoming data packets and processes outgoing data packets.
462 The Poll() function can be used by network drivers and applications to increase the
463 rate that data packets are moved between the communications device and the transmit
465 In some systems, the periodic timer event in the managed network driver may not poll
466 the underlying communications device fast enough to transmit and/or receive all data
467 packets without missing incoming packets or dropping outgoing packets. Drivers and
468 applications that are experiencing packet loss should try calling the Poll()
471 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
473 @retval EFI_SUCCESS Incoming or outgoing data was processed.
474 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
475 @retval EFI_INVALID_PARAMETER This is NULL.
476 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
477 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
478 queue. Consider increasing the polling rate.
482 (EFIAPI
*EFI_DNS4_POLL
) (
483 IN EFI_DNS4_PROTOCOL
*This
487 Abort an asynchronous DNS operation, including translation between IP and Host, and
488 general look up behavior.
490 The Cancel() function is used to abort a pending resolution request. After calling
491 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
492 signaled. If the token is not in one of the queues, which usually means that the
493 asynchronous operation has completed, this function will not signal the token and
494 EFI_NOT_FOUND is returned.
496 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
497 @param[in] Token Pointer to a token that has been issued by
498 EFI_DNS4_PROTOCOL.HostNameToIp (),
499 EFI_DNS4_PROTOCOL.IpToHostName() or
500 EFI_DNS4_PROTOCOL.GeneralLookup().
501 If NULL, all pending tokens are aborted.
503 @retval EFI_SUCCESS Incoming or outgoing data was processed.
504 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
505 @retval EFI_INVALID_PARAMETER This is NULL.
506 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
507 operation was not found in the transmit queue. It
508 was either completed or was not issued by
509 HostNameToIp(), IpToHostName() or GeneralLookup().
513 (EFIAPI
*EFI_DNS4_CANCEL
) (
514 IN EFI_DNS4_PROTOCOL
*This
,
515 IN EFI_DNS4_COMPLETION_TOKEN
*Token
519 /// The EFI_DNS4_Protocol provides the function to get the host name and address
520 /// mapping, also provides pass through interface to retrieve arbitrary information
523 struct _EFI_DNS4_PROTOCOL
{
524 EFI_DNS4_GET_MODE_DATA GetModeData
;
525 EFI_DNS4_CONFIGURE Configure
;
526 EFI_DNS4_HOST_NAME_TO_IP HostNameToIp
;
527 EFI_DNS4_IP_TO_HOST_NAME IpToHostName
;
528 EFI_DNS4_GENERAL_LOOKUP GeneralLookUp
;
529 EFI_DNS4_UPDATE_DNS_CACHE UpdateDnsCache
;
531 EFI_DNS4_CANCEL Cancel
;
534 extern EFI_GUID gEfiDns4ServiceBindingProtocolGuid
;
535 extern EFI_GUID gEfiDns4ProtocolGuid
;