TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Config2Nv.c File Reference
#include "Ip4Impl.h"

Go to the source code of this file.

Functions

UINT8 GetSubnetMaskPrefixLength (IN EFI_IPv4_ADDRESS *SubnetMask)
 
EFI_STATUS Ip4Config2StrToIp (IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
 
EFI_STATUS Ip4Config2StrToIpList (IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS **PtrIpList, OUT UINTN *IpCount)
 
VOID Ip4Config2IpToStr (IN EFI_IPv4_ADDRESS *Ip, OUT CHAR16 *Str)
 
EFI_STATUS Ip4Config2IpListToStr (IN EFI_IPv4_ADDRESS *Ip, IN UINTN IpCount, OUT CHAR16 *Str)
 
VOID EFIAPI Ip4Config2ManualAddressNotify (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS Ip4Config2ConvertConfigNvDataToIfrNvData (IN IP4_CONFIG2_INSTANCE *Instance, IN OUT IP4_CONFIG2_IFR_NVDATA *IfrNvData)
 
EFI_STATUS Ip4Config2ConvertIfrNvDataToConfigNvData (IN IP4_CONFIG2_IFR_NVDATA *IfrFormNvData, IN OUT IP4_CONFIG2_INSTANCE *Instance)
 
EFI_STATUS EFIAPI Ip4FormExtractConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
 
EFI_STATUS EFIAPI Ip4FormRouteConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
 
EFI_STATUS EFIAPI Ip4FormCallback (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
 
EFI_STATUS Ip4Config2FormInit (IN OUT IP4_CONFIG2_INSTANCE *Instance)
 
VOID Ip4Config2FormUnload (IN OUT IP4_CONFIG2_INSTANCE *Instance)
 

Variables

CHAR16 mIp4Config2StorageName [] = L"IP4_CONFIG2_IFR_NVDATA"
 

Detailed Description

Helper functions for configuring or getting the parameters relating to Ip4.

Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip4Config2Nv.c.

Function Documentation

◆ GetSubnetMaskPrefixLength()

UINT8 GetSubnetMaskPrefixLength ( IN EFI_IPv4_ADDRESS SubnetMask)

Calculate the prefix length of the IPv4 subnet mask.

Parameters
[in]SubnetMaskThe IPv4 subnet mask.
Returns
The prefix length of the subnet mask.
Return values
0Other errors as indicated.

Definition at line 23 of file Ip4Config2Nv.c.

◆ Ip4Config2ConvertConfigNvDataToIfrNvData()

EFI_STATUS Ip4Config2ConvertConfigNvDataToIfrNvData ( IN IP4_CONFIG2_INSTANCE Instance,
IN OUT IP4_CONFIG2_IFR_NVDATA IfrNvData 
)

Convert the network configuration data into the IFR data.

Parameters
[in]InstanceThe IP4 config2 instance.
[in,out]IfrNvDataThe IFR nv data.
Return values
EFI_SUCCESSThe configure parameter to IFR data was set successfully.
EFI_INVALID_PARAMETERSource instance or target IFR data is not available.
OthersOther errors as indicated.

Definition at line 383 of file Ip4Config2Nv.c.

◆ Ip4Config2ConvertIfrNvDataToConfigNvData()

EFI_STATUS Ip4Config2ConvertIfrNvDataToConfigNvData ( IN IP4_CONFIG2_IFR_NVDATA IfrFormNvData,
IN OUT IP4_CONFIG2_INSTANCE Instance 
)

Convert the IFR data into the network configuration data and set the IP configure parameters for the NIC.

Parameters
[in]IfrFormNvDataThe IFR NV data.
[in,out]InstanceThe IP4 config2 instance.
Return values
EFI_SUCCESSThe configure parameter for this NIC was set successfully.
EFI_INVALID_PARAMETERThe address information for setting is invalid.
OthersOther errors as indicated.

Definition at line 551 of file Ip4Config2Nv.c.

◆ Ip4Config2FormInit()

EFI_STATUS Ip4Config2FormInit ( IN OUT IP4_CONFIG2_INSTANCE Instance)

Install HII Config Access protocol for network device and allocate resource.

Parameters
[in,out]InstanceThe IP4 config2 Instance.
Return values
EFI_SUCCESSThe HII Config Access protocol is installed.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
OthersOther errors as indicated.

Definition at line 1266 of file Ip4Config2Nv.c.

◆ Ip4Config2FormUnload()

VOID Ip4Config2FormUnload ( IN OUT IP4_CONFIG2_INSTANCE Instance)

Uninstall the HII Config Access protocol for network devices and free up the resources.

Parameters
[in,out]InstanceThe IP4 config2 instance to unload a form.

Definition at line 1413 of file Ip4Config2Nv.c.

◆ Ip4Config2IpListToStr()

EFI_STATUS Ip4Config2IpListToStr ( IN EFI_IPv4_ADDRESS Ip,
IN UINTN  IpCount,
OUT CHAR16 *  Str 
)

Convert the IPv4 address list into string consists of several decimal dotted IPv4 addresses separated by space.

Parameters
[in]IpThe IPv4 address list.
[in]IpCountThe size of IPv4 address list.
[out]StrThe string contains several decimal dotted IPv4 addresses separated by space.
Return values
EFI_SUCCESSOperation is success.
EFI_OUT_OF_RESOURCESError occurs in allocating memory.

Definition at line 294 of file Ip4Config2Nv.c.

◆ Ip4Config2IpToStr()

VOID Ip4Config2IpToStr ( IN EFI_IPv4_ADDRESS Ip,
OUT CHAR16 *  Str 
)

Convert the IPv4 address into a dotted string.

Parameters
[in]IpThe IPv4 address.
[out]StrThe dotted IP string.

Definition at line 264 of file Ip4Config2Nv.c.

◆ Ip4Config2ManualAddressNotify()

VOID EFIAPI Ip4Config2ManualAddressNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The notify function of create event when performing a manual configuration.

Parameters
[in]EventThe pointer of Event.
[in]ContextThe pointer of Context.

Definition at line 362 of file Ip4Config2Nv.c.

◆ Ip4Config2StrToIp()

EFI_STATUS Ip4Config2StrToIp ( IN CHAR16 *  Str,
OUT EFI_IPv4_ADDRESS Ip 
)

Convert the decimal dotted IPv4 address into the binary IPv4 address.

Parameters
[in]StrThe UNICODE string.
[out]IpThe storage to return the IPv4 address.
Return values
EFI_SUCCESSThe binary IP address is returned in Ip.
EFI_INVALID_PARAMETERThe IP string is malformatted.

Definition at line 65 of file Ip4Config2Nv.c.

◆ Ip4Config2StrToIpList()

EFI_STATUS Ip4Config2StrToIpList ( IN CHAR16 *  Str,
OUT EFI_IPv4_ADDRESS **  PtrIpList,
OUT UINTN IpCount 
)

Convert the decimal dotted IPv4 addresses separated by space into the binary IPv4 address list.

Parameters
[in]StrThe UNICODE string contains IPv4 addresses.
[out]PtrIpListThe storage to return the IPv4 address list.
[out]IpCountThe size of the IPv4 address list.
Return values
EFI_SUCCESSThe binary IP address list is returned in PtrIpList.
EFI_OUT_OF_RESOURCESError occurs in allocating memory.
EFI_INVALID_PARAMETERThe IP string is malformatted.

Definition at line 130 of file Ip4Config2Nv.c.

◆ Ip4FormCallback()

EFI_STATUS EFIAPI Ip4FormCallback ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN EFI_BROWSER_ACTION  Action,
IN EFI_QUESTION_ID  QuestionId,
IN UINT8  Type,
IN EFI_IFR_TYPE_VALUE Value,
OUT EFI_BROWSER_ACTION_REQUEST *  ActionRequest 
)

This function is called to provide results data to the driver. This data consists of a unique key that is used to identify which data is either being passed back or being asked for.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]ActionSpecifies the type of action taken by the browser.
[in]QuestionIdA unique value which is sent to the original exporting driver so that it can identify the type of data to expect. The format of the data tends to vary based on the opcode that enerated the callback.
[in]TypeThe type of value for the question.
[in]ValueA pointer to the data being sent to the original exporting driver.
[out]ActionRequestOn return, points to the action requested by the callback function.
Return values
EFI_SUCCESSThe callback successfully handled the action.
EFI_OUT_OF_RESOURCESNot enough storage is available to hold the variable and its data.
EFI_DEVICE_ERRORThe variable could not be saved.
EFI_UNSUPPORTEDThe specified Action is not supported by the callback. Currently not implemented.
EFI_INVALID_PARAMETERSPassing in wrong parameter.
OthersOther errors as indicated.

Definition at line 1138 of file Ip4Config2Nv.c.

◆ Ip4FormExtractConfig()

EFI_STATUS EFIAPI Ip4FormExtractConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN CONST EFI_STRING  Request,
OUT EFI_STRING *  Progress,
OUT EFI_STRING *  Results 
)

