]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
2 Routines used to operate the Ip4 configure variable
4 Copyright (c) 2006 - 2008, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at<BR>
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _NIC_IP4_VARIABLE_H_
16 #define _NIC_IP4_VARIABLE_H_
19 #include <Protocol/NicIp4Config.h>
22 // Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
23 // They are of variable size
25 #define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
26 (sizeof (EFI_IP4_IPCONFIG_DATA) + \
27 sizeof (EFI_IP4_ROUTE_TABLE) * (Ip4Config)->RouteTableSize)
29 #define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
30 (sizeof (NIC_IP4_CONFIG_INFO) + \
31 sizeof (EFI_IP4_ROUTE_TABLE) * (NicConfig)->Ip4Info.RouteTableSize)
34 // Compare whether two NIC address are equal includes their type and length.
36 #define NIC_ADDR_EQUAL(Nic1, Nic2) \
37 (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
38 NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
41 Check whether the configure parameter is valid.
43 @param NicConfig The configure parameter to check
45 @return TRUE if the parameter is valid for the interface, otherwise FALSE.
50 IN NIC_IP4_CONFIG_INFO
*NicConfig
54 Read the ip4 configure variable from the EFI variable.
58 @return The IP4 configure read if it is there and is valid, otherwise NULL
62 Ip4ConfigReadVariable (
67 Write the IP4 configure variable to the NVRAM. If Config
68 is NULL, remove the variable.
70 @param Config The IP4 configure data to write
72 @retval EFI_SUCCESS The variable is written to the NVRam
73 @retval Others Failed to write the variable.
77 Ip4ConfigWriteVariable (
78 IN IP4_CONFIG_VARIABLE
*Config OPTIONAL
82 Locate the IP4 configure parameters from the variable.If a
83 configuration is found, copy it to a newly allocated block
84 of memory to avoid the alignment problem. Caller should
85 release the memory after use.
87 @param Variable The IP4 configure variable to search in
88 @param NicAddr The interface address to check
90 @return The point to the NIC's IP4 configure info if it is found
91 in the IP4 variable, otherwise NULL.
95 Ip4ConfigFindNicVariable (
96 IN IP4_CONFIG_VARIABLE
*Variable
,
101 Modify the configuration parameter for the NIC in the variable.
102 If Config is NULL, old configuration will be remove from the new
103 variable. Otherwise, append it or replace the old one.
105 @param Variable The IP4 variable to change
106 @param NicAddr The interface to search
107 @param Config The new configuration parameter (NULL to remove the old)
109 @return The new IP4_CONFIG_VARIABLE variable if the new variable has at
110 @return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
111 @return Return NULL either because failed to locate memory for new variable
112 @return or the only NIC configure is removed from the Variable.
115 IP4_CONFIG_VARIABLE
*
116 Ip4ConfigModifyVariable (
117 IN IP4_CONFIG_VARIABLE
*Variable
, OPTIONAL
118 IN NIC_ADDR
*NicAddr
,
119 IN NIC_IP4_CONFIG_INFO
*Config OPTIONAL
123 Fix the RouteTable pointer in an EFI_IP4_IPCONFIG_DATA structure.
125 The pointer is set to be immediately follow the ConfigData if there're entries
126 in the RouteTable. Otherwise it is set to NULL.
128 @param ConfigData The IP4 IP configure data.
132 Ip4ConfigFixRouteTablePointer (
133 IN EFI_IP4_IPCONFIG_DATA
*ConfigData