1 /** @file 2 This file provides a definition of the EFI IPv6 Configuration 3 Protocol. 4 5 Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at<BR> 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 #ifndef __EFI_IP6CONFIG_PROTOCOL_H__ 16 #define __EFI_IP6CONFIG_PROTOCOL_H__ 17 18 #include <Protocol/Ip6.h> 19 20 #define EFI_IP6_CONFIG_PROTOCOL_GUID \ 21 { \ 22 0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ 23 } 24 25 typedef struct _EFI_IP6_CONFIG_PROTOCOL EFI_IP6_CONFIG_PROTOCOL; 26 27 /// 28 /// EFI_IP6_CONFIG_DATA_TYPE 29 /// 30 typedef enum { 31 /// 32 /// The interface information of the communication 33 /// device this EFI IPv6 Configuration Protocol instance manages. 34 /// This type of data is read only.The corresponding Data is of type 35 /// EFI_IP6_CONFIG_INTERFACE_INFO. 36 /// 37 Ip6ConfigDataTypeInterfaceInfo, 38 /// 39 /// The alternative interface ID for the 40 /// communication device this EFI IPv6 Configuration Protocol 41 /// instance manages if the link local IPv6 address generated from 42 /// the interfaced ID based on the default source the EFI IPv6 43 /// Protocol uses is a duplicate address. The length of the interface 44 /// ID is 64 bit. The corresponding Data is of type 45 /// EFI_IP6_CONFIG_INTERFACE_ID. 46 /// 47 Ip6ConfigDataTypeAltInterfaceId, 48 /// 49 /// The general configuration policy for the EFI IPv6 network 50 /// stack running on the communication device this EFI IPv6 51 /// Configuration Protocol instance manages. The policy will affect 52 /// other configuration settings. The corresponding Data is of type 53 /// EFI_IP6_CONFIG_POLICY. 54 /// 55 Ip6ConfigDataTypePolicy, 56 /// 57 /// The number of consecutive 58 /// Neighbor Solicitation messages sent while performing Duplicate 59 /// Address Detection on a tentative address. A value of zero 60 /// indicates that Duplicate Address Detection will not be performed 61 /// on tentative addresses. The corresponding Data is of type 62 /// EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS. 63 /// 64 Ip6ConfigDataTypeDupAddrDetectTransmits, 65 /// 66 /// The station addresses set manually for the EFI 67 /// IPv6 network stack. It is only configurable when the policy is 68 /// Ip6ConfigPolicyManual. The corresponding Data is a 69 /// pointer to an array of EFI_IPv6_ADDRESS instances. 70 /// 71 Ip6ConfigDataTypeManualAddress, 72 /// 73 /// The gateway addresses set manually for the EFI IPv6 74 /// network stack running on the communication device this EFI 75 /// IPv6 Configuration Protocol manages. It is not configurable when 76 /// the policy is Ip6ConfigPolicyAutomatic. The gateway 77 /// addresses must be unicast IPv6 addresses. The corresponding 78 /// Data is a pointer to an array of EFI_IPv6_ADDRESS instances. 79 /// 80 Ip6ConfigDataTypeGateway, 81 /// 82 /// The DNS server list for the EFI IPv6 network stack 83 /// running on the communication device this EFI IPv6 84 /// Configuration Protocol manages. It is not configurable when the 85 /// policy is Ip6ConfigPolicyAutomatic.The DNS server 86 /// addresses must be unicast IPv6 addresses. The corresponding 87 /// Data is a pointer to an array of EFI_IPv6_ADDRESS instances. 88 /// 89 Ip6ConfigDataTypeDnsServer, 90 /// 91 /// The number of this enumeration memebers. 92 /// 93 Ip6ConfigDataTypeMaximum 94 } EFI_IP6_CONFIG_DATA_TYPE; 95 96 /// 97 /// EFI_IP6_CONFIG_INTERFACE_INFO 98 /// describes the operational state of the interface this 99 /// EFI IPv6 Configuration Protocol instance manages. 100 /// 101 typedef struct { 102 /// 103 /// The name of the interface. It is a NULL-terminated string. 104 /// 105 CHAR16 Name[32]; 106 /// 107 /// The interface type of the network interface. 108 /// 109 UINT8 IfType; 110 /// 111 /// The size, in bytes, of the network interface's hardware address. 112 /// 113 UINT32 HwAddressSize; 114 /// 115 /// The hardware address for the network interface. 116 /// 117 EFI_MAC_ADDRESS HwAddress; 118 /// 119 /// Number of EFI_IP6_ADDRESS_INFO structures pointed to by AddressInfo. 120 /// 121 UINT32 AddressInfoCount; 122 /// 123 /// Pointer to an array of EFI_IP6_ADDRESS_INFO instances 124 /// which contain the local IPv6 addresses and the corresponding 125 /// prefix length information. Set to NULL if AddressInfoCount 126 /// is zero. 127 /// 128 EFI_IP6_ADDRESS_INFO *AddressInfo; 129 /// 130 /// Number of route table entries in the following RouteTable. 131 /// 132 UINT32 RouteCount; 133 /// 134 /// The route table of the IPv6 network stack runs on this interface. 135 /// Set to NULL if RouteCount is zero. 136 /// 137 EFI_IP6_ROUTE_TABLE *RouteTable; 138 } EFI_IP6_CONFIG_INTERFACE_INFO; 139 140 /// 141 /// EFI_IP6_CONFIG_INTERFACE_ID 142 /// describes the 64-bit interface ID. 143 /// 144 typedef struct { 145 UINT8 Id[8]; 146 } EFI_IP6_CONFIG_INTERFACE_ID; 147 148 /// 149 /// EFI_IP6_CONFIG_POLICY 150 /// defines the general configuration policy the EFI IPv6 151 /// Configuration Protocol supports. 152 /// 153 typedef enum { 154 /// 155 /// Under this policy, the IpI6ConfigDataTypeManualAddress, 156 /// Ip6ConfigDataTypeGateway and Ip6ConfigDataTypeDnsServer 157 /// configuration data are required to be set manually. 158 /// The EFI IPv6 Protocol will get all required configuration 159 /// such as address, prefix and gateway settings from the EFI 160 /// IPv6 Configuration protocol. 161 /// 162 Ip6ConfigPolicyManual, 163 /// 164 /// Under this policy, the IpI6ConfigDataTypeManualAddress, 165 /// Ip6ConfigDataTypeGateway and Ip6ConfigDataTypeDnsServer 166 /// configuration data are not allowed to set via SetData(). 167 /// All of these configurations are retrieved from some auto 168 /// configuration mechanism. 169 /// The EFI IPv6 Protocol will use the IPv6 stateless address 170 /// autoconfiguration mechanism and/or the IPv6 stateful address 171 /// autoconfiguration mechanism described in the related RFCs to 172 /// get address and other configuration information 173 /// 174 Ip6ConfigPolicyAutomatic 175 } EFI_IP6_CONFIG_POLICY; 176 177 /// 178 /// EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS 179 /// describes the number of consecutive Neighbor Solicitation messages sent 180 /// while performing Duplicate Address Detection on a tentative address. 181 /// The default value for a newly detected communication device is 1. 182 /// 183 typedef struct { 184 UINT32 DupAddrDetectTransmits; ///< The number of consecutive Neighbor Solicitation messages sent. 185 } EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS; 186 187 /// 188 /// EFI_IP6_CONFIG_MANUAL_ADDRESS 189 /// is used to set the station address information for the EFI IPv6 network 190 /// stack manually when the policy is Ip6ConfigPolicyManual. 191 /// 192 typedef struct { 193 EFI_IPv6_ADDRESS Address; ///< The IPv6 unicast address. 194 BOOLEAN IsAnycast; ///< Set to TRUE if Address is anycast. 195 UINT8 PrefixLength; ///< The length, in bits, of the prefix associated with this Address. 196 } EFI_IP6_CONFIG_MANUAL_ADDRESS; 197 198 199 /** 200 Set the configuration for the EFI IPv6 network stack running on the communication 201 device this EFI IPv6 Configuration Protocol instance manages. 202 203 This function is used to set the configuration data of type DataType for the EFI 204 IPv6 network stack running on the communication device this EFI IPv6 Configuration 205 Protocol instance manages. 206 207 The DataSize is used to calculate the count of structure instances in the Data for 208 some DataType that multiple structure instances are allowed. 209 210 This function is always non-blocking. When setting some type of configuration data, 211 an asynchronous process is invoked to check the correctness of the data, such as 212 doing Duplicate Address Detection on the manually set local IPv6 addresses. 213 EFI_NOT_READY is returned immediately to indicate that such an asynchronous process 214 is invoked and the process is not finished yet. The caller willing to get the result 215 of the asynchronous process is required to call RegisterDataNotify() to register an 216 event on the specified configuration data. Once the event is signaled, the caller 217 can call GetData() to get back the configuration data in order to know the result. 218 For other types of configuration data that do not require an asynchronous configuration 219 process, the result of the operation is immediately returned. 220 221 @param[in] This Pointer to the EFI_IP6_CONFIG_PROTOCOL instance. 222 @param[in] DataType The type of data to set. 223 @param[in] DataSize Size of the buffer pointed to by Data in bytes. 224 @param[in] Data The data buffer to set. The type of the data buffer is 225 associated with the DataType. 226 227 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6 228 network stack is set successfully. 229 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: 230 - This is NULL. 231 - Data is NULL. 232 - One or more fields in Data do not match the requirement of the 233 data type indicated by DataType. 234 @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified 235 configuration data can not be set under the current policy 236 @retval EFI_ACCESS_DENIED Another set operation on the specified configuration 237 data is already in process. 238 @retval EFI_NOT_READY An asynchronous process is invoked to set the specified 239 configuration data and the process is not finished yet. 240 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type 241 indicated by DataType. 242 @retval EFI_UNSUPPORTED This DataType is not supported. 243 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 244 @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. 245 246 **/ 247 typedef 248 EFI_STATUS 249 (EFIAPI *EFI_IP6_CONFIG_SET_DATA)( 250 IN EFI_IP6_CONFIG_PROTOCOL *This, 251 IN EFI_IP6_CONFIG_DATA_TYPE DataType, 252 IN UINTN DataSize, 253 IN VOID *Data 254 ); 255 256 /** 257 Get the configuration data for the EFI IPv6 network stack running on the communication 258 device this EFI IPv6 Configuration Protocol instance manages. 259 260 This function returns the configuration data of type DataType for the EFI IPv6 network 261 stack running on the communication device this EFI IPv6 Configuration Protocol instance 262 manages. 263 264 The caller is responsible for allocating the buffer used to return the specified 265 configuration data and the required size will be returned to the caller if the size of 266 the buffer is too small. 267 268 EFI_NOT_READY is returned if the specified configuration data is not ready due to an 269 already in progress asynchronous configuration process. The caller can call RegisterDataNotify() 270 to register an event on the specified configuration data. Once the asynchronous configuration 271 process is finished, the event will be signaled and a subsequent GetData() call will return 272 the specified configuration data. 273 274 @param[in] This Pointer to the EFI_IP6_CONFIG_PROTOCOL instance. 275 @param[in] DataType The type of data to get. 276 @param[in,out] DataSize On input, in bytes, the size of Data. On output, in bytes, the 277 size of buffer required to store the specified configuration data. 278 @param[in] Data The data buffer in which the configuration data is returned. The 279 type of the data buffer is associated with the DataType. 280 281 @retval EFI_SUCCESS The specified configuration data is got successfully. 282 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: 283 - This is NULL. 284 - DataSize is NULL. 285 - Data is NULL if *DataSize is not zero. 286 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data 287 and the required size is returned in DataSize. 288 @retval EFI_NOT_READY The specified configuration data is not ready due to an already in 289 progress asynchronous configuration process. 290 @retval EFI_NOT_FOUND The specified configuration data is not found. 291 292 **/ 293 typedef 294 EFI_STATUS 295 (EFIAPI *EFI_IP6_CONFIG_GET_DATA)( 296 IN EFI_IP6_CONFIG_PROTOCOL *This, 297 IN EFI_IP6_CONFIG_DATA_TYPE DataType, 298 IN OUT UINTN *DataSize, 299 IN VOID *Data OPTIONAL 300 ); 301 302 /** 303 Register an event that is to be signaled whenever a configuration process on the specified 304 configuration data is done. 305 306 This function registers an event that is to be signaled whenever a configuration process 307 on the specified configuration data is done. An event can be registered for different DataType 308 simultaneously and the caller is responsible for determining which type of configuration data 309 causes the signaling of the event in such case. 310 311 @param[in] This Pointer to the EFI_IP6_CONFIG_PROTOCOL instance. 312 @param[in] DataType The type of data to unregister the event for. 313 @param[in] Event The event to register. 314 315 @retval EFI_SUCCESS The notification event for the specified configuration data is 316 registered. 317 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. 318 @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not 319 supported. 320 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 321 @retval EFI_ACCESS_DENIED The Event is already registered for the DataType. 322 323 **/ 324 typedef 325 EFI_STATUS 326 (EFIAPI *EFI_IP6_CONFIG_REGISTER_NOTIFY)( 327 IN EFI_IP6_CONFIG_PROTOCOL *This, 328 IN EFI_IP6_CONFIG_DATA_TYPE DataType, 329 IN EFI_EVENT Event 330 ); 331 332 /** 333 Remove a previously registered event for the specified configuration data. 334 335 This function removes a previously registered event for the specified configuration data. 336 337 @param[in] This Pointer to the EFI_IP6_CONFIG_PROTOCOL instance. 338 @param[in] DataType The type of data to remove the previously registered event for. 339 @param[in] Event The event to unregister. 340 341 @retval EFI_SUCCESS The event registered for the specified configuration data is removed. 342 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. 343 @retval EFI_NOT_FOUND The Event has not been registered for the specified 344 DataType. 345 346 **/ 347 typedef 348 EFI_STATUS 349 (EFIAPI *EFI_IP6_CONFIG_UNREGISTER_NOTIFY)( 350 IN EFI_IP6_CONFIG_PROTOCOL *This, 351 IN EFI_IP6_CONFIG_DATA_TYPE DataType, 352 IN EFI_EVENT Event 353 ); 354 355 /// 356 /// The EFI_IP6_CONFIG_PROTOCOL provides the mechanism to set and get various 357 /// types of configurations for the EFI IPv6 network stack. 358 /// 359 struct _EFI_IP6_CONFIG_PROTOCOL { 360 EFI_IP6_CONFIG_SET_DATA SetData; 361 EFI_IP6_CONFIG_GET_DATA GetData; 362 EFI_IP6_CONFIG_REGISTER_NOTIFY RegisterDataNotify; 363 EFI_IP6_CONFIG_UNREGISTER_NOTIFY UnregisterDataNotify; 364 }; 365 366 extern EFI_GUID gEfiIp6ConfigProtocolGuid; 367 368 #endif 369 370