This function allows the caller to request the current configuration for one or more named elements. The resulting string is in <ConfigAltResp> format. Any and all alternative configuration strings shall also be appended to the end of the current configuration string. If they are, they must appear after the current configuration. They must contain the same routing (GUID, NAME, PATH) as the current configuration string. They must have an additional description indicating the type of alternative configuration the string represents, "ALTCFG=<StringToken>". That <StringToken> (when converted from Hex UNICODE to binary) is a reference to a string in the associated string pack.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]RequestA null-terminated Unicode string in <ConfigRequest> format. Note that this includes the routing information as well as the configurable name / value pairs. It is invalid for this string to be in <MultiConfigRequest> format.
[out]ProgressOn return, points to a character in the Request string. Points to the string's null terminator if request was successful. Points to the most recent "&" before the first failing name / value pair (or the beginning of the string if the failure is in the first name / value pair) if the request was not successful.
[out]ResultsA null-terminated Unicode string in <ConfigAltResp> format which has all values filled in for the names in the Request string. String to be allocated by the called function.
Return values
EFI_SUCCESSThe Results string is filled with the values corresponding to all requested names.
EFI_OUT_OF_RESOURCESNot enough memory to store the parts of the results that must be stored awaiting possible future protocols.
EFI_NOT_FOUNDRouting data doesn't match any known driver. Progress set to the first character in the routing header. Note: There is no requirement that the driver validate the routing data. It must skip the <ConfigHdr> in order to process the names.
EFI_INVALID_PARAMETERIllegal syntax. Progress set to most recent & before the error or the beginning of the string.
EFI_INVALID_PARAMETERUnknown name. Progress points to the & before the name in question.Currently not implemented.

Definition at line 895 of file Ip4Config2Nv.c.

◆ Ip4FormRouteConfig()

EFI_STATUS EFIAPI Ip4FormRouteConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN CONST EFI_STRING  Configuration,
OUT EFI_STRING *  Progress 
)

This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]ConfigurationA null-terminated Unicode string in <ConfigString> format.
[out]ProgressA pointer to a string filled in with the offset of the most recent '&' before the first failing name / value pair (or the beginning of the string if the failure is in the first name / value pair) or the terminating NULL if all was successful.
Return values
EFI_SUCCESSThe results have been distributed or are awaiting distribution.
EFI_OUT_OF_MEMORYNot enough memory to store the parts of the results that must be stored awaiting possible future protocols.
EFI_INVALID_PARAMETERSPassing in a NULL for the Results parameter would result in this type of error.
EFI_NOT_FOUNDTarget for the specified routing data was not found.

Definition at line 1041 of file Ip4Config2Nv.c.

Variable Documentation

◆ mIp4Config2StorageName

CHAR16 mIp4Config2StorageName[] = L"IP4_CONFIG2_IFR_NVDATA"

Definition at line 11 of file Ip4Config2Nv.c.