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