MdePkg: Add header files for DNS/HTTP/IP4Config2.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17567 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jiaxinwu 2015-06-08 02:04:06 +00:00 committed by jiaxinwu
parent 5d832d6216
commit cff298f44c
5 changed files with 1922 additions and 0 deletions

View File

@ -0,0 +1,544 @@
/** @file
This file defines the EFI Domain Name Service Binding Protocol interface. It is split
into the following two main sections:
DNSv4 Service Binding Protocol (DNSv4SB)
DNSv4 Protocol (DNSv4)
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.5
**/
#ifndef __EFI_DNS4_PROTOCOL_H__
#define __EFI_DNS4_PROTOCOL_H__
#define EFI_DNS4_SERVICE_BINDING_PROTOCOL_GUID \
{ \
0xb625b186, 0xe063, 0x44f7, {0x89, 0x5, 0x6a, 0x74, 0xdc, 0x6f, 0x52, 0xb4 } \
}
#define EFI_DNS4_PROTOCOL_GUID \
{ \
0xae3d28cc, 0xe05b, 0x4fa1, {0xa0, 0x11, 0x7e, 0xb5, 0x5a, 0x3f, 0x14, 0x1 } \
}
typedef struct _EFI_DNS4_PROTOCOL EFI_DNS4_PROTOCOL;
///
/// EFI_DNS4_CONFIG_DATA
///
typedef struct {
///
/// Count of the DNS servers. When used with GetModeData(),
/// this field is the count of originally configured servers when
/// Configure() was called for this instance. When used with
/// Configure() this is the count of caller-supplied servers. If the
/// DnsServerListCount is zero, the DNS server configuration
/// will be retrieved from DHCP server automatically.
///
UINTN DnsServerListCount;
///
/// Pointer to DNS server list containing DnsServerListCount entries or NULL
/// if DnsServerListCountis 0. For Configure(), this will be NULL when there are
/// no caller supplied server addresses, and, the DNS instance will retrieve
/// DNS server from DHCP Server. The provided DNS server list is
/// recommended to be filled up in the sequence of preference. When
/// used with GetModeData(), the buffer containing the list will
/// be allocated by the driver implementing this protocol and must be
/// freed by the caller. When used with Configure(), the buffer
/// containing the list will be allocated and released by the caller.
///
EFI_IPv4_ADDRESS *DnsServerList;
///
/// Set to TRUE to use the default IP address/subnet mask and default routing table.
///
BOOLEAN UseDefaultSetting;
///
/// If TRUE, enable DNS cache function for this DNS instance. If FALSE, all DNS
/// query will not lookup local DNS cache.
///
BOOLEAN EnableDnsCache;
///
/// Use the protocol number defined in "Links to UEFI-Related
/// Documents"(http://uefi.org/uefi) under the heading "IANA
/// Protocol Numbers". Only TCP or UDP are supported, and other
/// protocol values are invalid. An implementation can choose to
/// support only UDP, or both TCP and UDP.
///
UINT8 Protocol;
///
/// If UseDefaultSetting is FALSE indicates the station address to use.
///
EFI_IPv4_ADDRESS StationIp;
///
/// If UseDefaultSetting is FALSE indicates the subnet mask to use.
///
EFI_IPv4_ADDRESS SubnetMask;
///
/// Local port number. Set to zero to use the automatically assigned port number.
///
UINT16 LocalPort;
///
/// Retry number if no response received after RetryInterval.
///
UINT32 RetryCount;
///
/// Minimum interval of retry is 2 second. If the retry interval is less than 2
/// seconds, then use the 2 seconds.
///
UINT32 RetryInterval;
} EFI_DNS4_CONFIG_DATA;
///
/// EFI_DNS4_CACHE_ENTRY
///
typedef struct {
///
/// Host name.
///
CHAR16 *HostName;
///
/// IP address of this host.
///
EFI_IPv4_ADDRESS *IpAddress;
///
/// Time in second unit that this entry will remain in DNS cache. A value of zero
/// means that this entry is permanent. A nonzero value will override the existing
/// one if this entry to be added is dynamic entry. Implementations may set its
/// default timeout value for the dynamically created DNS cache entry after one DNS
/// resolve succeeds.
///
UINT32 Timeout;
} EFI_DNS4_CACHE_ENTRY;
///
/// EFI_DNS4_MODE_DATA
///
typedef struct {
///
/// The configuration data of this instance.
///
EFI_DNS4_CONFIG_DATA DnsConfigData;
///
/// Number of configured DNS server. Each DNS instance has its own DNS server
/// configuration.
///
UINT32 DnsServerCount;
///
/// Pointer to common list of addresses of all configured DNS server
/// used by EFI_DNS4_PROTOCOL instances. List will include
/// DNS servers configured by this or any other EFI_DNS4_PROTOCOL instance.
/// The storage for this list is allocated by the driver publishing this
/// protocol, and must be freed by the caller.
///
EFI_IPv4_ADDRESS *DnsServerList;
///
/// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
///
UINT32 DnsCacheCount;
///
/// Pointer to a buffer containing DnsCacheCount DNS Cache
/// entry structures. The storage for this list is allocated by the driver
/// publishing this protocol and must be freed by caller.
///
EFI_DNS4_CACHE_ENTRY *DnsCacheList;
} EFI_DNS4_MODE_DATA;
///
/// DNS_HOST_TO_ADDR_DATA
///
typedef struct {
///
/// Number of the returned IP addresses.
///
UINT32 IpCount;
///
/// Pointer to the all the returned IP addresses.
///
EFI_IPv4_ADDRESS *IpList;
} DNS_HOST_TO_ADDR_DATA;
///
/// DNS_ADDR_TO_HOST_DATA
///
typedef struct {
///
/// Pointer to the primary name for this host address. It's the caller's
/// responsibility to free the response memory.
///
CHAR16 *HostName;
} DNS_ADDR_TO_HOST_DATA;
///
/// DNS_RESOURCE_RECORD
///
typedef struct {
///
/// The Owner name.
///
CHAR8 *QName;
///
/// The Type Code of this RR.
///
UINT16 QType;
///
/// The CLASS code of this RR.
///
UINT16 QClass;
///
/// 32 bit integer which specify the time interval that the resource record may be
/// cached before the source of the information should again be consulted. Zero means
/// this RR can not be cached.
///
UINT32 TTL;
///
/// 16 big integer which specify the length of RData.
///
UINT16 DataLength;
///
/// A string of octets that describe the resource, the format of this information
/// varies according to QType and QClass difference.
///
CHAR8 *RData;
} DNS_RESOURCE_RECORD;
///
/// DNS_GENERAL_LOOKUP_DATA
///
typedef struct {
///
/// Number of returned matching RRs.
///
UINTN RRCount;
///
/// Pointer to the all the returned matching RRs. It's caller responsibility to free
/// the allocated memory to hold the returned RRs.
///
DNS_RESOURCE_RECORD *RRList;
} DNS_GENERAL_LOOKUP_DATA;
///
/// EFI_DNS4_COMPLETION_TOKEN
///
typedef struct {
///
/// This Event will be signaled after the Status field is updated by the EFI DNS
/// protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
///
EFI_EVENT Event;
///
/// Will be set to one of the following values:
/// EFI_SUCCESS: The host name to address translation completed successfully.
/// EFI_NOT_FOUND: No matching Resource Record (RR) is found.
/// EFI_TIMEOUT: No DNS server reachable, or RetryCount was exhausted without
/// response from all specified DNS servers.
/// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
/// EFI_NO_MEDIA: There was a media error.
///
EFI_STATUS Status;
///
/// Retry number if no response received after RetryInterval. If zero, use the
/// parameter configured through Dns.Configure() interface.
///
UINT32 RetryCount;
///
/// Minimum interval of retry is 2 second. If the retry interval is less than 2
/// seconds, then use the 2 seconds. If zero, use the parameter configured through
/// Dns.Configure() interface.
UINT32 RetryInterval;
///
/// DNSv4 completion token data
///
union {
///
/// When the Token is used for host name to address translation, H2AData is a pointer
/// to the DNS_HOST_TO_ADDR_DATA.
///
DNS_HOST_TO_ADDR_DATA *H2AData;
///
/// When the Token is used for host address to host name translation, A2HData is a
/// pointer to the DNS_ADDR_TO_HOST_DATA.
///
DNS_ADDR_TO_HOST_DATA *A2HData;
///
/// When the Token is used for a general lookup function, GLookupDATA is a pointer to
/// the DNS_GENERAL_LOOKUP_DATA.
///
DNS_GENERAL_LOOKUP_DATA *GLookupData;
} RspData;
} EFI_DNS4_COMPLETION_TOKEN;
/**
Retrieve mode data of this DNS instance.
This function is used to retrieve DNS mode data for this DNS instance.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[out] DnsModeData Point to the mode data.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
is available because this instance has not been
configured.
@retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_GET_MODE_DATA) (
IN EFI_DNS4_PROTOCOL *This,
OUT EFI_DNS4_MODE_DATA *DnsModeData
);
/**
Configure this DNS instance.
This function is used to configure DNS mode data for this DNS instance.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] DnsConfigData Point to the Configuration data.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_UNSUPPORTED The designated protocol is not supported.
@retval EFI_INVALID_PARAMTER Thisis NULL.
The StationIp address provided in DnsConfigData is not a
valid unicast.
DnsServerList is NULL while DnsServerListCount
is not ZERO.
DnsServerListCount is ZERO while DnsServerList
is not NULL
@retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be
allocated.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
EFI DNSv4 Protocol instance is not configured.
@retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
reconfigure the instance the caller must call Configure()
with NULL first to return driver to unconfigured state.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_CONFIGURE) (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_CONFIG_DATA *DnsConfigData
);
/**
Host name to host address translation.
The HostNameToIp () function is used to translate the host name to host IP address. A
type A query is used to get the one or more IP addresses for this host.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] Hostname Host name.
@param[in] Token Point to the completion token to translate host name
to host address.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
HostName is NULL. HostName string is unsupported format.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_NOT_STARTED This instance has not been started.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_HOST_NAME_TO_IP) (
IN EFI_DNS4_PROTOCOL *This,
IN CHAR16 *HostName,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
IPv4 address to host name translation also known as Reverse DNS lookup.
The IpToHostName() function is used to translate the host address to host name. A type PTR
query is used to get the primary name of the host. Support of this function is optional.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] IpAddress Ip Address.
@param[in] Token Point to the completion token to translate host
address to host name.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_UNSUPPORTED This function is not supported.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
IpAddress is not valid IP address .
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
@retval EFI_NOT_STARTED This instance has not been started.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_IP_TO_HOST_NAME) (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_IPv4_ADDRESS IpAddress,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
Retrieve arbitrary information from the DNS server.
This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
required information. The function is optional.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] QName Pointer to Query Name.
@param[in] QType Query Type.
@param[in] QClass Query Name.
@param[in] Token Point to the completion token to retrieve arbitrary
information.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_UNSUPPORTED This function is not supported. Or the requested
QType is not supported
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
QName is NULL.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_GENERAL_LOOKUP) (
IN EFI_DNS4_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
/**
This function is to update the DNS Cache.
The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
can be normally dynamically updated after the DNS resolve succeeds. This function
provided capability to manually add/delete/modify the DNS cache.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] DeleteFlag If FALSE, this function is to add one entry to the
DNS Cahce. If TRUE, this function will delete
matching DNS Cache entry.
@param[in] Override If TRUE, the maching DNS cache entry will be
overwritten with the supplied parameter. If FALSE,
EFI_ACCESS_DENIED will be returned if the entry to
be added is already existed.
@param[in] DnsCacheEntry Pointer to DNS Cache entry.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
DnsCacheEntry.HostName is NULL.
DnsCacheEntry.IpAddress is NULL.
DnsCacheEntry.Timeout is zero.
@retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
not TRUE.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_UPDATE_DNS_CACHE) (
IN EFI_DNS4_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry
);
/**
Polls for incoming data packets and processes outgoing data packets.
The Poll() function can be used by network drivers and applications to increase the
rate that data packets are moved between the communications device and the transmit
and receive queues.
In some systems, the periodic timer event in the managed network driver may not poll
the underlying communications device fast enough to transmit and/or receive all data
packets without missing incoming packets or dropping outgoing packets. Drivers and
applications that are experiencing packet loss should try calling the Poll()
function more often.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
queue. Consider increasing the polling rate.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_POLL) (
IN EFI_DNS4_PROTOCOL *This
);
/**
Abort an asynchronous DNS operation, including translation between IP and Host, and
general look up behavior.
The Cancel() function is used to abort a pending resolution request. After calling
this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
signaled. If the token is not in one of the queues, which usually means that the
asynchronous operation has completed, this function will not signal the token and
EFI_NOT_FOUND is returned.
@param[in] This Pointer to EFI_DNS4_PROTOCOL instance.
@param[in] Token Pointer to a token that has been issued by
EFI_DNS4_PROTOCOL.HostNameToIp (),
EFI_DNS4_PROTOCOL.IpToHostName() or
EFI_DNS4_PROTOCOL.GeneralLookup().
If NULL, all pending tokens are aborted.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI DNS4 Protocol instance has not been started.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
operation was not found in the transmit queue. It
was either completed or was not issued by
HostNameToIp(), IpToHostName() or GeneralLookup().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS4_CANCEL) (
IN EFI_DNS4_PROTOCOL *This,
IN EFI_DNS4_COMPLETION_TOKEN *Token
);
///
/// The EFI_DNS4_Protocol provides the function to get the host name and address
/// mapping, also provides pass through interface to retrieve arbitrary information
/// from DNS.
///
struct _EFI_DNS4_PROTOCOL {
EFI_DNS4_GET_MODE_DATA GetModeData;
EFI_DNS4_CONFIGURE Configure;
EFI_DNS4_HOST_NAME_TO_IP HostNameToIp;
EFI_DNS4_IP_TO_HOST_NAME IpToHostName;
EFI_DNS4_GENERAL_LOOKUP GeneralLookUp;
EFI_DNS4_UPDATE_DNS_CACHE UpdateDnsCache;
EFI_DNS4_POLL Poll;
EFI_DNS4_CANCEL Cancel;
};
extern EFI_GUID gEfiDns4ServiceBindingProtocolGuid;
extern EFI_GUID gEfiDns4ProtocolGuid;
#endif

View File

@ -0,0 +1,539 @@
/** @file
This file defines the EFI DNSv6 (Domain Name Service version 6) Protocol. It is split
into the following two main sections:
DNSv6 Service Binding Protocol (DNSv6SB)
DNSv6 Protocol (DNSv6)
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.5
**/
#ifndef __EFI_DNS6_PROTOCOL_H__
#define __EFI_DNS6_PROTOCOL_H__
#define EFI_DNS6_SERVICE_BINDING_PROTOCOL_GUID \
{ \
0x7f1647c8, 0xb76e, 0x44b2, {0xa5, 0x65, 0xf7, 0xf, 0xf1, 0x9c, 0xd1, 0x9e } \
}
#define EFI_DNS6_PROTOCOL_GUID \
{ \
0xca37bc1f, 0xa327, 0x4ae9, {0x82, 0x8a, 0x8c, 0x40, 0xd8, 0x50, 0x6a, 0x17 } \
}
typedef struct _EFI_DNS6_PROTOCOL EFI_DNS6_PROTOCOL;
///
/// EFI_DNS6_CONFIG_DATA
///
typedef struct {
///
/// If TRUE, enable DNS cache function for this DNS instance. If FALSE, all DNS query
/// will not lookup local DNS cache.
///
BOOLEAN EnableDnsCache;
///
/// Use the protocol number defined in
/// http://www.iana.org/assignments/protocol-numbers. Beside TCP/UDP, Other protocol
/// is invalid value. An implementation can choose to support UDP, or both TCP and UDP.
///
UINT8 Protocol;
///
/// The local IP address to use. Set to zero to let the underlying IPv6
/// driver choose a source address. If not zero it must be one of the
/// configured IP addresses in the underlying IPv6 driver.
///
EFI_IPv6_ADDRESS StationIp;
///
/// Local port number. Set to zero to use the automatically assigned port number.
///
UINT16 LocalPort;
///
/// Count of the DNS servers. When used with GetModeData(),
/// this field is the count of originally configured servers when
/// Configure() was called for this instance. When used with
/// Configure() this is the count of caller-supplied servers. If the
/// DnsServerListCount is zero, the DNS server configuration
/// will be retrieved from DHCP server automatically.
///
UINT32 DnsServerCount;
///
/// Pointer to DNS server list containing DnsServerListCount
/// entries or NULL if DnsServerListCount is 0. For Configure(),
/// this will be NULL when there are no caller supplied server addresses
/// and the DNS instance will retrieve DNS server from DHCP Server.
/// The provided DNS server list is recommended to be filled up in the sequence
/// of preference. When used with GetModeData(), the buffer containing the list
/// will be allocated by the driver implementing this protocol and must be
/// freed by the caller. When used with Configure(), the buffer
/// containing the list will be allocated and released by the caller.
///
EFI_IPv6_ADDRESS *DnsServerList;
///
/// Retry number if no response received after RetryInterval.
///
UINT32 RetryCount;
///
/// Minimum interval of retry is 2 second. If the retry interval is less than 2
/// seconds, then use the 2 seconds.
UINT32 RetryInterval;
} EFI_DNS6_CONFIG_DATA;
///
/// EFI_DNS6_CACHE_ENTRY
///
typedef struct {
///
/// Host name. This should be interpreted as Unicode characters.
///
CHAR16 *HostName;
///
/// IP address of this host.
///
EFI_IPv6_ADDRESS *IpAddress;
///
/// Time in second unit that this entry will remain in DNS cache. A value of zero means
/// that this entry is permanent. A nonzero value will override the existing one if
/// this entry to be added is dynamic entry. Implementations may set its default
/// timeout value for the dynamically created DNS cache entry after one DNS resolve
/// succeeds.
UINT32 Timeout;
} EFI_DNS6_CACHE_ENTRY;
///
/// EFI_DNS6_MODE_DATA
///
typedef struct {
///
/// The configuration data of this instance.
///
EFI_DNS6_CONFIG_DATA DnsConfigData;
///
/// Number of configured DNS6 servers.
///
UINT32 DnsServerCount;
///
/// Pointer to common list of addresses of all configured DNS server used by EFI_DNS6_PROTOCOL
/// instances. List will include DNS servers configured by this or any other EFI_DNS6_PROTOCOL
/// instance. The storage for this list is allocated by the driver publishing this protocol,
/// and must be freed by the caller.
///
EFI_IPv6_ADDRESS *DnsServerList;
///
/// Number of DNS Cache entries. The DNS Cache is shared among all DNS instances.
///
UINT32 DnsCacheCount;
///
/// Pointer to a buffer containing DnsCacheCount DNS Cache
/// entry structures. The storage for thislist is allocated by the driver
/// publishing this protocol and must be freed by caller.
///
EFI_DNS6_CACHE_ENTRY *DnsCacheList;
} EFI_DNS6_MODE_DATA;
///
/// DNS6_HOST_TO_ADDR_DATA
///
typedef struct {
///
/// Number of the returned IP address.
///
UINT32 IpCount;
///
/// Pointer to the all the returned IP address.
///
EFI_IPv6_ADDRESS *IpList;
} DNS6_HOST_TO_ADDR_DATA;
///
/// DNS6_ADDR_TO_HOST_DATA
///
typedef struct {
///
/// Pointer to the primary name for this host address. It's the caller's
/// responsibility to free the response memory.
///
CHAR16 *HostName;
} DNS6_ADDR_TO_HOST_DATA;
///
/// DNS6_RESOURCE_RECORD
///
typedef struct {
///
/// The Owner name.
///
CHAR8 *QName;
///
/// The Type Code of this RR.
///
UINT16 QType;
///
/// The CLASS code of this RR.
///
UINT16 QClass;
///
/// 32 bit integer which specify the time interval that the resource record may be
/// cached before the source of the information should again be consulted. Zero means
/// this RR cannot be cached.
///
UINT32 TTL;
///
/// 16 big integer which specify the length of RData.
///
UINT16 DataLength;
///
/// A string of octets that describe the resource, the format of this information
/// varies according to QType and QClass difference.
///
CHAR8 *RData;
} DNS6_RESOURCE_RECORD;
///
/// DNS6_GENERAL_LOOKUP_DATA
///
typedef struct {
///
/// Number of returned matching RRs.
///
UINTN RRCount;
///
/// Pointer to the all the returned matching RRs. It's caller responsibility to free
/// the allocated memory to hold the returned RRs.
///
DNS6_RESOURCE_RECORD *RRList;
} DNS6_GENERAL_LOOKUP_DATA;
///
/// EFI_DNS6_COMPLETION_TOKEN
///
typedef struct {
///
/// This Event will be signaled after the Status field is updated by the EFI DNSv6
/// protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.
///
EFI_EVENT Event;
///
/// Will be set to one of the following values:
/// EFI_SUCCESS: The host name to address translation completed successfully.
/// EFI_NOT_FOUND: No matching Resource Record (RR) is found.
/// EFI_TIMEOUT: No DNS server reachable, or RetryCount was exhausted without
/// response from all specified DNS servers.
/// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
/// EFI_NO_MEDIA: There was a media error.
///
EFI_STATUS Status;
///
/// The parameter configured through DNSv6.Configure() interface. Retry number if no
/// response received after RetryInterval.
///
UINT32 RetryCount;
///
/// The parameter configured through DNSv6.Configure() interface. Minimum interval of
/// retry is 2 seconds. If the retry interval is less than 2 seconds, then use the 2
/// seconds.
///
UINT32 RetryInterval;
///
/// DNSv6 completion token data
///
union {
///
/// When the Token is used for host name to address translation, H2AData is a pointer
/// to the DNS6_HOST_TO_ADDR_DATA.
///
DNS6_HOST_TO_ADDR_DATA *H2AData;
///
/// When the Token is used for host address to host name translation, A2HData is a
/// pointer to the DNS6_ADDR_TO_HOST_DATA.
///
DNS6_ADDR_TO_HOST_DATA *A2HData;
///
/// When the Token is used for a general lookup function, GLookupDATA is a pointer to
/// the DNS6_GENERAL_LOOKUP_DATA.
///
DNS6_GENERAL_LOOKUP_DATA *GLookupData;
} RspData;
} EFI_DNS6_COMPLETION_TOKEN;
/**
Retrieve mode data of this DNS instance.
This function is used to retrieve DNS mode data for this DNS instance.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[out] DnsModeData Pointer to the caller-allocated storage for the
EFI_DNS6_MODE_DATA data.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_NOT_STARTED When DnsConfigData is queried, no configuration data
is available because this instance has not been
configured.
@retval EFI_INVALID_PARAMETER This is NULL or DnsModeData is NULL.
@retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI * EFI_DNS6_GET_MODE_DATA)(
IN EFI_DNS6_PROTOCOL *This,
OUT EFI_DNS6_MODE_DATA *DnsModeData
);
/**
Configure this DNS instance.
The Configure() function is used to set and change the configuration data for this
EFI DNSv6 Protocol driver instance. Reset the DNS instance if DnsConfigData is NULL.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] DnsConfigData Pointer to the configuration data structure. All associated
storage to be allocated and released by caller.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMTER This is NULL.
The StationIp address provided in DnsConfigData is not a valid unicast.
DnsServerList is NULL while DnsServerList Count is not ZERO.
DnsServerList Count is ZERO while DnsServerList is not NULL.
@retval EFI_OUT_OF_RESOURCES The DNS instance data or required space could not be allocated.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The
EFI DNSv6 Protocol instance is not configured.
@retval EFI_UNSUPPORTED The designated protocol is not supported.
@retval EFI_ALREADY_STARTED Second call to Configure() with DnsConfigData. To
reconfigure the instance the caller must call Configure() with
NULL first to return driver to unconfigured state.
**/
typedef
EFI_STATUS
(EFIAPI * EFI_DNS6_CONFIGURE)(
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_CONFIG_DATA *DnsConfigData
);
/**
Host name to host address translation.
The HostNameToIp () function is used to translate the host name to host IP address. A
type A query is used to get the one or more IPv6 addresses for this host.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] Hostname Host name.
@param[in] Token Point to the completion token to translate host name
to host address.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
HostName is NULL or buffer contained unsupported characters.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_ALREADY_STARTED This Token is being used in another DNS session.
@retval EFI_NOT_STARTED This instance has not been started.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_HOST_NAME_TO_IP) (
IN EFI_DNS6_PROTOCOL *This,
IN CHAR16 *HostName,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
/**
Host address to host name translation.
The IpToHostName () function is used to translate the host address to host name. A
type PTR query is used to get the primary name of the host. Implementation can choose
to support this function or not.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] IpAddress Ip Address.
@param[in] Token Point to the completion token to translate host
address to host name.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_UNSUPPORTED This function is not supported.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
IpAddress is not valid IP address.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_NOT_STARTED This instance has not been started.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_IP_TO_HOST_NAME) (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_IPv6_ADDRESS IpAddress,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
/**
This function provides capability to retrieve arbitrary information from the DNS
server.
This GeneralLookup() function retrieves arbitrary information from the DNS. The caller
supplies a QNAME, QTYPE, and QCLASS, and all of the matching RRs are returned. All
RR content (e.g., TTL) was returned. The caller need parse the returned RR to get
required information. The function is optional. Implementation can choose to support
it or not.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] QName Pointer to Query Name.
@param[in] QType Query Type.
@param[in] QClass Query Name.
@param[in] Token Point to the completion token to retrieve arbitrary
information.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_UNSUPPORTED This function is not supported. Or the requested
QType is not supported
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token is NULL.
Token.Event is NULL.
QName is NULL.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_NOT_STARTED This instance has not been started.
@retval EFI_OUT_OF_RESOURCES Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_GENERAL_LOOKUP) (
IN EFI_DNS6_PROTOCOL *This,
IN CHAR8 *QName,
IN UINT16 QType,
IN UINT16 QClass,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
/**
This function is to update the DNS Cache.
The UpdateDnsCache() function is used to add/delete/modify DNS cache entry. DNS cache
can be normally dynamically updated after the DNS resolve succeeds. This function
provided capability to manually add/delete/modify the DNS cache.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] DeleteFlag If FALSE, this function is to add one entry to the
DNS Cahce. If TRUE, this function will delete
matching DNS Cache entry.
@param[in] Override If TRUE, the maching DNS cache entry will be
overwritten with the supplied parameter. If FALSE,
EFI_ACCESS_DENIED will be returned if the entry to
be added is already existed.
@param[in] DnsCacheEntry Pointer to DNS Cache entry.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
DnsCacheEntry.HostName is NULL.
DnsCacheEntry.IpAddress is NULL.
DnsCacheEntry.Timeout is zero.
@retval EFI_ACCESS_DENIED The DNS cache entry already exists and Override is
not TRUE.
@retval EFI_OUT_OF_RESOURCE Failed to allocate needed resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_UPDATE_DNS_CACHE) (
IN EFI_DNS6_PROTOCOL *This,
IN BOOLEAN DeleteFlag,
IN BOOLEAN Override,
IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry
);
/**
Polls for incoming data packets and processes outgoing data packets.
The Poll() function can be used by network drivers and applications to increase the
rate that data packets are moved between the communications device and the transmit
and receive queues.
In some systems, the periodic timer event in the managed network driver may not poll
the underlying communications device fast enough to transmit and/or receive all data
packets without missing incoming packets or dropping outgoing packets. Drivers and
applications that are experiencing packet loss should try calling the Poll()
function more often.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI DNS Protocol instance has not been started.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NO_MAPPING There is no source address is available for use.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive
queue. Consider increasing the polling rate.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_POLL) (
IN EFI_DNS6_PROTOCOL *This
);
/**
Abort an asynchronous DNS operation, including translation between IP and Host, and
general look up behavior.
The Cancel() function is used to abort a pending resolution request. After calling
this function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
signaled. If the token is not in one of the queues, which usually means that the
asynchronous operation has completed, this function will not signal the token and
EFI_NOT_FOUND is returned.
@param[in] This Pointer to EFI_DNS6_PROTOCOL instance.
@param[in] Token Pointer to a token that has been issued by
EFI_DNS6_PROTOCOL.HostNameToIp (),
EFI_DNS6_PROTOCOL.IpToHostName() or
EFI_DNS6_PROTOCOL.GeneralLookup().
If NULL, all pending tokens are aborted.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI DNS6 Protocol instance has not been started.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NO_MAPPING There's no source address is available for use.
@retval EFI_NOT_FOUND When Token is not NULL, and the asynchronous DNS
operation was not found in the transmit queue. It
was either completed or was not issued by
HostNameToIp(), IpToHostName() or GeneralLookup().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_DNS6_CANCEL) (
IN EFI_DNS6_PROTOCOL *This,
IN EFI_DNS6_COMPLETION_TOKEN *Token
);
///
/// The EFI_DNS6_PROTOCOL provides the function to get the host name and address
/// mapping, also provide pass through interface to retrieve arbitrary information from
/// DNSv6.
///
struct _EFI_DNS6_PROTOCOL {
EFI_DNS6_GET_MODE_DATA GetModeData;
EFI_DNS6_CONFIGURE Configure;
EFI_DNS6_HOST_NAME_TO_IP HostNameToIp;
EFI_DNS6_IP_TO_HOST_NAME IpToHostName;
EFI_DNS6_GENERAL_LOOKUP GeneralLookUp;
EFI_DNS6_UPDATE_DNS_CACHE UpdateDnsCache;
EFI_DNS6_POLL Poll;
EFI_DNS6_CANCEL Cancel;
};
extern EFI_GUID gEfiDns6ServiceBindingProtocolGuid;
extern EFI_GUID gEfiDns6ProtocolGuid;
#endif

View File

@ -0,0 +1,505 @@
/** @file
This file defines the EFI HTTP Protocol interface. It is split into
the following two main sections:
HTTP Service Binding Protocol (HTTPSB)
HTTP Protocol (HTTP)
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.5
**/
#ifndef __EFI_HTTP_PROTOCOL_H__
#define __EFI_HTTP_PROTOCOL_H__
#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \
{ \
0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \
}
#define EFI_HTTP_PROTOCOL_GUID \
{ \
0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b } \
}
typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL;
///
/// EFI_HTTP_VERSION
///
typedef enum {
HttpVersion10,
HttpVersion11,
HttpVersionUnsupported
} EFI_HTTP_VERSION;
///
/// EFI_HTTP_METHOD
///
typedef enum {
HttpMethodGet,
HttpMethodPost,
HttpMethodPatch,
HttpMethodOptions,
HttpMethodConnect,
HttpMethodHead,
HttpMethodPut,
HttpMethodDelete,
HttpMethodTrace
} EFI_HTTP_METHOD;
///
/// EFI_HTTP_STATUS_CODE
///
typedef enum {
HTTP_STATUS_UNSUPPORTED_STATUS = 0,
HTTP_STATUS_100_CONTINUE,
HTTP_STATUS_101_SWITCHING_PROTOCOLS,
HTTP_STATUS_200_OK,
HTTP_STATUS_201_CREATED,
HTTP_STATUS_202_ACCEPTED,
HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION,
HTTP_STATUS_204_NO_CONTENT,
HTTP_STATUS_205_RESET_CONTENT,
HTTP_STATUS_206_PARTIAL_CONTENT,
HTTP_STATUS_300_MULTIPLE_CHIOCES,
HTTP_STATUS_301_MOVED_PERMANENTLY,
HTTP_STATUS_302_FOUND,
HTTP_STATUS_303_SEE_OTHER,
HTTP_STATUS_304_NOT_MODIFIED,
HTTP_STATUS_305_USE_PROXY,
HTTP_STATUS_307_TEMPORARY_REDIRECT,
HTTP_STATUS_400_BAD_REQUEST,
HTTP_STATUS_401_UNAUTHORIZED,
HTTP_STATUS_402_PAYMENT_REQUIRED,
HTTP_STATUS_403_FORBIDDEN,
HTTP_STATUS_404_NOT_FOUND,
HTTP_STATUS_405_METHOD_NOT_ALLOWED,
HTTP_STATUS_406_NOT_ACCEPTABLE,
HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED,
HTTP_STATUS_408_REQUEST_TIME_OUT,
HTTP_STATUS_409_CONFLICT,
HTTP_STATUS_410_GONE,
HTTP_STATUS_411_LENGTH_REQUIRED,
HTTP_STATUS_412_PRECONDITION_FAILED,
HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE,
HTTP_STATUS_414_REQUEST_URI_TOO_LARGE,
HTTP_STATUS_415_UNSUPPORETD_MEDIA_TYPE,
HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED,
HTTP_STATUS_417_EXPECTATION_FAILED,
HTTP_STATUS_500_INTERNAL_SERVER_ERROR,
HTTP_STATUS_501_NOT_IMIPLEMENTED,
HTTP_STATUS_502_BAD_GATEWAY,
HTTP_STATUS_503_SERVICE_UNAVAILABLE,
HTTP_STATUS_504_GATEWAY_TIME_OUT,
HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED
} EFI_HTTP_STATUS_CODE;
///
/// EFI_HTTPv4_ACCESS_POINT
///
typedef struct {
///
/// Set to TRUE to instruct the EFI HTTP instance to use the default address
/// information in every TCP connection made by this instance. In addition, when set
/// to TRUE, LocalAddress, LocalSubnet, and LocalPort are ignored.
///
BOOLEAN UseDefaultAddress;
///
/// If UseDefaultAddress is set to FALSE, this defines the local IP address to be
/// used in every TCP connection opened by this instance.
///
EFI_IPv4_ADDRESS LocalAddress;
///
/// If UseDefaultAddress is set to FALSE, this defines the local subnet to be used
/// in every TCP connection opened by this instance.
///
EFI_IPv4_ADDRESS LocalSubnet;
///
/// If UseDefaultAddress is set to FALSE, this defines the local port to be used in
/// every TCP connection opened by this instance.
///
UINT16 LocalPort;
} EFI_HTTPv4_ACCESS_POINT;
///
/// EFI_HTTPv6_ACCESS_POINT
///
typedef struct {
///
/// Local IP address to be used in every TCP connection opened by this instance.
///
EFI_IPv6_ADDRESS LocalAddress;
///
/// Local port to be used in every TCP connection opened by this instance.
///
UINT16 LocalPort;
} EFI_HTTPv6_ACCESS_POINT;
///
/// EFI_HTTP_CONFIG_DATA_ACCESS_POINT
///
typedef struct {
///
/// HTTP version that this instance will support.
///
EFI_HTTP_VERSION HttpVersion;
///
/// Time out (in milliseconds) when blocking for requests.
///
UINT32 TimeOutMillisec;
///
/// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If
/// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE,
/// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL.
///
BOOLEAN LocalAddressIsIPv6;
union {
///
/// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and
/// port used by the underlying TCP protocol.
///
EFI_HTTPv4_ACCESS_POINT *IPv4Node;
///
/// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port
/// used by the underlying TCP protocol.
///
EFI_HTTPv6_ACCESS_POINT *IPv6Node;
} AccessPoint;
} EFI_HTTP_CONFIG_DATA;
///
/// EFI_HTTP_REQUEST_DATA
///
typedef struct {
///
/// The HTTP method (e.g. GET, POST) for this HTTP Request.
///
EFI_HTTP_METHOD Method;
///
/// The URI of a remote host. From the information in this field, the HTTP instance
/// will be able to determine whether to use HTTP or HTTPS and will also be able to
/// determine the port number to use. If no port number is specified, port 80 (HTTP)
/// is assumed. See RFC 3986 for more details on URI syntax.
///
CHAR16 *Url;
} EFI_HTTP_REQUEST_DATA;
///
/// EFI_HTTP_RESPONSE_DATA
///
typedef struct {
///
/// Response status code returned by the remote host.
///
EFI_HTTP_STATUS_CODE StatusCode;
} EFI_HTTP_RESPONSE_DATA;
///
/// EFI_HTTP_HEADER
///
typedef struct {
///
/// Null terminated string which describes a field name. See RFC 2616 Section 14 for
/// detailed information about field names.
///
CHAR8 *FieldName;
///
/// Null terminated string which describes the corresponding field value. See RFC 2616
/// Section 14 for detailed information about field values.
///
CHAR8 *FieldValue;
} EFI_HTTP_HEADER;
///
/// EFI_HTTP_MESSAGE
///
typedef struct {
///
/// HTTP message data.
///
union {
///
/// When the token is used to send a HTTP request, Request is a pointer to storage that
/// contains such data as URL and HTTP method.
///
EFI_HTTP_REQUEST_DATA *Request;
///
/// When used to await a response, Response points to storage containing HTTP response
/// status code.
///
EFI_HTTP_RESPONSE_DATA *Response;
} Data;
///
/// Number of HTTP header structures in Headers list. On request, this count is
/// provided by the caller. On response, this count is provided by the HTTP driver.
///
UINTN HeaderCount;
///
/// Array containing list of HTTP headers. On request, this array is populated by the
/// caller. On response, this array is allocated and populated by the HTTP driver. It
/// is the responsibility of the caller to free this memory on both request and
/// response.
///
EFI_HTTP_HEADER *Headers;
///
/// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type.
///
UINTN BodyLength;
///
/// Body associated with the HTTP request or response. This can be NULL depending on
/// the HttpMethod type.
///
VOID *Body;
} EFI_HTTP_MESSAGE;
///
/// EFI_HTTP_TOKEN
///
typedef struct {
///
/// This Event will be signaled after the Status field is updated by the EFI HTTP
/// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority
/// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK.
///
EFI_EVENT Event;
///
/// Status will be set to one of the following value if the HTTP request is
/// successfully sent or if an unexpected error occurs:
/// EFI_SUCCESS: The HTTP request was successfully sent to the remote host.
/// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from
/// the transmit queue.
/// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host.
/// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
///
EFI_STATUS Status;
///
/// Pointer to storage containing HTTP message data.
///
EFI_HTTP_MESSAGE *Message;
} EFI_HTTP_TOKEN;
/**
Returns the operational parameters for the current HTTP child instance.
The GetModeData() function is used to read the current mode data (operational
parameters) for this HTTP protocol instance.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[out] HttpConfigData Point to buffer for operational parameters of this
HTTP instance.
@retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER This is NULL.
**/
typedef
EFI_STATUS
(EFIAPI * EFI_HTTP_GET_MODE_DATA)(
IN EFI_HTTP_PROTOCOL *This,
OUT EFI_HTTP_CONFIG_DATA *HttpConfigData
);
/**
Initialize or brutally reset the operational parameters for this EFI HTTP instance.
The Configure() function does the following:
When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring
timeout, local address, port, etc.
When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active
connections with remote hosts, canceling all asynchronous tokens, and flush request
and response buffers without informing the appropriate hosts.
Except for GetModeData() and Configure(), No other EFI HTTP function can be executed
by this instance until the Configure() function is executed and returns successfully.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] HttpConfigData Pointer to the configure data to configure the instance.
@retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
HttpConfigData->LocalAddressIsIPv6 is FALSE and
HttpConfigData->IPv4Node is NULL.
HttpConfigData->LocalAddressIsIPv6 is TRUE and
HttpConfigData->IPv6Node is NULL.
@retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling
Configure() with NULL to reset it.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
executing Configure().
@retval EFI_UNSUPPORTED One or more options in ConfigData are not supported
in the implementation.
**/
typedef
EFI_STATUS
(EFIAPI * EFI_HTTP_CONFIGURE)(
IN EFI_HTTP_PROTOCOL *This,
IN EFI_HTTP_CONFIG_DATA *HttpConfigData
);
/**
The Request() function queues an HTTP request to this HTTP instance,
similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent
successfully, or if there is an error, Status in token will be updated and Event will
be signaled.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] Token Pointer to storage containing HTTP request token.
@retval EFI_SUCCESS Outgoing data was processed.
@retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token->Message is NULL.
Token->Message->Body is not NULL,
Token->Message->BodyLength is non-zero, and
Token->Message->Data is NULL, but a previous call to
Request()has not been completed successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HTTP_REQUEST) (
IN EFI_HTTP_PROTOCOL *This,
IN EFI_HTTP_TOKEN *Token
);
/**
Abort an asynchronous HTTP request or response token.
The Cancel() function aborts a pending HTTP request or response transaction. If
Token is not NULL and the token is in transmit or receive queues when it is being
cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will
be signaled. If the token is not in one of the queues, which usually means that the
asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL,
all asynchronous tokens issued by Request() or Response() will be aborted.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] Token Point to storage containing HTTP request or response
token.
@retval EFI_SUCCESS Request and Response queues are successfully flushed.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_STARTED This instance hasn't been configured.
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP,
BOOTP, RARP, etc.) hasn't finished yet.
@retval EFI_NOT_FOUND The asynchronous request or response token is not
found.
@retval EFI_UNSUPPORTED The implementation does not support this function.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HTTP_CANCEL)(
IN EFI_HTTP_PROTOCOL *This,
IN EFI_HTTP_TOKEN *Token
);
/**
The Response() function queues an HTTP response to this HTTP instance, similar to
Receive() function in the EFI TCP driver. When the HTTP request is sent successfully,
or if there is an error, Status in token will be updated and Event will be signaled.
The HTTP driver will queue a receive token to the underlying TCP instance. When data
is received in the underlying TCP instance, the data will be parsed and Token will
be populated with the response data. If the data received from the remote host
contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting
(asynchronously) for more data to be sent from the remote host before signaling
Event in Token.
It is the responsibility of the caller to allocate a buffer for Body and specify the
size in BodyLength. If the remote host provides a response that contains a content
body, up to BodyLength bytes will be copied from the receive buffer into Body and
BodyLength will be updated with the amount of bytes received and copied to Body. This
allows the client to download a large file in chunks instead of into one contiguous
block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is
non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive
token to underlying TCP instance. If data arrives in the receive buffer, up to
BodyLength bytes of data will be copied to Body. The HTTP driver will then update
BodyLength with the amount of bytes received and copied to Body.
If the HTTP driver does not have an open underlying TCP connection with the host
specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is
consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain
an open TCP connection between client and host.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] Token Pointer to storage containing HTTP response token.
@retval EFI_SUCCESS Allocation succeeded.
@retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been
initialized.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
Token->Message->Headers is NULL.
Token->Message is NULL.
Token->Message->Body is not NULL,
Token->Message->BodyLength is non-zero, and
Token->Message->Data is NULL, but a previous call to
Response() has not been completed successfully.
@retval EFI_ACCESS_DENIED An open TCP connection is not present with the host
specified by response URL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HTTP_RESPONSE) (
IN EFI_HTTP_PROTOCOL *This,
IN EFI_HTTP_TOKEN *Token
);
/**
The Poll() function can be used by network drivers and applications to increase the
rate that data packets are moved between the communication devices and the transmit
and receive queues.
In some systems, the periodic timer event in the managed network driver may not poll
the underlying communications device fast enough to transmit and/or receive all data
packets without missing incoming packets or dropping outgoing packets. Drivers and
applications that are experiencing packet loss should try calling the Poll() function
more often.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@retval EFI_SUCCESS Incoming or outgoing data was processed..
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_READY No incoming or outgoing data is processed.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HTTP_POLL) (
IN EFI_HTTP_PROTOCOL *This
);
///
/// The EFI HTTP protocol is designed to be used by EFI drivers and applications to
/// create and transmit HTTP Requests, as well as handle HTTP responses that are
/// returned by a remote host. This EFI protocol uses and relies on an underlying EFI
/// TCP protocol.
///
struct _EFI_HTTP_PROTOCOL {
EFI_HTTP_GET_MODE_DATA GetModeData;
EFI_HTTP_CONFIGURE Configure;
EFI_HTTP_REQUEST Request;
EFI_HTTP_CANCEL Cancel;
EFI_HTTP_RESPONSE Response;
EFI_HTTP_POLL Poll;
};
extern EFI_GUID gEfiHttpServiceBindingProtocolGuid;
extern EFI_GUID gEfiHttpProtocolGuid;
#endif

View File

@ -0,0 +1,313 @@
/** @file
This file provides a definition of the EFI IPv4 Configuration II
Protocol.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at<BR>
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.5
**/
#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__
#define __EFI_IP4CONFIG2_PROTOCOL_H__
#include <Protocol/Ip4.h>
#define EFI_IP4_CONFIG2_PROTOCOL_GUID \
{ \
0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
}
typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL;
///
/// EFI_IP4_CONFIG2_DATA_TYPE
///
typedef enum {
///
/// The interface information of the communication device this EFI
/// IPv4 Configuration II Protocol instance manages. This type of
/// data is read only. The corresponding Data is of type
/// EFI_IP4_CONFIG2_INTERFACE_INFO.
///
Ip4Config2DataTypeInterfaceInfo,
///
/// The general configuration policy for the EFI IPv4 network stack
/// running on the communication device this EFI IPv4
/// Configuration II Protocol instance manages. The policy will
/// affect other configuration settings. The corresponding Data is of
/// type EFI_IP4_CONFIG2_POLICY.
///
Ip4Config2DataTypePolicy,
///
/// The station addresses set manually for the EFI IPv4 network
/// stack. It is only configurable when the policy is
/// Ip4Config2PolicyStatic. The corresponding Data is of
/// type EFI_IP4_CONFIG2_MANUAL_ADDRESS.
///
Ip4Config2DataTypeManualAddress,
///
/// The gateway addresses set manually for the EFI IPv4 network
/// stack running on the communication device this EFI IPv4
/// Configuration II Protocol manages. It is not configurable when
/// the policy is Ip4Config2PolicyDhcp. The gateway
/// addresses must be unicast IPv4 addresses. The corresponding
/// Data is a pointer to an array of EFI_IPv4_ADDRESS instances.
///
Ip4Config2DataTypeGateway,
///
/// The DNS server list for the EFI IPv4 network stack running on
/// the communication device this EFI IPv4 Configuration II
/// Protocol manages. It is not configurable when the policy is
/// Ip4Config2PolicyDhcp. The DNS server addresses must be
/// unicast IPv4 addresses. The corresponding Data is a pointer to
/// an array of EFI_IPv4_ADDRESS instances.
///
Ip4Config2DataTypeDnsServer,
Ip4Config2DataTypeMaximum
} EFI_IP4_CONFIG2_DATA_TYPE;
///
/// EFI_IP4_CONFIG2_INTERFACE_INFO
///
typedef struct {
///
/// The name of the interface. It is a NULL-terminated Unicode string.
///
CHAR16 Name[32];
///
/// The interface type of the network interface. See RFC 1700,
/// section "Number Hardware Type".
///
UINT8 IfType;
///
/// The size, in bytes, of the network interface's hardware address.
///
UINT32 HwAddressSize;
///
/// The hardware address for the network interface.
///
EFI_MAC_ADDRESS HwAddress;
///
/// The station IPv4 address of this EFI IPv4 network stack.
///
EFI_IPv4_ADDRESS StationAddress;
///
/// The subnet address mask that is associated with the station address.
///
EFI_IPv4_ADDRESS SubnetMask;
///
/// Size of the following RouteTable, in bytes. May be zero.
///
UINT32 RouteTableSize;
///
/// The route table of the IPv4 network stack runs on this interface.
/// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in
/// EFI_IP4_PROTOCOL.GetModeData().
///
EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL;
} EFI_IP4_CONFIG2_INTERFACE_INFO;
///
/// EFI_IP4_CONFIG2_POLICY
///
typedef enum {
///
/// Under this policy, the Ip4Config2DataTypeManualAddress,
/// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration
/// data are required to be set manually. The EFI IPv4 Protocol will get all
/// required configuration such as IPv4 address, subnet mask and
/// gateway settings from the EFI IPv4 Configuration II protocol.
///
Ip4Config2PolicyStatic,
///
/// Under this policy, the Ip4Config2DataTypeManualAddress,
/// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are
/// not allowed to set via SetData(). All of these configurations are retrieved from DHCP
/// server or other auto-configuration mechanism.
///
Ip4Config2PolicyDhcp,
Ip4Config2PolicyMax
} EFI_IP4_CONFIG2_POLICY;
///
/// EFI_IP4_CONFIG2_MANUAL_ADDRESS
///
typedef struct {
///
/// The IPv4 unicast address.
///
EFI_IPv4_ADDRESS Address;
///
/// The subnet mask.
///
EFI_IPv4_ADDRESS SubnetMask;
} EFI_IP4_CONFIG2_MANUAL_ADDRESS;
/**
Set the configuration for the EFI IPv4 network stack running on the communication device this EFI
IPv4 Configuration II Protocol instance manages.
This function is used to set the configuration data of type DataType for the EFI IPv4 network stack
running on the communication device this EFI IPv4 Configuration II Protocol instance manages.
The successfully configured data is valid after system reset or power-off.
The DataSize is used to calculate the count of structure instances in the Data for some
DataType that multiple structure instances are allowed.
This function is always non-blocking. When setting some typeof configuration data, an
asynchronous process is invoked to check the correctness of the data, such as doing address conflict
detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to
indicate that such an asynchronous process is invoked and the process is not finished yet. The caller
willing to get the result of the asynchronous process is required to call RegisterDataNotify()
to register an event on the specified configuration data. Once the event is signaled, the caller can call
GetData()to get back the configuration data in order to know the result. For other types of
configuration data that do not require an asynchronous configuration process, the result of the
operation is immediately returned.
@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.
@param[in] DataType The type of data to set.
@param[in] DataSize Size of the buffer pointed to by Data in bytes.
@param[in] Data The data buffer to set. The type ofthe data buffer is associated
with the DataType.
@retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set
successfully.
@retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
This is NULL.
Data is NULL.
One or more fields in Data do not match the requirement of the data type
indicated by DataType.
@retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration
data can not be set under the current policy.
@retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process.
@retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and
the process is not finished yet.
@retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType.
@retval EFI_UNSUPPORTED This DataType is not supported.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CONFIG2_SET_DATA) (
IN EFI_IP4_CONFIG2_PROTOCOL *This,
IN EFI_IP4_CONFIG2_DATA_TYPE DataType,
IN UINTN DataSize,
IN VOID *Data
);
/**
Get the configuration data for the EFI IPv4 network stack running on the communication device this
EFI IPv4 Configuration II Protocol instance manages.
This function returns the configuration data of type DataType for the EFI IPv4 network stack
running on the communication device this EFI IPv4 Configuration II Protocol instance manages.
The caller is responsible for allocating the buffer usedto return the specified configuration data and
the required size will be returned to the caller if the size of the buffer is too small.
EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in
progress asynchronous configuration process. The caller can call RegisterDataNotify() to
register an event on the specified configuration data. Once the asynchronous configuration process is
finished, the event will be signaled and a subsequent GetData() call will return the specified
configuration data.
@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.
@param[in] DataType The type of data to get.
@param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size
of buffer required to store the specified configuration data.
@param[in] Data The data buffer in which the configuration data is returned. The
type of the data buffer is associated with the DataType. Ignored
if DataSize is 0.
@retval EFI_SUCCESS The specified configuration data is got successfully.
@retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
This is NULL.
DataSize is NULL.
Data is NULL if *DataSizeis not zero.
@retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data
and the required size is returned in DataSize.
@retval EFI_NOT_READY The specified configuration data is not ready due to an already in
progress asynchronous configuration process.
@retval EFI_NOT_FOUND The specified configuration data is not found.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CONFIG2_GET_DATA) (
IN EFI_IP4_CONFIG2_PROTOCOL *This,
IN EFI_IP4_CONFIG2_DATA_TYPE DataType,
IN OUT UINTN *DataSize,
IN VOID *Data OPTIONAL
);
/**
Register an event that is to be signaled whenever a configuration process on the specified
configuration data is done.
This function registers an event that is to be signaled whenever a configuration process on the
specified configuration data is done. An event can be registered for different DataType
simultaneously and the caller is responsible for determining which type of configuration data causes
the signaling of the event in such case.
@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.
@param[in] DataType The type of data to unregister the event for.
@param[in] Event The event to register.
@retval EFI_SUCCESS The notification event for the specified configuration data is
registered.
@retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
@retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_ACCESS_DENIED The Event is already registered for the DataType.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY) (
IN EFI_IP4_CONFIG2_PROTOCOL *This,
IN EFI_IP4_CONFIG2_DATA_TYPE DataType,
IN EFI_EVENT Event
);
/**
Remove a previously registered event for the specified configuration data.
This function removes a previously registeredevent for the specified configuration data.
@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.
@param[in] DataType The type of data to remove the previously registered event for.
@param[in] Event The event to unregister.
@retval EFI_SUCCESS The event registered for the specified configuration data is removed.
@retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
@retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY) (
IN EFI_IP4_CONFIG2_PROTOCOL *This,
IN EFI_IP4_CONFIG2_DATA_TYPE DataType,
IN EFI_EVENT Event
);
///
/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common
/// configurations and the administrator configurable settings for the EFI IPv4 network stack.
/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that
/// the EFI IPv4 network stack runs on.
///
struct _EFI_IP4_CONFIG2_PROTOCOL {
EFI_IP4_CONFIG2_SET_DATA SetData;
EFI_IP4_CONFIG2_GET_DATA GetData;
EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify;
EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify;
};
extern EFI_GUID gEfiIp4Config2ProtocolGuid;
#endif

View File

@ -1536,6 +1536,27 @@
## Include/Protocol/Pkcs7Verify.h
gEfiPkcs7VerifyProtocolGuid = { 0x47889fb2, 0xd671, 0x4fab, { 0xa0, 0xca, 0xdf, 0x0e, 0x44, 0xdf, 0x70, 0xd6 }}
## Include/Protocol/Ip4Config2.h
gEfiIp4Config2ProtocolGuid = { 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 }}
## Include/Protocol/Dns4.h
gEfiDns4ServiceBindingProtocolGuid = { 0xb625b186, 0xe063, 0x44f7, { 0x89, 0x5, 0x6a, 0x74, 0xdc, 0x6f, 0x52, 0xb4 }}
## Include/Protocol/Dns4.h
gEfiDns4ProtocolGuid = { 0xae3d28cc, 0xe05b, 0x4fa1, { 0xa0, 0x11, 0x7e, 0xb5, 0x5a, 0x3f, 0x14, 0x1 }}
## Include/Protocol/Dns6.h
gEfiDns6ServiceBindingProtocolGuid = { 0x7f1647c8, 0xb76e, 0x44b2, { 0xa5, 0x65, 0xf7, 0xf, 0xf1, 0x9c, 0xd1, 0x9e }}
## Include/Protocol/Dns6.h
gEfiDns6ProtocolGuid = { 0xca37bc1f, 0xa327, 0x4ae9, { 0x82, 0x8a, 0x8c, 0x40, 0xd8, 0x50, 0x6a, 0x17 }}
## Include/Protocol/Http.h
gEfiHttpServiceBindingProtocolGuid = { 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c }}
## Include/Protocol/Http.h
gEfiHttpProtocolGuid = { 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b }}
#
# [Error.gEfiMdePkgTokenSpaceGuid]