]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Ip4Config.h
ac04db3fc2ade72c7fb69b635a1186cfc1c3cf17
[mirror_edk2.git] / MdePkg / Include / Protocol / Ip4Config.h
1 /** @file
2 This file provides a definition of the EFI IPv4 Configuration
3 Protocol.
4
5 Copyright (c) 2006 - 2008, Intel Corporation.<BR>
6 All rights reserved. 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_IP4CONFIG_PROTOCOL_H__
16 #define __EFI_IP4CONFIG_PROTOCOL_H__
17
18 #include <Protocol/Ip4.h>
19
20 #define EFI_IP4_CONFIG_PROTOCOL_GUID \
21 { \
22 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } \
23 }
24
25 typedef struct _EFI_IP4_CONFIG_PROTOCOL EFI_IP4_CONFIG_PROTOCOL;
26
27 #define IP4_CONFIG_VARIABLE_ATTRIBUTES \
28 (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | \
29 EFI_VARIABLE_RUNTIME_ACCESS)
30
31 ///
32 /// EFI_IP4_IPCONFIG_DATA contains the minimum IPv4 configuration data
33 /// that is needed to start basic network communication. The StationAddress
34 /// and SubnetMask must be a valid unicast IP address and subnet mask.
35 /// If RouteTableSize is not zero, then RouteTable contains a properly
36 /// formatted routing table for the StationAddress/SubnetMask, with the
37 /// last entry in the table being the default route.
38 ///
39 typedef struct {
40 ///
41 /// Default station IP address, stored in network byte order.
42 ///
43 EFI_IPv4_ADDRESS StationAddress;
44 ///
45 /// Default subnet mask, stored in network byte order.
46 ///
47 EFI_IPv4_ADDRESS SubnetMask;
48 ///
49 /// Number of entries in the following RouteTable. May be zero.
50 ///
51 UINT32 RouteTableSize;
52 ///
53 /// Default routing table data (stored in network byte order).
54 /// Ignored if RouteTableSize is zero.
55 ///
56 EFI_IP4_ROUTE_TABLE *RouteTable;
57 } EFI_IP4_IPCONFIG_DATA;
58
59
60 /**
61 Starts running the configuration policy for the EFI IPv4 Protocol driver.
62
63 The Start() function is called to determine and to begin the platform
64 configuration policy by the EFI IPv4 Protocol driver. This determination may
65 be as simple as returning EFI_UNSUPPORTED if there is no EFI IPv4 Protocol
66 driver configuration policy. It may be as involved as loading some defaults
67 from nonvolatile storage, downloading dynamic data from a DHCP server, and
68 checking permissions with a site policy server.
69 Starting the configuration policy is just the beginning. It may finish almost
70 instantly or it may take several minutes before it fails to retrieve configuration
71 information from one or more servers. Once the policy is started, drivers
72 should use the DoneEvent parameter to determine when the configuration policy
73 has completed. EFI_IP4_CONFIG_PROTOCOL.GetData() must then be called to
74 determine if the configuration succeeded or failed.
75 Until the configuration completes successfully, EFI IPv4 Protocol driver instances
76 that are attempting to use default configurations must return EFI_NO_MAPPING.
77 Once the configuration is complete, the EFI IPv4 Configuration Protocol driver
78 signals DoneEvent. The configuration may need to be updated in the future,
79 however; in this case, the EFI IPv4 Configuration Protocol driver must signal
80 ReconfigEvent, and all EFI IPv4 Protocol driver instances that are using default
81 configurations must return EFI_NO_MAPPING until the configuration policy has
82 been rerun.
83
84 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
85 @param DoneEvent Event that will be signaled when the EFI IPv4
86 Protocol driver configuration policy completes
87 execution. This event must be of type EVT_NOTIFY_SIGNAL.
88 @param ReconfigEvent Event that will be signaled when the EFI IPv4
89 Protocol driver configuration needs to be updated.
90 This event must be of type EVT_NOTIFY_SIGNAL.
91
92 @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol
93 driver is now running.
94 @retval EFI_INVALID_PARAMETER One or more of the following parameters is NULL:
95 This
96 DoneEvent
97 ReconfigEvent
98 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
99 @retval EFI_ALREADY_STARTED The configuration policy for the EFI IPv4 Protocol
100 driver was already started.
101 @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.
102 @retval EFI_UNSUPPORTED This interface does not support the EFI IPv4 Protocol
103 driver configuration.
104
105 **/
106 typedef
107 EFI_STATUS
108 (EFIAPI *EFI_IP4_CONFIG_START)(
109 IN EFI_IP4_CONFIG_PROTOCOL *This,
110 IN EFI_EVENT DoneEvent,
111 IN EFI_EVENT ReconfigEvent
112 );
113
114 /**
115 Stops running the configuration policy for the EFI IPv4 Protocol driver.
116
117 The Stop() function stops the configuration policy for the EFI IPv4 Protocol driver.
118 All configuration data will be lost after calling Stop().
119
120 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
121
122 @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol
123 driver has been stopped.
124 @retval EFI_INVALID_PARAMETER This is NULL.
125 @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
126 driver was not started.
127
128 **/
129 typedef
130 EFI_STATUS
131 (EFIAPI *EFI_IP4_CONFIG_STOP)(
132 IN EFI_IP4_CONFIG_PROTOCOL *This
133 );
134
135 /**
136 Returns the default configuration data (if any) for the EFI IPv4 Protocol driver.
137
138 The GetData() function returns the current configuration data for the EFI IPv4
139 Protocol driver after the configuration policy has completed.
140
141 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
142 @param IpConfigDataSize On input, the size of the IpConfigData buffer.
143 On output, the count of bytes that were written
144 into the IpConfigData buffer.
145 @param IpConfigData Pointer to the EFI IPv4 Configuration Protocol
146 driver configuration data structure.
147 Type EFI_IP4_IPCONFIG_DATA is defined in
148 "Related Definitions" below.
149
150 @retval EFI_SUCCESS The EFI IPv4 Protocol driver configuration has been returned.
151 @retval EFI_INVALID_PARAMETER This is NULL.
152 @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
153 driver is not running.
154 @retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running.
155 @retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete.
156 @retval EFI_BUFFER_TOO_SMALL *IpConfigDataSize is smaller than the configuration
157 data buffer or IpConfigData is NULL.
158
159 **/
160 typedef
161 EFI_STATUS
162 (EFIAPI *EFI_IP4_CONFIG_GET_DATA)(
163 IN EFI_IP4_CONFIG_PROTOCOL *This,
164 IN OUT UINTN *IpConfigDataSize,
165 OUT EFI_IP4_IPCONFIG_DATA *IpConfigData OPTIONAL
166 );
167
168 ///
169 /// The EFI_IP4_CONFIG_PROTOCOL driver performs platform- and policy-dependent
170 /// configuration for the EFI IPv4 Protocol driver.
171 ///
172 struct _EFI_IP4_CONFIG_PROTOCOL {
173 EFI_IP4_CONFIG_START Start;
174 EFI_IP4_CONFIG_STOP Stop;
175 EFI_IP4_CONFIG_GET_DATA GetData;
176 };
177
178 extern EFI_GUID gEfiIp4ConfigProtocolGuid;
179
180 #endif