TianoCore EDK2 master
|
#include "Ip4Impl.h"
Go to the source code of this file.
Variables | |
LIST_ENTRY | mIp4Config2InstanceList = { &mIp4Config2InstanceList, &mIp4Config2InstanceList } |
The implementation of EFI IPv4 Configuration II Protocol.
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Ip4Config2Impl.c.
EFI_STATUS EFIAPI EfiIp4Config2GetData | ( | IN EFI_IP4_CONFIG2_PROTOCOL * | This, |
IN EFI_IP4_CONFIG2_DATA_TYPE | DataType, | ||
IN OUT UINTN * | DataSize, | ||
IN VOID *Data | OPTIONAL | ||
) |
Get the configuration data for the EFI IPv4 network stack running on the communication device that this EFI_IP4_CONFIG2_PROTOCOL instance manages.
This function returns the configuration data of type DataType for the EFI IPv4 network stack running on the communication device that this EFI IPv4 Configuration Protocol instance manages.
The caller is responsible for allocating the buffer used to return the specified configuration data. 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 asynchronous configuration process already in progress. 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.
[in] | This | Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. |
[in] | DataType | The type of data to get. |
[in,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. |
[in] | Data | The data buffer in which the configuration data is returned. The type of the data buffer is associated with the DataType. This is an optional parameter that may be NULL. |
EFI_SUCCESS | The specified configuration data was obtained successfully. |
EFI_INVALID_PARAMETER | One or more of the followings are TRUE:
|
EFI_BUFFER_TOO_SMALL | The size of Data is too small for the specified configuration data, and the required size is returned in DataSize. |
EFI_NOT_READY | The specified configuration data is not ready due to an asynchronous configuration process already in progress. |
EFI_NOT_FOUND | The specified configuration data is not found. |
Definition at line 1765 of file Ip4Config2Impl.c.
EFI_STATUS EFIAPI EfiIp4Config2RegisterDataNotify | ( | IN EFI_IP4_CONFIG2_PROTOCOL * | This, |
IN EFI_IP4_CONFIG2_DATA_TYPE | DataType, | ||
IN EFI_EVENT | Event | ||
) |
Register an event that is 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 performed. An event can be registered for a different DataType simultaneously. The caller is responsible for determining which type of configuration data causes the signaling of the event in such an event.
[in] | This | Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. |
[in] | DataType | The type of data to unregister the event for. |
[in] | Event | The event to register. |
EFI_SUCCESS | The notification event for the specified configuration data is registered. |
EFI_INVALID_PARAMETER | This is NULL or Event is NULL. |
EFI_UNSUPPORTED | The configuration data type specified by DataType is not supported. |
EFI_OUT_OF_RESOURCES | Required system resources could not be allocated. |
EFI_ACCESS_DENIED | The Event is already registered for the DataType. |
Definition at line 1835 of file Ip4Config2Impl.c.
EFI_STATUS EFIAPI EfiIp4Config2SetData | ( | IN EFI_IP4_CONFIG2_PROTOCOL * | This, |
IN EFI_IP4_CONFIG2_DATA_TYPE | DataType, | ||
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
Set the configuration for the EFI IPv4 network stack running on the communication device this EFI_IP4_CONFIG2_PROTOCOL instance manages.
This function is used to set the configuration data of type DataType for the EFI IPv4 network stack that is running on the communication device that this EFI IPv4 Configuration Protocol instance manages.
DataSize is used to calculate the count of structure instances in the Data for a DataType in which multiple structure instances are allowed.
This function is always non-blocking. When setting some type of configuration data, an asynchronous process is invoked to check the correctness of the data, such as performing Duplicate Address Detection on the manually set local IPv4 addresses. EFI_NOT_READY is returned immediately to indicate that such an asynchronous process is invoked, and the process is not finished yet. The caller wanting 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 obtain the configuration data and 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.
[in] | This | The pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. |
[in] | DataType | The type of data to set. |
[in] | DataSize | Size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set. The type of the data buffer is associated with the DataType. |
EFI_SUCCESS | The specified configuration data for the EFI IPv6 network stack was set successfully. |
EFI_INVALID_PARAMETER | One or more of the following are TRUE:
|
EFI_WRITE_PROTECTED | The specified configuration data is read-only or the specified configuration data cannot be set under the current policy. |
EFI_ACCESS_DENIED | Another set operation on the specified configuration data is already in process. |
EFI_NOT_READY | An asynchronous process was invoked to set the specified configuration data, and the process is not finished yet. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type indicated by DataType. |
EFI_UNSUPPORTED | This DataType is not supported. |
EFI_OUT_OF_RESOURCES | Required system resources could not be allocated. |
EFI_DEVICE_ERROR | An unexpected system error or network error occurred. |
Definition at line 1663 of file Ip4Config2Impl.c.
EFI_STATUS EFIAPI EfiIp4Config2UnregisterDataNotify | ( | 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 | The pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. |
DataType | The type of data to remove from the previously registered event. |
Event | The event to be unregistered. |
EFI_SUCCESS | The event registered for the specified configuration data was removed. |
EFI_INVALID_PARAMETER | This is NULL or Event is NULL. |
EFI_NOT_FOUND | The Event has not been registered for the specified DataType. |
Definition at line 1896 of file Ip4Config2Impl.c.
Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
Event | The event that is signalled. |
Context | The IP4 service binding instance. |
Definition at line 2134 of file Ip4Config2Impl.c.
VOID EFIAPI Ip4AutoReconfigCallBackDpc | ( | IN VOID * | Context | ) |
The event handle for IP4 auto reconfiguration. The original default interface and route table will be removed as the default.
[in] | Context | The IP4 service binding instance. |
Definition at line 2105 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2BuildDefaultRouteTable | ( | IN IP4_SERVICE * | IpSb, |
OUT EFI_IP4_ROUTE_TABLE * | Table | ||
) |
Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of GetModeData. The EFI_IP4_ROUTE_TABLE is clumsy to use in the internal operation of the IP4 driver.
[in] | IpSb | The IP4 service binding instance. |
[out] | Table | The built IP4 route table. |
EFI_SUCCESS | The route table is successfully build |
EFI_NOT_FOUND | Failed to allocate the memory for the route table. |
Definition at line 377 of file Ip4Config2Impl.c.
VOID Ip4Config2CleanDhcp4 | ( | IN IP4_CONFIG2_INSTANCE * | Instance | ) |
Release all the DHCP related resources.
Instance | The IP4 config2 instance. |
Definition at line 626 of file Ip4Config2Impl.c.
VOID Ip4Config2CleanInstance | ( | IN OUT IP4_CONFIG2_INSTANCE * | Instance | ) |
Release an IP4_CONFIG2_INSTANCE.
[in,out] | Instance | The buffer of IP4_CONFIG2_INSTANCE to be freed. |
Definition at line 2049 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2DestroyDhcp4 | ( | IN OUT IP4_CONFIG2_INSTANCE * | Instance | ) |
Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
[in,out] | Instance | The buffer of IP4 config2 instance to be freed. |
EFI_SUCCESS | The child was successfully destroyed. |
Others | Failed to destroy the child. |
Definition at line 40 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2GetIfInfo | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN OUT UINTN * | DataSize, | ||
IN VOID *Data | OPTIONAL | ||
) |
The work function is to get the interface information of the communication device this IP4_CONFIG2_INSTANCE manages.
[in] | Instance | Pointer to the IP4 config2 instance data. |
[in,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. |
[in] | Data | The data buffer in which the configuration data is returned. Ignored if DataSize is ZERO. |
EFI_BUFFER_TOO_SMALL | The size of Data is too small for the specified configuration data, and the required size is returned in DataSize. |
EFI_SUCCESS | The specified configuration data was obtained. |
Definition at line 1058 of file Ip4Config2Impl.c.
VOID Ip4Config2InitIfInfo | ( | IN IP4_SERVICE * | IpSb, |
OUT EFI_IP4_CONFIG2_INTERFACE_INFO * | IfInfo | ||
) |
Generate the operational state of the interface this IP4 config2 instance manages and output in EFI_IP4_CONFIG2_INTERFACE_INFO.
[in] | IpSb | The pointer to the IP4 service binding instance. |
[out] | IfInfo | The pointer to the IP4 config2 interface information structure. |
Definition at line 1597 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2InitInstance | ( | OUT IP4_CONFIG2_INSTANCE * | Instance | ) |
Initialize an IP4_CONFIG2_INSTANCE.
[out] | Instance | The buffer of IP4_CONFIG2_INSTANCE to be initialized. |
EFI_OUT_OF_RESOURCES | Failed to allocate resources to complete the operation. |
EFI_SUCCESS | The IP4_CONFIG2_INSTANCE initialized successfully. |
Definition at line 1942 of file Ip4Config2Impl.c.
Callback function when DHCP process finished. It will save the retrieved IP configure parameter from DHCP to the NVRam.
Event | The callback event |
Context | Opaque context to the callback |
Definition at line 790 of file Ip4Config2Impl.c.
The event process routine when the DHCPv4 service binding protocol is installed in the system.
[in] | Event | Not used. |
[in] | Context | Pointer to the IP4 config2 instance data. |
The event process routine when the DHCPv4 service binding protocol is installed in the system.
[in] | Event | Not used. |
[in] | Context | The pointer to the IP4 config2 instance data. |
Definition at line 430 of file Ip4Config2Impl.c.
VOID Ip4Config2OnPolicyChanged | ( | IN IP4_SERVICE * | IpSb, |
IN EFI_IP4_CONFIG2_POLICY | NewPolicy | ||
) |
Update the current policy to NewPolicy. During the transition period, the default router list and address list in all interfaces will be released.
[in] | IpSb | The IP4 service binding instance. |
[in] | NewPolicy | The new policy to be updated to. |
Definition at line 92 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2ReadConfigData | ( | IN CHAR16 * | VarName, |
IN OUT IP4_CONFIG2_INSTANCE * | Instance | ||
) |
Read the configuration data from variable storage according to the VarName and gEfiIp4Config2ProtocolGuid. It checks the integrity of variable data. If the data is corrupted, it clears the variable data to ZERO. Otherwise, it outputs the configuration data to IP4_CONFIG2_INSTANCE.
[in] | VarName | The pointer to the variable name |
[in,out] | Instance | The pointer to the IP4 config2 instance data. |
EFI_NOT_FOUND | The variable can not be found or already corrupted. |
EFI_OUT_OF_RESOURCES | Fail to allocate resource to complete the operation. |
EFI_SUCCESS | The configuration data was retrieved successfully. |
Definition at line 188 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetDefaultAddr | ( | IN IP4_SERVICE * | IpSb, |
IN IP4_ADDR | StationAddress, | ||
IN IP4_ADDR | SubnetMask | ||
) |
Set the station address and subnetmask for the default interface.
[in] | IpSb | The pointer to the IP4 service binding instance. |
[in] | StationAddress | Ip address to be set. |
[in] | SubnetMask | Subnet to be set. |
EFI_SUCCESS | Set default address successful. |
Others | Some errors occur in setting. |
Definition at line 461 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetDefaultIf | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN IP4_ADDR | StationAddress, | ||
IN IP4_ADDR | SubnetMask, | ||
IN IP4_ADDR | GatewayAddress | ||
) |
Set the station address, subnetmask and gateway address for the default interface.
[in] | Instance | The pointer to the IP4 config2 instance data. |
[in] | StationAddress | Ip address to be set. |
[in] | SubnetMask | Subnet to be set. |
[in] | GatewayAddress | Gateway to be set. |
EFI_SUCCESS | Set default If successful. |
Others | Errors occur as indicated. |
Definition at line 578 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetDnsServer | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
The work function is to set the DNS server list for the EFI IPv4 network stack running on the communication device that this EFI_IP4_CONFIG2_PROTOCOL manages. It is not configurable when the policy is Ip4Config2PolicyDhcp. The DNS server addresses must be unicast IPv4 addresses.
[in] | Instance | The pointer to the IP4 config2 instance data. |
[in] | DataSize | The size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set, points to an array of EFI_IPv4_ADDRESS instances. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type. |
EFI_WRITE_PROTECTED | The specified configuration data cannot be set under the current policy. |
EFI_INVALID_PARAMETER | One or more fields in Data is invalid. |
EFI_OUT_OF_RESOURCES | Failed to allocate resources to complete the operation. |
EFI_ABORTED | The DNS server addresses to be set equal the current configuration. |
EFI_SUCCESS | The specified configuration data for the EFI IPv4 network stack was set. |
Definition at line 1548 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetDnsServerWorker | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
This worker function sets the DNS server list for the EFI IPv4 network stack running on the communication device that this EFI_IP4_CONFIG2_PROTOCOL manages. The DNS server addresses must be unicast IPv4 addresses.
[in] | Instance | The pointer to the IP4 config2 instance data. |
[in] | DataSize | The size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set, points to an array of EFI_IPv4_ADDRESS instances. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type. |
EFI_INVALID_PARAMETER | One or more fields in Data is invalid. |
EFI_OUT_OF_RESOURCES | Failed to allocate resources to complete the operation. |
EFI_ABORTED | The DNS server addresses to be set equal the current configuration. |
EFI_SUCCESS | The specified configuration data for the EFI IPv4 network stack was set. |
Definition at line 684 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetGateway | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
The work function is to set the gateway addresses manually for the EFI IPv4 network stack that is running on the communication device that this EFI IPv4 Configuration Protocol manages. It is not configurable when the policy is Ip4Config2PolicyDhcp. The gateway addresses must be unicast IPv4 addresses.
[in] | Instance | The pointer to the IP4 config2 instance data. |
[in] | DataSize | The size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set. This points to an array of EFI_IPv6_ADDRESS instances. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type. |
EFI_WRITE_PROTECTED | The specified configuration data cannot be set under the current policy. |
EFI_INVALID_PARAMETER | One or more fields in Data is invalid. |
EFI_OUT_OF_RESOURCES | Failed to allocate resource to complete the operation. |
EFI_ABORTED | The manual gateway addresses to be set equal the current configuration. |
EFI_SUCCESS | The specified configuration data for the EFI IPv6 network stack was set. |
Definition at line 1396 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetManualAddress | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
The work function is to set the station addresses manually for the EFI IPv4 network stack. It is only configurable when the policy is Ip4Config2PolicyStatic.
[in] | Instance | Pointer to the IP4 config2 instance data. |
[in] | DataSize | Size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type. |
EFI_WRITE_PROTECTED | The specified configuration data cannot be set under the current policy. |
EFI_INVALID_PARAMETER | One or more fields in Data is invalid. |
EFI_OUT_OF_RESOURCES | Fail to allocate resource to complete the operation. |
EFI_NOT_READY | An asynchronous process is invoked to set the specified configuration data, and the process is not finished. |
EFI_ABORTED | The manual addresses to be set equal current configuration. |
EFI_SUCCESS | The specified configuration data for the EFI IPv6 network stack was set. |
Definition at line 1236 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2SetPolicy | ( | IN IP4_CONFIG2_INSTANCE * | Instance, |
IN UINTN | DataSize, | ||
IN VOID * | Data | ||
) |
The work function is to set the general configuration policy for the EFI IPv4 network stack that is running on the communication device managed by this IP4_CONFIG2_INSTANCE. The policy will affect other configuration settings.
[in] | Instance | Pointer to the IP4 config2 instance data. |
[in] | DataSize | Size of the buffer pointed to by Data in bytes. |
[in] | Data | The data buffer to set. |
EFI_INVALID_PARAMETER | The to be set policy is invalid. |
EFI_BAD_BUFFER_SIZE | The DataSize does not match the size of the type. |
EFI_ABORTED | The new policy equals the current policy. |
EFI_SUCCESS | The specified configuration data for the EFI IPv6 network stack was set. |
Definition at line 1126 of file Ip4Config2Impl.c.
EFI_STATUS EFIAPI Ip4Config2SignalEvent | ( | IN NET_MAP * | Map, |
IN NET_MAP_ITEM * | Item, | ||
IN VOID * | Arg | ||
) |
Signal the registered event. It is the callback routine for NetMapIterate.
[in] | Map | Points to the list of registered event. |
[in] | Item | The registered event. |
[in] | Arg | Not used. |
EFI_SUCCESS | The event was signaled successfully. |
Definition at line 162 of file Ip4Config2Impl.c.
EFI_STATUS Ip4Config2WriteConfigData | ( | IN CHAR16 * | VarName, |
IN IP4_CONFIG2_INSTANCE * | Instance | ||
) |
Write the configuration data from IP4_CONFIG2_INSTANCE to variable storage.
[in] | VarName | The pointer to the variable name. |
[in] | Instance | The pointer to the IP4 config2 instance data. |
EFI_OUT_OF_RESOURCES | Fail to allocate resource to complete the operation. |
EFI_SUCCESS | The configuration data is written successfully. |
Definition at line 303 of file Ip4Config2Impl.c.
EFI_STATUS Ip4StartAutoConfig | ( | IN IP4_CONFIG2_INSTANCE * | Instance | ) |
Start the DHCP configuration for this IP service instance. It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the DHCP configuration.
[in] | Instance | The IP4 config2 instance to configure |
EFI_SUCCESS | The auto configuration is successfully started |
Others | Failed to start auto configuration. |
Definition at line 885 of file Ip4Config2Impl.c.
LIST_ENTRY mIp4Config2InstanceList = { &mIp4Config2InstanceList, &mIp4Config2InstanceList } |
Definition at line 13 of file Ip4Config2Impl.c.