Path: blob/main/sys/contrib/edk2/Include/Protocol/Ip4Config2.h
96339 views
/** @file1This file provides a definition of the EFI IPv4 Configuration II2Protocol.34Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>5SPDX-License-Identifier: BSD-2-Clause-Patent67@par Revision Reference:8This Protocol is introduced in UEFI Specification 2.5910**/1112#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__13#define __EFI_IP4CONFIG2_PROTOCOL_H__1415#include <Protocol/Ip4.h>1617#define EFI_IP4_CONFIG2_PROTOCOL_GUID \18{ \190x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \20}2122typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL;2324///25/// EFI_IP4_CONFIG2_DATA_TYPE26///27typedef enum {28///29/// The interface information of the communication device this EFI30/// IPv4 Configuration II Protocol instance manages. This type of31/// data is read only. The corresponding Data is of type32/// EFI_IP4_CONFIG2_INTERFACE_INFO.33///34Ip4Config2DataTypeInterfaceInfo,35///36/// The general configuration policy for the EFI IPv4 network stack37/// running on the communication device this EFI IPv438/// Configuration II Protocol instance manages. The policy will39/// affect other configuration settings. The corresponding Data is of40/// type EFI_IP4_CONFIG2_POLICY.41///42Ip4Config2DataTypePolicy,43///44/// The station addresses set manually for the EFI IPv4 network45/// stack. It is only configurable when the policy is46/// Ip4Config2PolicyStatic. The corresponding Data is of47/// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize48/// is 0 and Data is NULL, the existing configuration is cleared49/// from the EFI IPv4 Configuration II Protocol instance.50///51Ip4Config2DataTypeManualAddress,52///53/// The gateway addresses set manually for the EFI IPv4 network54/// stack running on the communication device this EFI IPv455/// Configuration II Protocol manages. It is not configurable when56/// the policy is Ip4Config2PolicyDhcp. The gateway57/// addresses must be unicast IPv4 addresses. The corresponding58/// Data is a pointer to an array of EFI_IPv4_ADDRESS instances.59/// When DataSize is 0 and Data is NULL, the existing configuration60/// is cleared from the EFI IPv4 Configuration II Protocol instance.61///62Ip4Config2DataTypeGateway,63///64/// The DNS server list for the EFI IPv4 network stack running on65/// the communication device this EFI IPv4 Configuration II66/// Protocol manages. It is not configurable when the policy is67/// Ip4Config2PolicyDhcp. The DNS server addresses must be68/// unicast IPv4 addresses. The corresponding Data is a pointer to69/// an array of EFI_IPv4_ADDRESS instances. When DataSize70/// is 0 and Data is NULL, the existing configuration is cleared71/// from the EFI IPv4 Configuration II Protocol instance.72///73Ip4Config2DataTypeDnsServer,74Ip4Config2DataTypeMaximum75} EFI_IP4_CONFIG2_DATA_TYPE;7677///78/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions79///80#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 328182///83/// EFI_IP4_CONFIG2_INTERFACE_INFO84///85typedef struct {86///87/// The name of the interface. It is a NULL-terminated Unicode string.88///89CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE];90///91/// The interface type of the network interface. See RFC 1700,92/// section "Number Hardware Type".93///94UINT8 IfType;95///96/// The size, in bytes, of the network interface's hardware address.97///98UINT32 HwAddressSize;99///100/// The hardware address for the network interface.101///102EFI_MAC_ADDRESS HwAddress;103///104/// The station IPv4 address of this EFI IPv4 network stack.105///106EFI_IPv4_ADDRESS StationAddress;107///108/// The subnet address mask that is associated with the station address.109///110EFI_IPv4_ADDRESS SubnetMask;111///112/// Size of the following RouteTable, in bytes. May be zero.113///114UINT32 RouteTableSize;115///116/// The route table of the IPv4 network stack runs on this interface.117/// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in118/// EFI_IP4_PROTOCOL.GetModeData().119///120EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL;121} EFI_IP4_CONFIG2_INTERFACE_INFO;122123///124/// EFI_IP4_CONFIG2_POLICY125///126typedef enum {127///128/// Under this policy, the Ip4Config2DataTypeManualAddress,129/// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration130/// data are required to be set manually. The EFI IPv4 Protocol will get all131/// required configuration such as IPv4 address, subnet mask and132/// gateway settings from the EFI IPv4 Configuration II protocol.133///134Ip4Config2PolicyStatic,135///136/// Under this policy, the Ip4Config2DataTypeManualAddress,137/// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are138/// not allowed to set via SetData(). All of these configurations are retrieved from DHCP139/// server or other auto-configuration mechanism.140///141Ip4Config2PolicyDhcp,142Ip4Config2PolicyMax143} EFI_IP4_CONFIG2_POLICY;144145///146/// EFI_IP4_CONFIG2_MANUAL_ADDRESS147///148typedef struct {149///150/// The IPv4 unicast address.151///152EFI_IPv4_ADDRESS Address;153///154/// The subnet mask.155///156EFI_IPv4_ADDRESS SubnetMask;157} EFI_IP4_CONFIG2_MANUAL_ADDRESS;158159/**160Set the configuration for the EFI IPv4 network stack running on the communication device this EFI161IPv4 Configuration II Protocol instance manages.162163This function is used to set the configuration data of type DataType for the EFI IPv4 network stack164running on the communication device this EFI IPv4 Configuration II Protocol instance manages.165The successfully configured data is valid after system reset or power-off.166The DataSize is used to calculate the count of structure instances in the Data for some167DataType that multiple structure instances are allowed.168This function is always non-blocking. When setting some typeof configuration data, an169asynchronous process is invoked to check the correctness of the data, such as doing address conflict170detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to171indicate that such an asynchronous process is invoked and the process is not finished yet. The caller172willing to get the result of the asynchronous process is required to call RegisterDataNotify()173to register an event on the specified configuration data. Once the event is signaled, the caller can call174GetData()to get back the configuration data in order to know the result. For other types of175configuration data that do not require an asynchronous configuration process, the result of the176operation is immediately returned.177178@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.179@param[in] DataType The type of data to set.180@param[in] DataSize Size of the buffer pointed to by Data in bytes.181@param[in] Data The data buffer to set. The type ofthe data buffer is associated182with the DataType.183184@retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set185successfully.186@retval EFI_INVALID_PARAMETER One or more of the following are TRUE:187This is NULL.188One or more fields in Data and DataSize do not match the189requirement of the data type indicated by DataType.190@retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration191data can not be set under the current policy.192@retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process.193@retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and194the process is not finished yet.195@retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType.196@retval EFI_UNSUPPORTED This DataType is not supported.197@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.198@retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.199**/200typedef201EFI_STATUS202(EFIAPI *EFI_IP4_CONFIG2_SET_DATA)(203IN EFI_IP4_CONFIG2_PROTOCOL *This,204IN EFI_IP4_CONFIG2_DATA_TYPE DataType,205IN UINTN DataSize,206IN VOID *Data207);208209/**210Get the configuration data for the EFI IPv4 network stack running on the communication device this211EFI IPv4 Configuration II Protocol instance manages.212213This function returns the configuration data of type DataType for the EFI IPv4 network stack214running on the communication device this EFI IPv4 Configuration II Protocol instance manages.215The caller is responsible for allocating the buffer usedto return the specified configuration data and216the required size will be returned to the caller if the size of the buffer is too small.217EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in218progress asynchronous configuration process. The caller can call RegisterDataNotify() to219register an event on the specified configuration data. Once the asynchronous configuration process is220finished, the event will be signaled and a subsequent GetData() call will return the specified221configuration data.222223@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.224@param[in] DataType The type of data to get.225@param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size226of buffer required to store the specified configuration data.227@param[in] Data The data buffer in which the configuration data is returned. The228type of the data buffer is associated with the DataType. Ignored229if DataSize is 0.230231@retval EFI_SUCCESS The specified configuration data is got successfully.232@retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:233This is NULL.234DataSize is NULL.235Data is NULL if *DataSizeis not zero.236@retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data237and the required size is returned in DataSize.238@retval EFI_NOT_READY The specified configuration data is not ready due to an already in239progress asynchronous configuration process.240@retval EFI_NOT_FOUND The specified configuration data is not found.241**/242typedef243EFI_STATUS244(EFIAPI *EFI_IP4_CONFIG2_GET_DATA)(245IN EFI_IP4_CONFIG2_PROTOCOL *This,246IN EFI_IP4_CONFIG2_DATA_TYPE DataType,247IN OUT UINTN *DataSize,248IN VOID *Data OPTIONAL249);250251/**252Register an event that is to be signaled whenever a configuration process on the specified253configuration data is done.254255This function registers an event that is to be signaled whenever a configuration process on the256specified configuration data is done. An event can be registered for different DataType257simultaneously and the caller is responsible for determining which type of configuration data causes258the signaling of the event in such case.259260@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.261@param[in] DataType The type of data to unregister the event for.262@param[in] Event The event to register.263264@retval EFI_SUCCESS The notification event for the specified configuration data is265registered.266@retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.267@retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported.268@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.269@retval EFI_ACCESS_DENIED The Event is already registered for the DataType.270**/271typedef272EFI_STATUS273(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY)(274IN EFI_IP4_CONFIG2_PROTOCOL *This,275IN EFI_IP4_CONFIG2_DATA_TYPE DataType,276IN EFI_EVENT Event277);278279/**280Remove a previously registered event for the specified configuration data.281282This function removes a previously registeredevent for the specified configuration data.283284@param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.285@param[in] DataType The type of data to remove the previously registered event for.286@param[in] Event The event to unregister.287288@retval EFI_SUCCESS The event registered for the specified configuration data is removed.289@retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.290@retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType.291**/292typedef293EFI_STATUS294(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY)(295IN EFI_IP4_CONFIG2_PROTOCOL *This,296IN EFI_IP4_CONFIG2_DATA_TYPE DataType,297IN EFI_EVENT Event298);299300///301/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common302/// configurations and the administrator configurable settings for the EFI IPv4 network stack.303/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that304/// the EFI IPv4 network stack runs on.305///306struct _EFI_IP4_CONFIG2_PROTOCOL {307EFI_IP4_CONFIG2_SET_DATA SetData;308EFI_IP4_CONFIG2_GET_DATA GetData;309EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify;310EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify;311};312313extern EFI_GUID gEfiIp4Config2ProtocolGuid;314315#endif316317318