summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Protocol/Ip6Config.h
blob: b2c3be9ee7cf54e86757607642a23735d5ae46a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/** @file
  This file provides a definition of the EFI IPv6 Configuration
  Protocol.

Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at<BR>
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 __EFI_IP6CONFIG_PROTOCOL_H__
#define __EFI_IP6CONFIG_PROTOCOL_H__

#include <Protocol/Ip6.h>

#define EFI_IP6_CONFIG_PROTOCOL_GUID \
  { \
    0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
  }

typedef struct _EFI_IP6_CONFIG_PROTOCOL EFI_IP6_CONFIG_PROTOCOL;

///
/// EFI_IP6_CONFIG_DATA_TYPE
///
typedef enum {         
  /// 
  /// The interface information of the communication 
  /// device this EFI IPv6 Configuration Protocol instance manages. 
  /// This type of data is read only.The corresponding Data is of type 
  /// EFI_IP6_CONFIG_INTERFACE_INFO.
  /// 
  Ip6ConfigDataTypeInterfaceInfo,
  /// 
  /// The alternative interface ID for the 
  /// communication device this EFI IPv6 Configuration Protocol 
  /// instance manages if the link local IPv6 address generated from 
  /// the interfaced ID based on the default source the EFI IPv6 
  /// Protocol uses is a duplicate address. The length of the interface 
  /// ID is 64 bit. The corresponding Data is of type 
  /// EFI_IP6_CONFIG_INTERFACE_ID.
  /// 
  Ip6ConfigDataTypeAltInterfaceId,
  /// 
  /// The general configuration policy for the EFI IPv6 network 
  /// stack running on the communication device this EFI IPv6 
  /// Configuration Protocol instance manages. The policy will affect 
  /// other configuration settings. The corresponding Data is of type 
  /// EFI_IP6_CONFIG_POLICY.
  ///
  Ip6ConfigDataTypePolicy,
  /// 
  /// The number of consecutive 
  /// Neighbor Solicitation messages sent while performing Duplicate 
  /// Address Detection on a tentative address. A value of zero 
  /// indicates that Duplicate Address Detection will not be performed 
  /// on tentative addresses. The corresponding Data is of type 
  /// EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS.
  /// 
  Ip6ConfigDataTypeDupAddrDetectTransmits,
  /// 
  /// The station addresses set manually for the EFI 
  /// IPv6 network stack. It is only configurable when the policy is 
  /// Ip6ConfigPolicyManual. The corresponding Data is a 
  /// pointer to an array of EFI_IPv6_ADDRESS instances.
  /// 
  Ip6ConfigDataTypeManualAddress,
  /// 
  /// The gateway addresses set manually for the EFI IPv6 
  /// network stack running on the communication device this EFI 
  /// IPv6 Configuration Protocol manages. It is not configurable when 
  /// the policy is Ip6ConfigPolicyAutomatic. The gateway 
  /// addresses must be unicast IPv6 addresses. The corresponding 
  /// Data is a pointer to an array of EFI_IPv6_ADDRESS instances.
  /// 
  Ip6ConfigDataTypeGateway,
  /// 
  /// The DNS server list for the EFI IPv6 network stack 
  /// running on the communication device this EFI IPv6 
  /// Configuration Protocol manages. It is not configurable when the 
  /// policy is Ip6ConfigPolicyAutomatic.The DNS server 
  /// addresses must be unicast IPv6 addresses. The corresponding 
  /// Data is a pointer to an array of EFI_IPv6_ADDRESS instances.
  /// 
  Ip6ConfigDataTypeDnsServer,
  ///
  /// The number of this enumeration memebers.
  ///
  Ip6ConfigDataTypeMaximum
} EFI_IP6_CONFIG_DATA_TYPE;

///
/// EFI_IP6_CONFIG_INTERFACE_INFO
/// describes the operational state of the interface this 
/// EFI IPv6 Configuration Protocol instance manages.
///
typedef struct {
  ///
  /// The name of the interface. It is a NULL-terminated string.
  ///
  CHAR16                Name[32];
  /// 
  /// The interface type of the network interface.
  /// 
  UINT8                 IfType;
  /// 
  /// The size, in bytes, of the network interface's hardware address.
  /// 
  UINT32                HwAddressSize;
  /// 
  /// The hardware address for the network interface.
  /// 
  EFI_MAC_ADDRESS       HwAddress;
  /// 
  /// Number of EFI_IP6_ADDRESS_INFO structures pointed to by AddressInfo.
  /// 
  UINT32                AddressInfoCount;
  /// 
  /// Pointer to an array of EFI_IP6_ADDRESS_INFO instances 
  /// which contain the local IPv6 addresses and the corresponding 
  /// prefix length information. Set to NULL if AddressInfoCount 
  /// is zero.
  /// 
  EFI_IP6_ADDRESS_INFO  *AddressInfo;
  /// 
  /// Number of route table entries in the following RouteTable.
  /// 
  UINT32                RouteCount;
  /// 
  /// The route table of the IPv6 network stack runs on this interface. 
  /// Set to NULL if RouteCount is zero. 
  /// 
  EFI_IP6_ROUTE_TABLE   *RouteTable;
} EFI_IP6_CONFIG_INTERFACE_INFO;

///
/// EFI_IP6_CONFIG_INTERFACE_ID
/// describes the 64-bit interface ID.
///
typedef struct {
  UINT8                 Id[8];
} EFI_IP6_CONFIG_INTERFACE_ID;

///
/// EFI_IP6_CONFIG_POLICY
/// defines the general configuration policy the EFI IPv6 
/// Configuration Protocol supports.
///
typedef enum {
  ///
  /// Under this policy, the IpI6ConfigDataTypeManualAddress, 
  /// Ip6ConfigDataTypeGateway and Ip6ConfigDataTypeDnsServer
  /// configuration data are required to be set manually. 
  /// The EFI IPv6 Protocol will get all required configuration
  /// such as address, prefix and gateway settings from the EFI
  /// IPv6 Configuration protocol.
  ///
  Ip6ConfigPolicyManual,      
  /// 
  /// Under this policy, the IpI6ConfigDataTypeManualAddress, 
  /// Ip6ConfigDataTypeGateway and Ip6ConfigDataTypeDnsServer
  /// configuration data are not allowed to set via SetData().
  /// All of these configurations are retrieved from some auto
  /// configuration mechanism. 
  /// The EFI IPv6 Protocol will use the IPv6 stateless address 
  /// autoconfiguration mechanism and/or the IPv6 stateful address 
  /// autoconfiguration mechanism described in the related RFCs to 
  /// get address and other configuration information
  /// 
  Ip6ConfigPolicyAutomatic
} EFI_IP6_CONFIG_POLICY;

///
/// EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS
/// describes the number of consecutive Neighbor Solicitation messages sent
/// while performing Duplicate Address Detection on a tentative address. 
/// The default value for a newly detected communication device is 1.
///
typedef struct {
  UINT32    DupAddrDetectTransmits;  ///< The number of consecutive Neighbor Solicitation messages sent.
} EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS;           

///
/// EFI_IP6_CONFIG_MANUAL_ADDRESS
/// is used to set the station address information for the EFI IPv6 network
/// stack manually when the policy is Ip6ConfigPolicyManual.
///
typedef struct {
  EFI_IPv6_ADDRESS      Address;       ///< The IPv6 unicast address.
  BOOLEAN               IsAnycast;     ///< Set to TRUE if Address is anycast.
  UINT8                 PrefixLength;  ///< The length, in bits, of the prefix associated with this Address.
} EFI_IP6_CONFIG_MANUAL_ADDRESS;


/**
  Set the configuration for the EFI IPv6 network stack running on the communication
  device this EFI IPv6 Configuration Protocol instance manages.
  
  This function is used to set the configuration data of type DataType for the EFI 
  IPv6 network stack running on the communication device this EFI IPv6 Configuration
  Protocol instance manages.

  The DataSize is used to calculate the count of structure instances in the Data for 
  some DataType that multiple structure instances are allowed.
  
  This function is always non-blocking. When setting some type of configuration data,
  an asynchronous process is invoked to check the correctness of the data, such as 
  doing Duplicate Address Detection on the manually set local IPv6 addresses. 
  EFI_NOT_READY is returned immediately to indicate that such an asynchronous process
  is invoked and the process is not finished yet. The caller willing to get the result
  of the asynchronous process is required to call RegisterDataNotify() to register an
  event on the specified configuration data. Once the event is signaled, the caller 
  can call GetData() to get back the configuration data in order to know the result.
  For other types of configuration data that do not require an asynchronous configuration 
  process, the result of the operation is immediately returned.

  @param[in]     This           Pointer to the EFI_IP6_CONFIG_PROTOCOL instance.
  @param[in]     DataType       The type of data to set.  
  @param[in]     DataSize       Size of the buffer pointed to by Data in bytes.
  @param[in]     Data           The data buffer to set. The type of the data buffer is
                                associated with the DataType.
  
  @retval EFI_SUCCESS           The specified configuration data for the EFI IPv6 
                                network stack is set successfully.
  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
                                - This is NULL.
                                - Data is NULL.
                                - One or more fields in Data do not match the requirement of the 
                                  data type indicated by DataType. 
  @retval EFI_WRITE_PROTECTED   The specified configuration data is read-only or the specified 
                                configuration data can not be set under the current policy
  @retval EFI_ACCESS_DENIED     Another set operation on the specified configuration 
                                data is already in process.
  @retval EFI_NOT_READY         An asynchronous process is invoked to set the specified
                                configuration data and the process is not finished yet.
  @retval EFI_BAD_BUFFER_SIZE   The DataSize does not match the size of the type 
                                indicated by DataType.
  @retval EFI_UNSUPPORTED       This DataType is not supported.
  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
  @retval EFI_DEVICE_ERROR      An unexpected system error or network error occurred.
  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CONFIG_SET_DATA)(
  IN EFI_IP6_CONFIG_PROTOCOL    *This,
  IN EFI_IP6_CONFIG_DATA_TYPE   DataType,
  IN UINTN                      DataSize,
  IN VOID                       *Data
  );

/**
  Get the configuration data for the EFI IPv6 network stack running on the communication
  device this EFI IPv6 Configuration Protocol instance manages.
  
  This function returns the configuration data of type DataType for the EFI IPv6 network
  stack running on the communication device this EFI IPv6 Configuration Protocol instance
  manages.

  The caller is responsible for allocating the buffer used to return the specified
  configuration data and the required size will be returned to the caller if the size of
  the buffer is too small. 
  
  EFI_NOT_READY is returned if the specified configuration data is not ready due to an 
  already in progress asynchronous configuration process. The caller can call RegisterDataNotify()
  to register an event on the specified configuration data. Once the asynchronous configuration
  process is finished, the event will be signaled and a subsequent GetData() call will return 
  the specified configuration data.

  @param[in]     This           Pointer to the EFI_IP6_CONFIG_PROTOCOL instance.
  @param[in]     DataType       The type of data to get.  
  @param[in,out] DataSize       On input, in bytes, the size of Data. On output, in bytes, the 
                                size of buffer required to store the specified configuration data.
  @param[in]     Data           The data buffer in which the configuration data is returned. The 
                                type of the data buffer is associated with the DataType.
  
  @retval EFI_SUCCESS           The specified configuration data is got successfully.
  @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
                                - This is NULL.
                                - DataSize is NULL.
                                - Data is NULL if *DataSize is not zero.
  @retval EFI_BUFFER_TOO_SMALL  The size of Data is too small for the specified configuration data 
                                and the required size is returned in DataSize.
  @retval EFI_NOT_READY         The specified configuration data is not ready due to an already in 
                                progress asynchronous configuration process.
  @retval EFI_NOT_FOUND         The specified configuration data is not found.
  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CONFIG_GET_DATA)(
  IN EFI_IP6_CONFIG_PROTOCOL    *This,
  IN EFI_IP6_CONFIG_DATA_TYPE   DataType,
  IN OUT UINTN                  *DataSize,
  IN VOID                       *Data   OPTIONAL
  );

/**
  Register an event that is to be signaled whenever a configuration process on the specified
  configuration data is done.
  
  This function registers an event that is to be signaled whenever a configuration process
  on the specified configuration data is done. An event can be registered for different DataType
  simultaneously and the caller is responsible for determining which type of configuration data
  causes the signaling of the event in such case.

  @param[in]     This           Pointer to the EFI_IP6_CONFIG_PROTOCOL instance.
  @param[in]     DataType       The type of data to unregister the event for.  
  @param[in]     Event          The event to register. 
  
  @retval EFI_SUCCESS           The notification event for the specified configuration data is 
                                registered.
  @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
  @retval EFI_UNSUPPORTED       The configuration data type specified by DataType is not 
                                supported.
  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
  @retval EFI_ACCESS_DENIED     The Event is already registered for the DataType.
  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CONFIG_REGISTER_NOTIFY)(
  IN EFI_IP6_CONFIG_PROTOCOL    *This,
  IN EFI_IP6_CONFIG_DATA_TYPE   DataType,
  IN EFI_EVENT                  Event
  );

/**
  Remove a previously registered event for the specified configuration data.
  
  This function removes a previously registered event for the specified configuration data.

  @param[in]     This           Pointer to the EFI_IP6_CONFIG_PROTOCOL instance.
  @param[in]     DataType       The type of data to remove the previously registered event for.  
  @param[in]     Event          The event to unregister.
  
  @retval EFI_SUCCESS           The event registered for the specified configuration data is removed.
  @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
  @retval EFI_NOT_FOUND         The Event has not been registered for the specified 
                                DataType.
  
**/
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CONFIG_UNREGISTER_NOTIFY)(
  IN EFI_IP6_CONFIG_PROTOCOL    *This,
  IN EFI_IP6_CONFIG_DATA_TYPE   DataType,
  IN EFI_EVENT                  Event
  );

///
/// The EFI_IP6_CONFIG_PROTOCOL provides the mechanism to set and get various
/// types of configurations for the EFI IPv6 network stack.
///
struct _EFI_IP6_CONFIG_PROTOCOL {
  EFI_IP6_CONFIG_SET_DATA           SetData;
  EFI_IP6_CONFIG_GET_DATA           GetData;
  EFI_IP6_CONFIG_REGISTER_NOTIFY    RegisterDataNotify;
  EFI_IP6_CONFIG_UNREGISTER_NOTIFY  UnregisterDataNotify;
};

extern EFI_GUID gEfiIp6ConfigProtocolGuid;

#endif