]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
SourceLevelDebugPkg/SecPeiDebugAgentLib: Restore CPU interrupt state
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / NicIp4Variable.h
1 /** @file
2 Routines used to operate the Ip4 configure variable.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 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
9
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.
12
13 **/
14
15 #ifndef _NIC_IP4_VARIABLE_H_
16 #define _NIC_IP4_VARIABLE_H_
17
18 //
19 // Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
20 // They are of variable size
21 //
22 #define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
23 (sizeof (EFI_IP4_IPCONFIG_DATA) + \
24 sizeof (EFI_IP4_ROUTE_TABLE) * (Ip4Config)->RouteTableSize)
25
26 #define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
27 (sizeof (NIC_IP4_CONFIG_INFO) + \
28 sizeof (EFI_IP4_ROUTE_TABLE) * (NicConfig)->Ip4Info.RouteTableSize)
29
30 //
31 // Compare whether two NIC address are equal includes their type and length.
32 //
33 #define NIC_ADDR_EQUAL(Nic1, Nic2) \
34 (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
35 NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
36
37 /**
38 Check whether the configure parameter is valid.
39
40 @param NicConfig The configure parameter to check
41
42 @return TRUE if the parameter is valid for the interface, otherwise FALSE.
43
44 **/
45 BOOLEAN
46 Ip4ConfigIsValid (
47 IN NIC_IP4_CONFIG_INFO *NicConfig
48 );
49
50 /**
51 Read the ip4 configure variable from the EFI variable.
52
53 @param Instance The IP4 CONFIG instance.
54
55 @return The IP4 configure read if it is there and is valid, otherwise NULL.
56
57 **/
58 NIC_IP4_CONFIG_INFO *
59 Ip4ConfigReadVariable (
60 IN IP4_CONFIG_INSTANCE *Instance
61 );
62
63 /**
64 Write the IP4 configure variable to the NVRAM. If Config
65 is NULL, remove the variable.
66
67 @param Instance The IP4 CONFIG instance.
68 @param NicConfig The IP4 configure data to write.
69
70 @retval EFI_SUCCESS The variable is written to the NVRam.
71 @retval Others Failed to write the variable.
72
73 **/
74 EFI_STATUS
75 Ip4ConfigWriteVariable (
76 IN IP4_CONFIG_INSTANCE *Instance,
77 IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
78 );
79
80 /**
81 Reclaim Ip4Config Variables for NIC which has been removed from the platform.
82
83 **/
84 VOID
85 Ip4ConfigReclaimVariable (
86 VOID
87 );
88
89 /**
90 Fix the RouteTable pointer in an EFI_IP4_IPCONFIG_DATA structure.
91
92 The pointer is set to be immediately follow the ConfigData if there're entries
93 in the RouteTable. Otherwise it is set to NULL.
94
95 @param ConfigData The IP4 IP configure data.
96
97 **/
98 VOID
99 Ip4ConfigFixRouteTablePointer (
100 IN OUT EFI_IP4_IPCONFIG_DATA *ConfigData
101 );
102
103 #endif
104