2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
2009-01-16 01:09:52 +01:00
|
|
|
Routines used to operate the Ip4 configure variable.
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2010-07-05 04:03:20 +02:00
|
|
|
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 11:33:45 +02:00
|
|
|
This program and the accompanying materials
|
2007-09-30 05:08:02 +02:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
2008-12-23 09:23:43 +01:00
|
|
|
which accompanies this distribution. The full text of the license may be found at<BR>
|
2007-09-30 05:08:02 +02:00
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef _NIC_IP4_VARIABLE_H_
|
|
|
|
#define _NIC_IP4_VARIABLE_H_
|
|
|
|
|
|
|
|
//
|
|
|
|
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
|
|
|
// They are of variable size
|
|
|
|
//
|
|
|
|
#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
|
|
|
|
(sizeof (EFI_IP4_IPCONFIG_DATA) + \
|
2008-05-26 10:16:25 +02:00
|
|
|
sizeof (EFI_IP4_ROUTE_TABLE) * (Ip4Config)->RouteTableSize)
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
|
|
|
|
(sizeof (NIC_IP4_CONFIG_INFO) + \
|
2008-05-26 10:16:25 +02:00
|
|
|
sizeof (EFI_IP4_ROUTE_TABLE) * (NicConfig)->Ip4Info.RouteTableSize)
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Compare whether two NIC address are equal includes their type and length.
|
|
|
|
//
|
|
|
|
#define NIC_ADDR_EQUAL(Nic1, Nic2) \
|
|
|
|
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
|
|
|
|
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
|
|
|
|
|
2008-06-30 09:20:33 +02:00
|
|
|
/**
|
|
|
|
Check whether the configure parameter is valid.
|
|
|
|
|
|
|
|
@param NicConfig The configure parameter to check
|
|
|
|
|
|
|
|
@return TRUE if the parameter is valid for the interface, otherwise FALSE.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
BOOLEAN
|
|
|
|
Ip4ConfigIsValid (
|
|
|
|
IN NIC_IP4_CONFIG_INFO *NicConfig
|
|
|
|
);
|
|
|
|
|
2008-06-30 09:20:33 +02:00
|
|
|
/**
|
|
|
|
Read the ip4 configure variable from the EFI variable.
|
|
|
|
|
2010-07-05 04:03:20 +02:00
|
|
|
@param Instance The IP4 CONFIG instance.
|
2008-06-30 09:20:33 +02:00
|
|
|
|
2010-07-05 04:03:20 +02:00
|
|
|
@return The IP4 configure read if it is there and is valid, otherwise NULL.
|
2008-06-30 09:20:33 +02:00
|
|
|
|
|
|
|
**/
|
2010-07-05 04:03:20 +02:00
|
|
|
NIC_IP4_CONFIG_INFO *
|
2007-09-30 05:08:02 +02:00
|
|
|
Ip4ConfigReadVariable (
|
2010-07-05 04:03:20 +02:00
|
|
|
IN IP4_CONFIG_INSTANCE *Instance
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-06-30 09:20:33 +02:00
|
|
|
/**
|
|
|
|
Write the IP4 configure variable to the NVRAM. If Config
|
|
|
|
is NULL, remove the variable.
|
|
|
|
|
2010-07-05 04:03:20 +02:00
|
|
|
@param Instance The IP4 CONFIG instance.
|
|
|
|
@param NicConfig The IP4 configure data to write.
|
2008-06-30 09:20:33 +02:00
|
|
|
|
2010-07-05 04:03:20 +02:00
|
|
|
@retval EFI_SUCCESS The variable is written to the NVRam.
|
2008-06-30 09:20:33 +02:00
|
|
|
@retval Others Failed to write the variable.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4ConfigWriteVariable (
|
2010-07-05 04:03:20 +02:00
|
|
|
IN IP4_CONFIG_INSTANCE *Instance,
|
|
|
|
IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-06-30 09:20:33 +02:00
|
|
|
/**
|
2010-07-05 04:03:20 +02:00
|
|
|
Reclaim Ip4Config Variables for NIC which has been removed from the platform.
|
2008-06-30 09:20:33 +02:00
|
|
|
|
|
|
|
**/
|
2010-07-05 04:03:20 +02:00
|
|
|
VOID
|
|
|
|
Ip4ConfigReclaimVariable (
|
|
|
|
VOID
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-06-30 09:20:33 +02:00
|
|
|
/**
|
2010-07-05 04:03:20 +02:00
|
|
|
Fix the RouteTable pointer in an EFI_IP4_IPCONFIG_DATA structure.
|
2008-06-30 09:20:33 +02:00
|
|
|
|
2008-12-23 09:23:43 +01:00
|
|
|
The pointer is set to be immediately follow the ConfigData if there're entries
|
|
|
|
in the RouteTable. Otherwise it is set to NULL.
|
2010-07-05 04:03:20 +02:00
|
|
|
|
2008-12-23 09:23:43 +01:00
|
|
|
@param ConfigData The IP4 IP configure data.
|
|
|
|
|
|
|
|
**/
|
2008-05-26 10:16:25 +02:00
|
|
|
VOID
|
|
|
|
Ip4ConfigFixRouteTablePointer (
|
2008-12-30 03:21:34 +01:00
|
|
|
IN OUT EFI_IP4_IPCONFIG_DATA *ConfigData
|
2008-05-26 10:16:25 +02:00
|
|
|
);
|
|
|
|
|
2007-09-30 05:08:02 +02:00
|
|
|
#endif
|
2009-05-13 11:29:44 +02:00
|
|
|
|