1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh This file provides a definition of the EFI IPv4 Configuration II 3*f439973dSWarner Losh Protocol. 4*f439973dSWarner Losh 5*f439973dSWarner Losh Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> 6*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 7*f439973dSWarner Losh 8*f439973dSWarner Losh @par Revision Reference: 9*f439973dSWarner Losh This Protocol is introduced in UEFI Specification 2.5 10*f439973dSWarner Losh 11*f439973dSWarner Losh **/ 12*f439973dSWarner Losh 13*f439973dSWarner Losh #ifndef __EFI_IP4CONFIG2_PROTOCOL_H__ 14*f439973dSWarner Losh #define __EFI_IP4CONFIG2_PROTOCOL_H__ 15*f439973dSWarner Losh 16*f439973dSWarner Losh #include <Protocol/Ip4.h> 17*f439973dSWarner Losh 18*f439973dSWarner Losh #define EFI_IP4_CONFIG2_PROTOCOL_GUID \ 19*f439973dSWarner Losh { \ 20*f439973dSWarner Losh 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ 21*f439973dSWarner Losh } 22*f439973dSWarner Losh 23*f439973dSWarner Losh typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL; 24*f439973dSWarner Losh 25*f439973dSWarner Losh /// 26*f439973dSWarner Losh /// EFI_IP4_CONFIG2_DATA_TYPE 27*f439973dSWarner Losh /// 28*f439973dSWarner Losh typedef enum { 29*f439973dSWarner Losh /// 30*f439973dSWarner Losh /// The interface information of the communication device this EFI 31*f439973dSWarner Losh /// IPv4 Configuration II Protocol instance manages. This type of 32*f439973dSWarner Losh /// data is read only. The corresponding Data is of type 33*f439973dSWarner Losh /// EFI_IP4_CONFIG2_INTERFACE_INFO. 34*f439973dSWarner Losh /// 35*f439973dSWarner Losh Ip4Config2DataTypeInterfaceInfo, 36*f439973dSWarner Losh /// 37*f439973dSWarner Losh /// The general configuration policy for the EFI IPv4 network stack 38*f439973dSWarner Losh /// running on the communication device this EFI IPv4 39*f439973dSWarner Losh /// Configuration II Protocol instance manages. The policy will 40*f439973dSWarner Losh /// affect other configuration settings. The corresponding Data is of 41*f439973dSWarner Losh /// type EFI_IP4_CONFIG2_POLICY. 42*f439973dSWarner Losh /// 43*f439973dSWarner Losh Ip4Config2DataTypePolicy, 44*f439973dSWarner Losh /// 45*f439973dSWarner Losh /// The station addresses set manually for the EFI IPv4 network 46*f439973dSWarner Losh /// stack. It is only configurable when the policy is 47*f439973dSWarner Losh /// Ip4Config2PolicyStatic. The corresponding Data is of 48*f439973dSWarner Losh /// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize 49*f439973dSWarner Losh /// is 0 and Data is NULL, the existing configuration is cleared 50*f439973dSWarner Losh /// from the EFI IPv4 Configuration II Protocol instance. 51*f439973dSWarner Losh /// 52*f439973dSWarner Losh Ip4Config2DataTypeManualAddress, 53*f439973dSWarner Losh /// 54*f439973dSWarner Losh /// The gateway addresses set manually for the EFI IPv4 network 55*f439973dSWarner Losh /// stack running on the communication device this EFI IPv4 56*f439973dSWarner Losh /// Configuration II Protocol manages. It is not configurable when 57*f439973dSWarner Losh /// the policy is Ip4Config2PolicyDhcp. The gateway 58*f439973dSWarner Losh /// addresses must be unicast IPv4 addresses. The corresponding 59*f439973dSWarner Losh /// Data is a pointer to an array of EFI_IPv4_ADDRESS instances. 60*f439973dSWarner Losh /// When DataSize is 0 and Data is NULL, the existing configuration 61*f439973dSWarner Losh /// is cleared from the EFI IPv4 Configuration II Protocol instance. 62*f439973dSWarner Losh /// 63*f439973dSWarner Losh Ip4Config2DataTypeGateway, 64*f439973dSWarner Losh /// 65*f439973dSWarner Losh /// The DNS server list for the EFI IPv4 network stack running on 66*f439973dSWarner Losh /// the communication device this EFI IPv4 Configuration II 67*f439973dSWarner Losh /// Protocol manages. It is not configurable when the policy is 68*f439973dSWarner Losh /// Ip4Config2PolicyDhcp. The DNS server addresses must be 69*f439973dSWarner Losh /// unicast IPv4 addresses. The corresponding Data is a pointer to 70*f439973dSWarner Losh /// an array of EFI_IPv4_ADDRESS instances. When DataSize 71*f439973dSWarner Losh /// is 0 and Data is NULL, the existing configuration is cleared 72*f439973dSWarner Losh /// from the EFI IPv4 Configuration II Protocol instance. 73*f439973dSWarner Losh /// 74*f439973dSWarner Losh Ip4Config2DataTypeDnsServer, 75*f439973dSWarner Losh Ip4Config2DataTypeMaximum 76*f439973dSWarner Losh } EFI_IP4_CONFIG2_DATA_TYPE; 77*f439973dSWarner Losh 78*f439973dSWarner Losh /// 79*f439973dSWarner Losh /// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions 80*f439973dSWarner Losh /// 81*f439973dSWarner Losh #define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32 82*f439973dSWarner Losh 83*f439973dSWarner Losh /// 84*f439973dSWarner Losh /// EFI_IP4_CONFIG2_INTERFACE_INFO 85*f439973dSWarner Losh /// 86*f439973dSWarner Losh typedef struct { 87*f439973dSWarner Losh /// 88*f439973dSWarner Losh /// The name of the interface. It is a NULL-terminated Unicode string. 89*f439973dSWarner Losh /// 90*f439973dSWarner Losh CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]; 91*f439973dSWarner Losh /// 92*f439973dSWarner Losh /// The interface type of the network interface. See RFC 1700, 93*f439973dSWarner Losh /// section "Number Hardware Type". 94*f439973dSWarner Losh /// 95*f439973dSWarner Losh UINT8 IfType; 96*f439973dSWarner Losh /// 97*f439973dSWarner Losh /// The size, in bytes, of the network interface's hardware address. 98*f439973dSWarner Losh /// 99*f439973dSWarner Losh UINT32 HwAddressSize; 100*f439973dSWarner Losh /// 101*f439973dSWarner Losh /// The hardware address for the network interface. 102*f439973dSWarner Losh /// 103*f439973dSWarner Losh EFI_MAC_ADDRESS HwAddress; 104*f439973dSWarner Losh /// 105*f439973dSWarner Losh /// The station IPv4 address of this EFI IPv4 network stack. 106*f439973dSWarner Losh /// 107*f439973dSWarner Losh EFI_IPv4_ADDRESS StationAddress; 108*f439973dSWarner Losh /// 109*f439973dSWarner Losh /// The subnet address mask that is associated with the station address. 110*f439973dSWarner Losh /// 111*f439973dSWarner Losh EFI_IPv4_ADDRESS SubnetMask; 112*f439973dSWarner Losh /// 113*f439973dSWarner Losh /// Size of the following RouteTable, in bytes. May be zero. 114*f439973dSWarner Losh /// 115*f439973dSWarner Losh UINT32 RouteTableSize; 116*f439973dSWarner Losh /// 117*f439973dSWarner Losh /// The route table of the IPv4 network stack runs on this interface. 118*f439973dSWarner Losh /// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in 119*f439973dSWarner Losh /// EFI_IP4_PROTOCOL.GetModeData(). 120*f439973dSWarner Losh /// 121*f439973dSWarner Losh EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL; 122*f439973dSWarner Losh } EFI_IP4_CONFIG2_INTERFACE_INFO; 123*f439973dSWarner Losh 124*f439973dSWarner Losh /// 125*f439973dSWarner Losh /// EFI_IP4_CONFIG2_POLICY 126*f439973dSWarner Losh /// 127*f439973dSWarner Losh typedef enum { 128*f439973dSWarner Losh /// 129*f439973dSWarner Losh /// Under this policy, the Ip4Config2DataTypeManualAddress, 130*f439973dSWarner Losh /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration 131*f439973dSWarner Losh /// data are required to be set manually. The EFI IPv4 Protocol will get all 132*f439973dSWarner Losh /// required configuration such as IPv4 address, subnet mask and 133*f439973dSWarner Losh /// gateway settings from the EFI IPv4 Configuration II protocol. 134*f439973dSWarner Losh /// 135*f439973dSWarner Losh Ip4Config2PolicyStatic, 136*f439973dSWarner Losh /// 137*f439973dSWarner Losh /// Under this policy, the Ip4Config2DataTypeManualAddress, 138*f439973dSWarner Losh /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are 139*f439973dSWarner Losh /// not allowed to set via SetData(). All of these configurations are retrieved from DHCP 140*f439973dSWarner Losh /// server or other auto-configuration mechanism. 141*f439973dSWarner Losh /// 142*f439973dSWarner Losh Ip4Config2PolicyDhcp, 143*f439973dSWarner Losh Ip4Config2PolicyMax 144*f439973dSWarner Losh } EFI_IP4_CONFIG2_POLICY; 145*f439973dSWarner Losh 146*f439973dSWarner Losh /// 147*f439973dSWarner Losh /// EFI_IP4_CONFIG2_MANUAL_ADDRESS 148*f439973dSWarner Losh /// 149*f439973dSWarner Losh typedef struct { 150*f439973dSWarner Losh /// 151*f439973dSWarner Losh /// The IPv4 unicast address. 152*f439973dSWarner Losh /// 153*f439973dSWarner Losh EFI_IPv4_ADDRESS Address; 154*f439973dSWarner Losh /// 155*f439973dSWarner Losh /// The subnet mask. 156*f439973dSWarner Losh /// 157*f439973dSWarner Losh EFI_IPv4_ADDRESS SubnetMask; 158*f439973dSWarner Losh } EFI_IP4_CONFIG2_MANUAL_ADDRESS; 159*f439973dSWarner Losh 160*f439973dSWarner Losh /** 161*f439973dSWarner Losh Set the configuration for the EFI IPv4 network stack running on the communication device this EFI 162*f439973dSWarner Losh IPv4 Configuration II Protocol instance manages. 163*f439973dSWarner Losh 164*f439973dSWarner Losh This function is used to set the configuration data of type DataType for the EFI IPv4 network stack 165*f439973dSWarner Losh running on the communication device this EFI IPv4 Configuration II Protocol instance manages. 166*f439973dSWarner Losh The successfully configured data is valid after system reset or power-off. 167*f439973dSWarner Losh The DataSize is used to calculate the count of structure instances in the Data for some 168*f439973dSWarner Losh DataType that multiple structure instances are allowed. 169*f439973dSWarner Losh This function is always non-blocking. When setting some typeof configuration data, an 170*f439973dSWarner Losh asynchronous process is invoked to check the correctness of the data, such as doing address conflict 171*f439973dSWarner Losh detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to 172*f439973dSWarner Losh indicate that such an asynchronous process is invoked and the process is not finished yet. The caller 173*f439973dSWarner Losh willing to get the result of the asynchronous process is required to call RegisterDataNotify() 174*f439973dSWarner Losh to register an event on the specified configuration data. Once the event is signaled, the caller can call 175*f439973dSWarner Losh GetData()to get back the configuration data in order to know the result. For other types of 176*f439973dSWarner Losh configuration data that do not require an asynchronous configuration process, the result of the 177*f439973dSWarner Losh operation is immediately returned. 178*f439973dSWarner Losh 179*f439973dSWarner Losh @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. 180*f439973dSWarner Losh @param[in] DataType The type of data to set. 181*f439973dSWarner Losh @param[in] DataSize Size of the buffer pointed to by Data in bytes. 182*f439973dSWarner Losh @param[in] Data The data buffer to set. The type ofthe data buffer is associated 183*f439973dSWarner Losh with the DataType. 184*f439973dSWarner Losh 185*f439973dSWarner Losh @retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set 186*f439973dSWarner Losh successfully. 187*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: 188*f439973dSWarner Losh This is NULL. 189*f439973dSWarner Losh One or more fields in Data and DataSize do not match the 190*f439973dSWarner Losh requirement of the data type indicated by DataType. 191*f439973dSWarner Losh @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration 192*f439973dSWarner Losh data can not be set under the current policy. 193*f439973dSWarner Losh @retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process. 194*f439973dSWarner Losh @retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and 195*f439973dSWarner Losh the process is not finished yet. 196*f439973dSWarner Losh @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType. 197*f439973dSWarner Losh @retval EFI_UNSUPPORTED This DataType is not supported. 198*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 199*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. 200*f439973dSWarner Losh **/ 201*f439973dSWarner Losh typedef 202*f439973dSWarner Losh EFI_STATUS 203*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG2_SET_DATA)( 204*f439973dSWarner Losh IN EFI_IP4_CONFIG2_PROTOCOL *This, 205*f439973dSWarner Losh IN EFI_IP4_CONFIG2_DATA_TYPE DataType, 206*f439973dSWarner Losh IN UINTN DataSize, 207*f439973dSWarner Losh IN VOID *Data 208*f439973dSWarner Losh ); 209*f439973dSWarner Losh 210*f439973dSWarner Losh /** 211*f439973dSWarner Losh Get the configuration data for the EFI IPv4 network stack running on the communication device this 212*f439973dSWarner Losh EFI IPv4 Configuration II Protocol instance manages. 213*f439973dSWarner Losh 214*f439973dSWarner Losh This function returns the configuration data of type DataType for the EFI IPv4 network stack 215*f439973dSWarner Losh running on the communication device this EFI IPv4 Configuration II Protocol instance manages. 216*f439973dSWarner Losh The caller is responsible for allocating the buffer usedto return the specified configuration data and 217*f439973dSWarner Losh the required size will be returned to the caller if the size of the buffer is too small. 218*f439973dSWarner Losh EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in 219*f439973dSWarner Losh progress asynchronous configuration process. The caller can call RegisterDataNotify() to 220*f439973dSWarner Losh register an event on the specified configuration data. Once the asynchronous configuration process is 221*f439973dSWarner Losh finished, the event will be signaled and a subsequent GetData() call will return the specified 222*f439973dSWarner Losh configuration data. 223*f439973dSWarner Losh 224*f439973dSWarner Losh @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. 225*f439973dSWarner Losh @param[in] DataType The type of data to get. 226*f439973dSWarner Losh @param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size 227*f439973dSWarner Losh of buffer required to store the specified configuration data. 228*f439973dSWarner Losh @param[in] Data The data buffer in which the configuration data is returned. The 229*f439973dSWarner Losh type of the data buffer is associated with the DataType. Ignored 230*f439973dSWarner Losh if DataSize is 0. 231*f439973dSWarner Losh 232*f439973dSWarner Losh @retval EFI_SUCCESS The specified configuration data is got successfully. 233*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: 234*f439973dSWarner Losh This is NULL. 235*f439973dSWarner Losh DataSize is NULL. 236*f439973dSWarner Losh Data is NULL if *DataSizeis not zero. 237*f439973dSWarner Losh @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data 238*f439973dSWarner Losh and the required size is returned in DataSize. 239*f439973dSWarner Losh @retval EFI_NOT_READY The specified configuration data is not ready due to an already in 240*f439973dSWarner Losh progress asynchronous configuration process. 241*f439973dSWarner Losh @retval EFI_NOT_FOUND The specified configuration data is not found. 242*f439973dSWarner Losh **/ 243*f439973dSWarner Losh typedef 244*f439973dSWarner Losh EFI_STATUS 245*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG2_GET_DATA)( 246*f439973dSWarner Losh IN EFI_IP4_CONFIG2_PROTOCOL *This, 247*f439973dSWarner Losh IN EFI_IP4_CONFIG2_DATA_TYPE DataType, 248*f439973dSWarner Losh IN OUT UINTN *DataSize, 249*f439973dSWarner Losh IN VOID *Data OPTIONAL 250*f439973dSWarner Losh ); 251*f439973dSWarner Losh 252*f439973dSWarner Losh /** 253*f439973dSWarner Losh Register an event that is to be signaled whenever a configuration process on the specified 254*f439973dSWarner Losh configuration data is done. 255*f439973dSWarner Losh 256*f439973dSWarner Losh This function registers an event that is to be signaled whenever a configuration process on the 257*f439973dSWarner Losh specified configuration data is done. An event can be registered for different DataType 258*f439973dSWarner Losh simultaneously and the caller is responsible for determining which type of configuration data causes 259*f439973dSWarner Losh the signaling of the event in such case. 260*f439973dSWarner Losh 261*f439973dSWarner Losh @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. 262*f439973dSWarner Losh @param[in] DataType The type of data to unregister the event for. 263*f439973dSWarner Losh @param[in] Event The event to register. 264*f439973dSWarner Losh 265*f439973dSWarner Losh @retval EFI_SUCCESS The notification event for the specified configuration data is 266*f439973dSWarner Losh registered. 267*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. 268*f439973dSWarner Losh @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported. 269*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 270*f439973dSWarner Losh @retval EFI_ACCESS_DENIED The Event is already registered for the DataType. 271*f439973dSWarner Losh **/ 272*f439973dSWarner Losh typedef 273*f439973dSWarner Losh EFI_STATUS 274*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY)( 275*f439973dSWarner Losh IN EFI_IP4_CONFIG2_PROTOCOL *This, 276*f439973dSWarner Losh IN EFI_IP4_CONFIG2_DATA_TYPE DataType, 277*f439973dSWarner Losh IN EFI_EVENT Event 278*f439973dSWarner Losh ); 279*f439973dSWarner Losh 280*f439973dSWarner Losh /** 281*f439973dSWarner Losh Remove a previously registered event for the specified configuration data. 282*f439973dSWarner Losh 283*f439973dSWarner Losh This function removes a previously registeredevent for the specified configuration data. 284*f439973dSWarner Losh 285*f439973dSWarner Losh @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. 286*f439973dSWarner Losh @param[in] DataType The type of data to remove the previously registered event for. 287*f439973dSWarner Losh @param[in] Event The event to unregister. 288*f439973dSWarner Losh 289*f439973dSWarner Losh @retval EFI_SUCCESS The event registered for the specified configuration data is removed. 290*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. 291*f439973dSWarner Losh @retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType. 292*f439973dSWarner Losh **/ 293*f439973dSWarner Losh typedef 294*f439973dSWarner Losh EFI_STATUS 295*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY)( 296*f439973dSWarner Losh IN EFI_IP4_CONFIG2_PROTOCOL *This, 297*f439973dSWarner Losh IN EFI_IP4_CONFIG2_DATA_TYPE DataType, 298*f439973dSWarner Losh IN EFI_EVENT Event 299*f439973dSWarner Losh ); 300*f439973dSWarner Losh 301*f439973dSWarner Losh /// 302*f439973dSWarner Losh /// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common 303*f439973dSWarner Losh /// configurations and the administrator configurable settings for the EFI IPv4 network stack. 304*f439973dSWarner Losh /// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that 305*f439973dSWarner Losh /// the EFI IPv4 network stack runs on. 306*f439973dSWarner Losh /// 307*f439973dSWarner Losh struct _EFI_IP4_CONFIG2_PROTOCOL { 308*f439973dSWarner Losh EFI_IP4_CONFIG2_SET_DATA SetData; 309*f439973dSWarner Losh EFI_IP4_CONFIG2_GET_DATA GetData; 310*f439973dSWarner Losh EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify; 311*f439973dSWarner Losh EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify; 312*f439973dSWarner Losh }; 313*f439973dSWarner Losh 314*f439973dSWarner Losh extern EFI_GUID gEfiIp4Config2ProtocolGuid; 315*f439973dSWarner Losh 316*f439973dSWarner Losh #endif 317