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, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 @par Revision Reference:
17 This Protocol is introduced in UEFI Specification 2.5
21 #ifndef __EFI_DNS4_PROTOCOL_H__
22 #define __EFI_DNS4_PROTOCOL_H__
24 #define EFI_DNS4_SERVICE_BINDING_PROTOCOL_GUID \
26 0xb625b186, 0xe063, 0x44f7, {0x89, 0x5, 0x6a, 0x74, 0xdc, 0x6f, 0x52, 0xb4 } \
29 #define EFI_DNS4_PROTOCOL_GUID \
31 0xae3d28cc, 0xe05b, 0x4fa1, {0xa0, 0x11, 0x7e, 0xb5, 0x5a, 0x3f, 0x14, 0x1 } \
34 typedef struct _EFI_DNS4_PROTOCOL EFI_DNS4_PROTOCOL
;
37 /// EFI_DNS4_CONFIG_DATA
41 /// Count of the DNS servers. When used with GetModeData(),
42 /// this field is the count of originally configured servers when
43 /// Configure() was called for this instance. When used with
44 /// Configure() this is the count of caller-supplied servers. If the
45 /// DnsServerListCount is zero, the DNS server configuration
46 /// will be retrieved from DHCP server automatically.
48 UINTN DnsServerListCount
;
50 /// Pointer to DNS server list containing DnsServerListCount entries or NULL
51 /// if DnsServerListCountis 0. For Configure(), this will be NULL when there are
52 /// no caller supplied server addresses, and, the DNS instance will retrieve
53 /// DNS server from DHCP Server. The provided DNS server list is
54 /// recommended to be filled up in the sequence of preference. When
55 /// used with GetModeData(), the buffer containing the list will
56 /// be allocated by the driver implementing this protocol and must be
57 /// freed by the caller. When used with Configure(), the buffer
58 /// containing the list will be allocated and released by the caller.
60 EFI_IPv4_ADDRESS
*DnsServerList
;
62 /// Set to TRUE to use the default IP address/subnet mask and default routing table.
64 BOOLEAN UseDefaultSetting
;
66 /// If TRUE, enable DNS cache function for this DNS instance. If FALSE, all DNS
67 /// query will not lookup local DNS cache.
69 BOOLEAN EnableDnsCache
;
71 /// Use the protocol number defined in "Links to UEFI-Related
72 /// Documents"(http://uefi.org/uefi) under the heading "IANA
73 /// Protocol Numbers". Only TCP or UDP are supported, and other
74 /// protocol values are invalid. An implementation can choose to
75 /// support only UDP, or both TCP and UDP.
79 /// If UseDefaultSetting is FALSE indicates the station address to use.
81 EFI_IPv4_ADDRESS StationIp
;
83 /// If UseDefaultSetting is FALSE indicates the subnet mask to use.
85 EFI_IPv4_ADDRESS SubnetMask
;
87 /// Local port number. Set to zero to use the automatically assigned port number.
91 /// Retry number if no response received after RetryInterval.
95 /// Minimum interval of retry is 2 second. If the retry interval is less than 2
96 /// seconds, then use the 2 seconds.
99 } EFI_DNS4_CONFIG_DATA
;
103 /// EFI_DNS4_CACHE_ENTRY
111 /// IP address of this host.
113 EFI_IPv4_ADDRESS
*IpAddress
;
115 /// Time in second unit that this entry will remain in DNS cache. A value of zero
116 /// means that this entry is permanent. A nonzero value will override the existing
117 /// one if this entry to be added is dynamic entry. Implementations may set its
118 /// default timeout value for the dynamically created DNS cache entry after one DNS
119 /// resolve succeeds.
122 } EFI_DNS4_CACHE_ENTRY
;
125 /// EFI_DNS4_MODE_DATA
129 /// The configuration data of this instance.
131 EFI_DNS4_CONFIG_DATA DnsConfigData
;
133 /// Number of configured DNS server. Each DNS instance has its own DNS server
136 UINT32 DnsServerCount
;
138 /// Pointer to common list of addresses of all configured DNS server
139 /// used by EFI_DNS4_PROTOCOL instances. List will include
140 /// DNS servers configured by this or any other EFI_DNS4_PROTOCOL instance.
141 /// The storage for this list is allocated by the driver publishing this
142 /// protocol, and must be freed by the caller.
144 EFI_IPv4_ADDRESS
*DnsServerList
;
146 /// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
148 UINT32 DnsCacheCount
;
150 /// Pointer to a buffer containing DnsCacheCount DNS Cache
151 /// entry structures. The storage for this list is allocated by the driver
152 /// publishing this protocol and must be freed by caller.
154 EFI_DNS4_CACHE_ENTRY
*DnsCacheList
;
155 } EFI_DNS4_MODE_DATA
;
158 /// DNS_HOST_TO_ADDR_DATA
162 /// Number of the returned IP addresses.
166 /// Pointer to the all the returned IP addresses.
168 EFI_IPv4_ADDRESS
*IpList
;
169 } DNS_HOST_TO_ADDR_DATA
;
172 /// DNS_ADDR_TO_HOST_DATA
176 /// Pointer to the primary name for this host address. It's the caller's
177 /// responsibility to free the response memory.
180 } DNS_ADDR_TO_HOST_DATA
;
183 /// DNS_RESOURCE_RECORD
191 /// The Type Code of this RR.
195 /// The CLASS code of this RR.
199 /// 32 bit integer which specify the time interval that the resource record may be
200 /// cached before the source of the information should again be consulted. Zero means
201 /// this RR can not be cached.
205 /// 16 big integer which specify the length of RData.
209 /// A string of octets that describe the resource, the format of this information
210 /// varies according to QType and QClass difference.
213 } DNS_RESOURCE_RECORD
;
216 /// DNS_GENERAL_LOOKUP_DATA
220 /// Number of returned matching RRs.
224 /// Pointer to the all the returned matching RRs. It's caller responsibility to free
225 /// the allocated memory to hold the returned RRs.
227 DNS_RESOURCE_RECORD
*RRList
;
228 } DNS_GENERAL_LOOKUP_DATA
;
231 /// EFI_DNS4_COMPLETION_TOKEN
235 /// This Event will be signaled after the Status field is updated by the EFI DNS
236 /// protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
240 /// Will be set to one of the following values:
241 /// EFI_SUCCESS: The host name to address translation completed successfully.
242 /// EFI_NOT_FOUND: No matching Resource Record (RR) is found.
243 /// EFI_TIMEOUT: No DNS server reachable, or RetryCount was exhausted without
244 /// response from all specified DNS servers.
245 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
246 /// EFI_NO_MEDIA: There was a media error.
250 /// Retry number if no response received after RetryInterval. If zero, use the
251 /// parameter configured through Dns.Configure() interface.
255 /// Minimum interval of retry is 2 second. If the retry interval is less than 2
256 /// seconds, then use the 2 seconds. If zero, use the parameter configured through
257 /// Dns.Configure() interface.
258 UINT32 RetryInterval
;
260 /// DNSv4 completion token data
264 /// When the Token is used for host name to address translation, H2AData is a pointer
265 /// to the DNS_HOST_TO_ADDR_DATA.
267 DNS_HOST_TO_ADDR_DATA
*H2AData
;
269 /// When the Token is used for host address to host name translation, A2HData is a
270 /// pointer to the DNS_ADDR_TO_HOST_DATA.
272 DNS_ADDR_TO_HOST_DATA
*A2HData
;
274 /// When the Token is used for a general lookup function, GLookupDATA is a pointer to
275 /// the DNS_GENERAL_LOOKUP_DATA.
277 DNS_GENERAL_LOOKUP_DATA
*GLookupData
;
279 } EFI_DNS4_COMPLETION_TOKEN
;
282 Retrieve mode data of this DNS instance.
284 This function is used to retrieve DNS mode data for this DNS instance.
286 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
287 @param[out] DnsModeData Point to the mode data.
289 @retval EFI_SUCCESS The operation completed successfully.
290 @retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
291 is available because this instance has not been
293 @retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
294 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
298 (EFIAPI
*EFI_DNS4_GET_MODE_DATA
) (
299 IN EFI_DNS4_PROTOCOL
*This
,
300 OUT EFI_DNS4_MODE_DATA
*DnsModeData
304 Configure this DNS instance.
306 This function is used to configure DNS mode data for this DNS instance.
308 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
309 @param[in] DnsConfigData Point to the Configuration data.
311 @retval EFI_SUCCESS The operation completed successfully.
312 @retval EFI_UNSUPPORTED The designated protocol is not supported.
313 @retval EFI_INVALID_PARAMTER Thisis NULL.
314 The StationIp address provided in DnsConfigData is not a
316 DnsServerList is NULL while DnsServerListCount
318 DnsServerListCount is ZERO while DnsServerList
320 @retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
322 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
323 EFI DNSv4 Protocol instance is not configured.
324 @retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
325 reconfigure the instance the caller must call Configure()
326 with NULL first to return driver to unconfigured state.
330 (EFIAPI
*EFI_DNS4_CONFIGURE
) (
331 IN EFI_DNS4_PROTOCOL
*This
,
332 IN EFI_DNS4_CONFIG_DATA
*DnsConfigData
336 Host name to host address translation.
338 The HostNameToIp () function is used to translate the host name to host IP address. A
339 type A query is used to get the one or more IP addresses for this host.
341 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
342 @param[in] Hostname Host name.
343 @param[in] Token Point to the completion token to translate host name
346 @retval EFI_SUCCESS The operation completed successfully.
347 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
351 HostName is NULL. HostName string is unsupported format.
352 @retval EFI_NO_MAPPING There's no source address is available for use.
353 @retval EFI_NOT_STARTED This instance has not been started.
357 (EFIAPI
*EFI_DNS4_HOST_NAME_TO_IP
) (
358 IN EFI_DNS4_PROTOCOL
*This
,
360 IN EFI_DNS4_COMPLETION_TOKEN
*Token
364 IPv4 address to host name translation also known as Reverse DNS lookup.
366 The IpToHostName() function is used to translate the host address to host name. A type PTR
367 query is used to get the primary name of the host. Support of this function is optional.
369 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
370 @param[in] IpAddress Ip Address.
371 @param[in] Token Point to the completion token to translate host
372 address to host name.
374 @retval EFI_SUCCESS The operation completed successfully.
375 @retval EFI_UNSUPPORTED This function is not supported.
376 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
380 IpAddress is not valid IP address .
381 @retval EFI_NO_MAPPING There's no source address is available for use.
382 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
383 @retval EFI_NOT_STARTED This instance has not been started.
384 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
388 (EFIAPI
*EFI_DNS4_IP_TO_HOST_NAME
) (
389 IN EFI_DNS4_PROTOCOL
*This
,
390 IN EFI_IPv4_ADDRESS IpAddress
,
391 IN EFI_DNS4_COMPLETION_TOKEN
*Token
395 Retrieve arbitrary information from the DNS server.
397 This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
398 supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
399 RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
400 required information. The function is optional.
402 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
403 @param[in] QName Pointer to Query Name.
404 @param[in] QType Query Type.
405 @param[in] QClass Query Name.
406 @param[in] Token Point to the completion token to retrieve arbitrary
409 @retval EFI_SUCCESS The operation completed successfully.
410 @retval EFI_UNSUPPORTED This function is not supported. Or the requested
411 QType is not supported
412 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
417 @retval EFI_NO_MAPPING There's no source address is available for use.
418 @retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
419 @retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
423 (EFIAPI
*EFI_DNS4_GENERAL_LOOKUP
) (
424 IN EFI_DNS4_PROTOCOL
*This
,
428 IN EFI_DNS4_COMPLETION_TOKEN
*Token
432 This function is to update the DNS Cache.
434 The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
435 can be normally dynamically updated after the DNS resolve succeeds. This function
436 provided capability to manually add/delete/modify the DNS cache.
438 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
439 @param[in] DeleteFlag If FALSE, this function is to add one entry to the
440 DNS Cahce. If TRUE, this function will delete
441 matching DNS Cache entry.
442 @param[in] Override If TRUE, the maching DNS cache entry will be
443 overwritten with the supplied parameter. If FALSE,
444 EFI_ACCESS_DENIED will be returned if the entry to
445 be added is already existed.
446 @param[in] DnsCacheEntry Pointer to DNS Cache entry.
448 @retval EFI_SUCCESS The operation completed successfully.
449 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
451 DnsCacheEntry.HostName is NULL.
452 DnsCacheEntry.IpAddress is NULL.
453 DnsCacheEntry.Timeout is zero.
454 @retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
459 (EFIAPI
*EFI_DNS4_UPDATE_DNS_CACHE
) (
460 IN EFI_DNS4_PROTOCOL
*This
,
461 IN BOOLEAN DeleteFlag
,
463 IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
467 Polls for incoming data packets and processes outgoing data packets.
469 The Poll() function can be used by network drivers and applications to increase the
470 rate that data packets are moved between the communications device and the transmit
472 In some systems, the periodic timer event in the managed network driver may not poll
473 the underlying communications device fast enough to transmit and/or receive all data
474 packets without missing incoming packets or dropping outgoing packets. Drivers and
475 applications that are experiencing packet loss should try calling the Poll()
478 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
480 @retval EFI_SUCCESS Incoming or outgoing data was processed.
481 @retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
482 @retval EFI_INVALID_PARAMETER This is NULL.
483 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
484 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
485 queue. Consider increasing the polling rate.
489 (EFIAPI
*EFI_DNS4_POLL
) (
490 IN EFI_DNS4_PROTOCOL
*This
494 Abort an asynchronous DNS operation, including translation between IP and Host, and
495 general look up behavior.
497 The Cancel() function is used to abort a pending resolution request. After calling
498 this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
499 signaled. If the token is not in one of the queues, which usually means that the
500 asynchronous operation has completed, this function will not signal the token and
501 EFI_NOT_FOUND is returned.
503 @param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
504 @param[in] Token Pointer to a token that has been issued by
505 EFI_DNS4_PROTOCOL.HostNameToIp (),
506 EFI_DNS4_PROTOCOL.IpToHostName() or
507 EFI_DNS4_PROTOCOL.GeneralLookup().
508 If NULL, all pending tokens are aborted.
510 @retval EFI_SUCCESS Incoming or outgoing data was processed.
511 @retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
512 @retval EFI_INVALID_PARAMETER This is NULL.
513 @retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
514 operation was not found in the transmit queue. It
515 was either completed or was not issued by
516 HostNameToIp(), IpToHostName() or GeneralLookup().
520 (EFIAPI
*EFI_DNS4_CANCEL
) (
521 IN EFI_DNS4_PROTOCOL
*This
,
522 IN EFI_DNS4_COMPLETION_TOKEN
*Token
526 /// The EFI_DNS4_Protocol provides the function to get the host name and address
527 /// mapping, also provides pass through interface to retrieve arbitrary information
530 struct _EFI_DNS4_PROTOCOL
{
531 EFI_DNS4_GET_MODE_DATA GetModeData
;
532 EFI_DNS4_CONFIGURE Configure
;
533 EFI_DNS4_HOST_NAME_TO_IP HostNameToIp
;
534 EFI_DNS4_IP_TO_HOST_NAME IpToHostName
;
535 EFI_DNS4_GENERAL_LOOKUP GeneralLookUp
;
536 EFI_DNS4_UPDATE_DNS_CACHE UpdateDnsCache
;
538 EFI_DNS4_CANCEL Cancel
;
541 extern EFI_GUID gEfiDns4ServiceBindingProtocolGuid
;
542 extern EFI_GUID gEfiDns4ProtocolGuid
;