]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
2 | \r | |
7659d0c9 | 3 | Copyright (c) 2006 - 2008, Intel Corporation \r |
83cbd279 | 4 | All rights reserved. This program and the accompanying materials\r |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | NicIp4Variable.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Routines used to operate the Ip4 configure variable\r | |
19 | \r | |
20 | \r | |
21 | **/\r | |
22 | \r | |
23 | #ifndef _NIC_IP4_VARIABLE_H_\r | |
24 | #define _NIC_IP4_VARIABLE_H_\r | |
25 | \r | |
26 | \r | |
27 | #include <Protocol/NicIp4Config.h>\r | |
28 | \r | |
29 | //\r | |
30 | // Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.\r | |
31 | // They are of variable size\r | |
32 | //\r | |
33 | #define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \\r | |
34 | (sizeof (EFI_IP4_IPCONFIG_DATA) + \\r | |
7659d0c9 | 35 | sizeof (EFI_IP4_ROUTE_TABLE) * (Ip4Config)->RouteTableSize)\r |
83cbd279 | 36 | \r |
37 | #define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \\r | |
38 | (sizeof (NIC_IP4_CONFIG_INFO) + \\r | |
7659d0c9 | 39 | sizeof (EFI_IP4_ROUTE_TABLE) * (NicConfig)->Ip4Info.RouteTableSize)\r |
83cbd279 | 40 | \r |
41 | //\r | |
42 | // Compare whether two NIC address are equal includes their type and length.\r | |
43 | //\r | |
44 | #define NIC_ADDR_EQUAL(Nic1, Nic2) \\r | |
45 | (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \\r | |
46 | NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))\r | |
47 | \r | |
7bce0c5a | 48 | /**\r |
49 | Check whether the configure parameter is valid.\r | |
50 | \r | |
51 | @param NicConfig The configure parameter to check\r | |
52 | \r | |
53 | @return TRUE if the parameter is valid for the interface, otherwise FALSE.\r | |
54 | \r | |
55 | **/\r | |
83cbd279 | 56 | BOOLEAN\r |
57 | Ip4ConfigIsValid (\r | |
58 | IN NIC_IP4_CONFIG_INFO *NicConfig\r | |
59 | );\r | |
60 | \r | |
7bce0c5a | 61 | /**\r |
62 | Read the ip4 configure variable from the EFI variable.\r | |
63 | \r | |
64 | None\r | |
65 | \r | |
66 | @return The IP4 configure read if it is there and is valid, otherwise NULL\r | |
67 | \r | |
68 | **/\r | |
83cbd279 | 69 | IP4_CONFIG_VARIABLE *\r |
70 | Ip4ConfigReadVariable (\r | |
71 | VOID\r | |
72 | );\r | |
73 | \r | |
7bce0c5a | 74 | /**\r |
75 | Write the IP4 configure variable to the NVRAM. If Config\r | |
76 | is NULL, remove the variable.\r | |
77 | \r | |
78 | @param Config The IP4 configure data to write\r | |
79 | \r | |
80 | @retval EFI_SUCCESS The variable is written to the NVRam\r | |
81 | @retval Others Failed to write the variable.\r | |
82 | \r | |
83 | **/\r | |
83cbd279 | 84 | EFI_STATUS\r |
85 | Ip4ConfigWriteVariable (\r | |
86 | IN IP4_CONFIG_VARIABLE *Config OPTIONAL\r | |
87 | );\r | |
88 | \r | |
7bce0c5a | 89 | /**\r |
90 | Locate the IP4 configure parameters from the variable.If a\r | |
91 | configuration is found, copy it to a newly allocated block\r | |
92 | of memory to avoid the alignment problem. Caller should\r | |
93 | release the memory after use.\r | |
94 | \r | |
95 | @param Variable The IP4 configure variable to search in\r | |
96 | @param NicAddr The interface address to check\r | |
97 | \r | |
98 | @return The point to the NIC's IP4 configure info if it is found\r | |
99 | @return in the IP4 variable, otherwise NULL.\r | |
100 | \r | |
101 | **/\r | |
83cbd279 | 102 | NIC_IP4_CONFIG_INFO *\r |
103 | Ip4ConfigFindNicVariable (\r | |
104 | IN IP4_CONFIG_VARIABLE *Variable,\r | |
105 | IN NIC_ADDR *NicAddr\r | |
106 | );\r | |
107 | \r | |
7bce0c5a | 108 | /**\r |
109 | Modify the configuration parameter for the NIC in the variable.\r | |
110 | If Config is NULL, old configuration will be remove from the new\r | |
111 | variable. Otherwise, append it or replace the old one.\r | |
112 | \r | |
113 | @param Variable The IP4 variable to change\r | |
114 | @param NicAddr The interface to search\r | |
115 | @param Config The new configuration parameter (NULL to remove the old)\r | |
116 | \r | |
117 | @return The new IP4_CONFIG_VARIABLE variable if the new variable has at\r | |
118 | @return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.\r | |
119 | @return Return NULL either because failed to locate memory for new variable\r | |
120 | @return or the only NIC configure is removed from the Variable.\r | |
121 | \r | |
122 | **/\r | |
83cbd279 | 123 | IP4_CONFIG_VARIABLE *\r |
124 | Ip4ConfigModifyVariable (\r | |
125 | IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL\r | |
126 | IN NIC_ADDR *NicAddr,\r | |
127 | IN NIC_IP4_CONFIG_INFO *Config OPTIONAL\r | |
128 | );\r | |
7659d0c9 | 129 | \r |
130 | VOID\r | |
131 | Ip4ConfigFixRouteTablePointer (\r | |
132 | IN EFI_IP4_IPCONFIG_DATA *ConfigData\r | |
133 | );\r | |
134 | \r | |
83cbd279 | 135 | #endif\r |