1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh This file provides a definition of the EFI IPv4 Configuration 3*f439973dSWarner Losh Protocol. 4*f439973dSWarner Losh 5*f439973dSWarner Losh Copyright (c) 2006 - 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.0. 10*f439973dSWarner Losh 11*f439973dSWarner Losh **/ 12*f439973dSWarner Losh 13*f439973dSWarner Losh #ifndef __EFI_IP4CONFIG_PROTOCOL_H__ 14*f439973dSWarner Losh #define __EFI_IP4CONFIG_PROTOCOL_H__ 15*f439973dSWarner Losh 16*f439973dSWarner Losh #include <Protocol/Ip4.h> 17*f439973dSWarner Losh 18*f439973dSWarner Losh #define EFI_IP4_CONFIG_PROTOCOL_GUID \ 19*f439973dSWarner Losh { \ 20*f439973dSWarner Losh 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } \ 21*f439973dSWarner Losh } 22*f439973dSWarner Losh 23*f439973dSWarner Losh typedef struct _EFI_IP4_CONFIG_PROTOCOL EFI_IP4_CONFIG_PROTOCOL; 24*f439973dSWarner Losh 25*f439973dSWarner Losh #define IP4_CONFIG_VARIABLE_ATTRIBUTES \ 26*f439973dSWarner Losh (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS) 27*f439973dSWarner Losh 28*f439973dSWarner Losh /// 29*f439973dSWarner Losh /// EFI_IP4_IPCONFIG_DATA contains the minimum IPv4 configuration data 30*f439973dSWarner Losh /// that is needed to start basic network communication. The StationAddress 31*f439973dSWarner Losh /// and SubnetMask must be a valid unicast IP address and subnet mask. 32*f439973dSWarner Losh /// If RouteTableSize is not zero, then RouteTable contains a properly 33*f439973dSWarner Losh /// formatted routing table for the StationAddress/SubnetMask, with the 34*f439973dSWarner Losh /// last entry in the table being the default route. 35*f439973dSWarner Losh /// 36*f439973dSWarner Losh typedef struct { 37*f439973dSWarner Losh /// 38*f439973dSWarner Losh /// Default station IP address, stored in network byte order. 39*f439973dSWarner Losh /// 40*f439973dSWarner Losh EFI_IPv4_ADDRESS StationAddress; 41*f439973dSWarner Losh /// 42*f439973dSWarner Losh /// Default subnet mask, stored in network byte order. 43*f439973dSWarner Losh /// 44*f439973dSWarner Losh EFI_IPv4_ADDRESS SubnetMask; 45*f439973dSWarner Losh /// 46*f439973dSWarner Losh /// Number of entries in the following RouteTable. May be zero. 47*f439973dSWarner Losh /// 48*f439973dSWarner Losh UINT32 RouteTableSize; 49*f439973dSWarner Losh /// 50*f439973dSWarner Losh /// Default routing table data (stored in network byte order). 51*f439973dSWarner Losh /// Ignored if RouteTableSize is zero. 52*f439973dSWarner Losh /// 53*f439973dSWarner Losh EFI_IP4_ROUTE_TABLE *RouteTable; 54*f439973dSWarner Losh } EFI_IP4_IPCONFIG_DATA; 55*f439973dSWarner Losh 56*f439973dSWarner Losh /** 57*f439973dSWarner Losh Starts running the configuration policy for the EFI IPv4 Protocol driver. 58*f439973dSWarner Losh 59*f439973dSWarner Losh The Start() function is called to determine and to begin the platform 60*f439973dSWarner Losh configuration policy by the EFI IPv4 Protocol driver. This determination may 61*f439973dSWarner Losh be as simple as returning EFI_UNSUPPORTED if there is no EFI IPv4 Protocol 62*f439973dSWarner Losh driver configuration policy. It may be as involved as loading some defaults 63*f439973dSWarner Losh from nonvolatile storage, downloading dynamic data from a DHCP server, and 64*f439973dSWarner Losh checking permissions with a site policy server. 65*f439973dSWarner Losh Starting the configuration policy is just the beginning. It may finish almost 66*f439973dSWarner Losh instantly or it may take several minutes before it fails to retrieve configuration 67*f439973dSWarner Losh information from one or more servers. Once the policy is started, drivers 68*f439973dSWarner Losh should use the DoneEvent parameter to determine when the configuration policy 69*f439973dSWarner Losh has completed. EFI_IP4_CONFIG_PROTOCOL.GetData() must then be called to 70*f439973dSWarner Losh determine if the configuration succeeded or failed. 71*f439973dSWarner Losh Until the configuration completes successfully, EFI IPv4 Protocol driver instances 72*f439973dSWarner Losh that are attempting to use default configurations must return EFI_NO_MAPPING. 73*f439973dSWarner Losh Once the configuration is complete, the EFI IPv4 Configuration Protocol driver 74*f439973dSWarner Losh signals DoneEvent. The configuration may need to be updated in the future. 75*f439973dSWarner Losh Note that in this case the EFI IPv4 Configuration Protocol driver must signal 76*f439973dSWarner Losh ReconfigEvent, and all EFI IPv4 Protocol driver instances that are using default 77*f439973dSWarner Losh configurations must return EFI_NO_MAPPING until the configuration policy has 78*f439973dSWarner Losh been rerun. 79*f439973dSWarner Losh 80*f439973dSWarner Losh @param This The pointer to the EFI_IP4_CONFIG_PROTOCOL instance. 81*f439973dSWarner Losh @param DoneEvent Event that will be signaled when the EFI IPv4 82*f439973dSWarner Losh Protocol driver configuration policy completes 83*f439973dSWarner Losh execution. This event must be of type EVT_NOTIFY_SIGNAL. 84*f439973dSWarner Losh @param ReconfigEvent Event that will be signaled when the EFI IPv4 85*f439973dSWarner Losh Protocol driver configuration needs to be updated. 86*f439973dSWarner Losh This event must be of type EVT_NOTIFY_SIGNAL. 87*f439973dSWarner Losh 88*f439973dSWarner Losh @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol 89*f439973dSWarner Losh driver is now running. 90*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the following parameters is NULL: 91*f439973dSWarner Losh This 92*f439973dSWarner Losh DoneEvent 93*f439973dSWarner Losh ReconfigEvent 94*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 95*f439973dSWarner Losh @retval EFI_ALREADY_STARTED The configuration policy for the EFI IPv4 Protocol 96*f439973dSWarner Losh driver was already started. 97*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. 98*f439973dSWarner Losh @retval EFI_UNSUPPORTED This interface does not support the EFI IPv4 Protocol 99*f439973dSWarner Losh driver configuration. 100*f439973dSWarner Losh 101*f439973dSWarner Losh **/ 102*f439973dSWarner Losh typedef 103*f439973dSWarner Losh EFI_STATUS 104*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG_START)( 105*f439973dSWarner Losh IN EFI_IP4_CONFIG_PROTOCOL *This, 106*f439973dSWarner Losh IN EFI_EVENT DoneEvent, 107*f439973dSWarner Losh IN EFI_EVENT ReconfigEvent 108*f439973dSWarner Losh ); 109*f439973dSWarner Losh 110*f439973dSWarner Losh /** 111*f439973dSWarner Losh Stops running the configuration policy for the EFI IPv4 Protocol driver. 112*f439973dSWarner Losh 113*f439973dSWarner Losh The Stop() function stops the configuration policy for the EFI IPv4 Protocol driver. 114*f439973dSWarner Losh All configuration data will be lost after calling Stop(). 115*f439973dSWarner Losh 116*f439973dSWarner Losh @param This The pointer to the EFI_IP4_CONFIG_PROTOCOL instance. 117*f439973dSWarner Losh 118*f439973dSWarner Losh @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol 119*f439973dSWarner Losh driver has been stopped. 120*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 121*f439973dSWarner Losh @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol 122*f439973dSWarner Losh driver was not started. 123*f439973dSWarner Losh 124*f439973dSWarner Losh **/ 125*f439973dSWarner Losh typedef 126*f439973dSWarner Losh EFI_STATUS 127*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG_STOP)( 128*f439973dSWarner Losh IN EFI_IP4_CONFIG_PROTOCOL *This 129*f439973dSWarner Losh ); 130*f439973dSWarner Losh 131*f439973dSWarner Losh /** 132*f439973dSWarner Losh Returns the default configuration data (if any) for the EFI IPv4 Protocol driver. 133*f439973dSWarner Losh 134*f439973dSWarner Losh The GetData() function returns the current configuration data for the EFI IPv4 135*f439973dSWarner Losh Protocol driver after the configuration policy has completed. 136*f439973dSWarner Losh 137*f439973dSWarner Losh @param This The pointer to the EFI_IP4_CONFIG_PROTOCOL instance. 138*f439973dSWarner Losh @param IpConfigDataSize On input, the size of the IpConfigData buffer. 139*f439973dSWarner Losh On output, the count of bytes that were written 140*f439973dSWarner Losh into the IpConfigData buffer. 141*f439973dSWarner Losh @param IpConfigData The pointer to the EFI IPv4 Configuration Protocol 142*f439973dSWarner Losh driver configuration data structure. 143*f439973dSWarner Losh Type EFI_IP4_IPCONFIG_DATA is defined in 144*f439973dSWarner Losh "Related Definitions" below. 145*f439973dSWarner Losh 146*f439973dSWarner Losh @retval EFI_SUCCESS The EFI IPv4 Protocol driver configuration has been returned. 147*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 148*f439973dSWarner Losh @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol 149*f439973dSWarner Losh driver is not running. 150*f439973dSWarner Losh @retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running. 151*f439973dSWarner Losh @retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete. 152*f439973dSWarner Losh @retval EFI_BUFFER_TOO_SMALL *IpConfigDataSize is smaller than the configuration 153*f439973dSWarner Losh data buffer or IpConfigData is NULL. 154*f439973dSWarner Losh 155*f439973dSWarner Losh **/ 156*f439973dSWarner Losh typedef 157*f439973dSWarner Losh EFI_STATUS 158*f439973dSWarner Losh (EFIAPI *EFI_IP4_CONFIG_GET_DATA)( 159*f439973dSWarner Losh IN EFI_IP4_CONFIG_PROTOCOL *This, 160*f439973dSWarner Losh IN OUT UINTN *IpConfigDataSize, 161*f439973dSWarner Losh OUT EFI_IP4_IPCONFIG_DATA *IpConfigData OPTIONAL 162*f439973dSWarner Losh ); 163*f439973dSWarner Losh 164*f439973dSWarner Losh /// 165*f439973dSWarner Losh /// The EFI_IP4_CONFIG_PROTOCOL driver performs platform-dependent and policy-dependent 166*f439973dSWarner Losh /// configurations for the EFI IPv4 Protocol driver. 167*f439973dSWarner Losh /// 168*f439973dSWarner Losh struct _EFI_IP4_CONFIG_PROTOCOL { 169*f439973dSWarner Losh EFI_IP4_CONFIG_START Start; 170*f439973dSWarner Losh EFI_IP4_CONFIG_STOP Stop; 171*f439973dSWarner Losh EFI_IP4_CONFIG_GET_DATA GetData; 172*f439973dSWarner Losh }; 173*f439973dSWarner Losh 174*f439973dSWarner Losh extern EFI_GUID gEfiIp4ConfigProtocolGuid; 175*f439973dSWarner Losh 176*f439973dSWarner Losh #endif 177