xref: /illumos-gate/usr/src/boot/efi/include/efitcp.h (revision 22028508)
1 #ifndef _EFI_TCP_H
2 #define _EFI_TCP_H
3 
4 /*++
5 Copyright (c) 2013  Intel Corporation
6 
7 --*/
8 
9 #define EFI_TCP4_SERVICE_BINDING_PROTOCOL \
10     { 0x00720665, 0x67eb, 0x4a99, {0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c,0x7c, 0xc9}}
11 
12 #define EFI_TCP4_PROTOCOL \
13     { 0x65530bc7, 0xa359, 0x410f, {0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62}}
14 
15 #define EFI_TCP6_SERVICE_BINDING_PROTOCOL \
16     { 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64}}
17 
18 #define EFI_TCP6_PROTOCOL \
19     { 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77}}
20 
21 INTERFACE_DECL(_EFI_TCP4);
22 INTERFACE_DECL(_EFI_TCP6);
23 
24 typedef struct {
25     BOOLEAN            UseDefaultAddress;
26     EFI_IPv4_ADDRESS   StationAddress;
27     EFI_IPv4_ADDRESS   SubnetMask;
28     UINT16             StationPort;
29     EFI_IPv4_ADDRESS   RemoteAddress;
30     UINT16             RemotePort;
31     BOOLEAN            ActiveFlag;
32 } EFI_TCP4_ACCESS_POINT;
33 
34 typedef struct {
35     UINT32             ReceiveBufferSize;
36     UINT32             SendBufferSize;
37     UINT32             MaxSynBackLog;
38     UINT32             ConnectionTimeout;
39     UINT32             DataRetries;
40     UINT32             FinTimeout;
41     UINT32             TimeWaitTimeout;
42     UINT32             KeepAliveProbes;
43     UINT32             KeepAliveTime;
44     UINT32             KeepAliveInterval;
45     BOOLEAN            EnableNagle;
46     BOOLEAN            EnableTimeStamp;
47     BOOLEAN            EnableWindowScaling;
48     BOOLEAN            EnableSelectiveAck;
49     BOOLEAN            EnablePAthMtuDiscovery;
50 } EFI_TCP4_OPTION;
51 
52 typedef struct {
53     // Receiving Filters
54     // I/O parameters
55     UINT8                 TypeOfService;
56     UINT8                 TimeToLive;
57 
58     // Access Point
59     EFI_TCP4_ACCESS_POINT AccessPoint;
60 
61     // TCP Control Options
62     EFI_TCP4_OPTION       *ControlOption;
63 } EFI_TCP4_CONFIG_DATA;
64 
65 typedef enum {
66     Tcp4StateClosed      = 0,
67     Tcp4StateListen      = 1,
68     Tcp4StateSynSent     = 2,
69     Tcp4StateSynReceived = 3,
70     Tcp4StateEstablished = 4,
71     Tcp4StateFinWait1    = 5,
72     Tcp4StateFinWait2    = 6,
73     Tcp4StateClosing     = 7,
74     Tcp4StateTimeWait    = 8,
75     Tcp4StateCloseWait   = 9,
76     Tcp4StateLastAck     = 10
77 } EFI_TCP4_CONNECTION_STATE;
78 
79 typedef
80 EFI_STATUS
81 (EFIAPI *EFI_TCP4_GET_MODE_DATA) (
82     IN struct _EFI_TCP4                 *This,
83     OUT EFI_TCP4_CONNECTION_STATE       *Tcp4State      OPTIONAL,
84     OUT EFI_TCP4_CONFIG_DATA            *Tcp4ConfigData OPTIONAL,
85     OUT EFI_IP4_MODE_DATA               *Ip4ModeData    OPTIONAL,
86     OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL,
87     OUT EFI_SIMPLE_NETWORK_MODE         *SnpModeData    OPTIONAL
88     );
89 
90 typedef
91 EFI_STATUS
92 (EFIAPI *EFI_TCP4_CONFIGURE) (
93     IN struct _EFI_TCP4     *This,
94     IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
95     );
96 
97 typedef
98 EFI_STATUS
99 (EFIAPI *EFI_TCP4_ROUTES) (
100     IN struct _EFI_TCP4 *This,
101     IN BOOLEAN          DeleteRoute,
102     IN EFI_IPv4_ADDRESS *SubnetAddress,
103     IN EFI_IPv4_ADDRESS *SubnetMask,
104     IN EFI_IPv4_ADDRESS *GatewayAddress
105 );
106 
107 typedef struct {
108     EFI_EVENT  Event;
109     EFI_STATUS Status;
110 } EFI_TCP4_COMPLETION_TOKEN;
111 
112 typedef struct {
113     EFI_TCP4_COMPLETION_TOKEN CompletionToken;
114 } EFI_TCP4_CONNECTION_TOKEN;
115 
116 typedef
117 EFI_STATUS
118 (EFIAPI *EFI_TCP4_CONNECT) (
119     IN struct _EFI_TCP4          *This,
120     IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
121     );
122 
123 typedef struct {
124     EFI_TCP4_COMPLETION_TOKEN CompletionToken;
125     EFI_HANDLE                NewChildHandle;
126 } EFI_TCP4_LISTEN_TOKEN;
127 
128 typedef
129 EFI_STATUS
130 (EFIAPI *EFI_TCP4_ACCEPT) (
131     IN struct _EFI_TCP4      *This,
132     IN EFI_TCP4_LISTEN_TOKEN *ListenToken
133     );
134 
135 #define EFI_CONNECTION_FIN     EFIERR(104)
136 #define EFI_CONNECTION_RESET   EFIERR(105)
137 #define EFI_CONNECTION_REFUSED EFIERR(106)
138 
139 typedef struct {
140     UINT32 FragmentLength;
141     VOID   *FragmentBuffer;
142 } EFI_TCP4_FRAGMENT_DATA;
143 
144 typedef struct {
145     BOOLEAN                UrgentFlag;
146     UINT32                 DataLength;
147     UINT32                 FragmentCount;
148     EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
149 } EFI_TCP4_RECEIVE_DATA;
150 
151 typedef struct {
152     BOOLEAN                Push;
153     BOOLEAN                Urgent;
154     UINT32                 DataLength;
155     UINT32                 FragmentCount;
156     EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
157 } EFI_TCP4_TRANSMIT_DATA;
158 
159 typedef struct {
160     EFI_TCP4_COMPLETION_TOKEN  CompletionToken;
161     union {
162 	EFI_TCP4_RECEIVE_DATA  *RxData;
163 	EFI_TCP4_TRANSMIT_DATA *TxData;
164     }                          Packet;
165 } EFI_TCP4_IO_TOKEN;
166 
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_TCP4_TRANSMIT) (
170     IN struct _EFI_TCP4  *This,
171     IN EFI_TCP4_IO_TOKEN *Token
172     );
173 
174 typedef
175 EFI_STATUS
176 (EFIAPI *EFI_TCP4_RECEIVE) (
177     IN struct _EFI_TCP4  *This,
178     IN EFI_TCP4_IO_TOKEN *Token
179     );
180 
181 typedef struct {
182     EFI_TCP4_COMPLETION_TOKEN CompletionToken;
183     BOOLEAN                   AbortOnClose;
184 } EFI_TCP4_CLOSE_TOKEN;
185 
186 typedef
187 EFI_STATUS
188 (EFIAPI *EFI_TCP4_CLOSE)(
189     IN struct _EFI_TCP4     *This,
190     IN EFI_TCP4_CLOSE_TOKEN *CloseToken
191     );
192 
193 typedef
194 EFI_STATUS
195 (EFIAPI *EFI_TCP4_CANCEL)(
196     IN struct _EFI_TCP4 *This,
197     IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
198 );
199 
200 typedef
201 EFI_STATUS
202 (EFIAPI *EFI_TCP4_POLL) (
203     IN struct _EFI_TCP4 *This
204     );
205 
206 typedef struct _EFI_TCP4 {
207     EFI_TCP4_GET_MODE_DATA GetModeData;
208     EFI_TCP4_CONFIGURE     Configure;
209     EFI_TCP4_ROUTES        Routes;
210     EFI_TCP4_CONNECT       Connect;
211     EFI_TCP4_ACCEPT        Accept;
212     EFI_TCP4_TRANSMIT      Transmit;
213     EFI_TCP4_RECEIVE       Receive;
214     EFI_TCP4_CLOSE         Close;
215     EFI_TCP4_CANCEL        Cancel;
216     EFI_TCP4_POLL          Poll;
217 } EFI_TCP4;
218 
219 typedef enum {
220     Tcp6StateClosed      = 0,
221     Tcp6StateListen      = 1,
222     Tcp6StateSynSent     = 2,
223     Tcp6StateSynReceived = 3,
224     Tcp6StateEstablished = 4,
225     Tcp6StateFinWait1    = 5,
226     Tcp6StateFinWait2    = 6,
227     Tcp6StateClosing     = 7,
228     Tcp6StateTimeWait    = 8,
229     Tcp6StateCloseWait   = 9,
230     Tcp6StateLastAck     = 10
231 } EFI_TCP6_CONNECTION_STATE;
232 
233 typedef struct {
234     EFI_IPv6_ADDRESS StationAddress;
235     UINT16           StationPort;
236     EFI_IPv6_ADDRESS RemoteAddress;
237     UINT16           RemotePort;
238     BOOLEAN          ActiveFlag;
239 } EFI_TCP6_ACCESS_POINT;
240 
241 typedef struct {
242     UINT32             ReceiveBufferSize;
243     UINT32             SendBufferSize;
244     UINT32             MaxSynBackLog;
245     UINT32             ConnectionTimeout;
246     UINT32             DataRetries;
247     UINT32             FinTimeout;
248     UINT32             TimeWaitTimeout;
249     UINT32             KeepAliveProbes;
250     UINT32             KeepAliveTime;
251     UINT32             KeepAliveInterval;
252     BOOLEAN            EnableNagle;
253     BOOLEAN            EnableTimeStamp;
254     BOOLEAN            EnableWindbowScaling;
255     BOOLEAN            EnableSelectiveAck;
256     BOOLEAN            EnablePathMtuDiscovery;
257 } EFI_TCP6_OPTION;
258 
259 typedef struct {
260     UINT8                 TrafficClass;
261     UINT8                 HopLimit;
262     EFI_TCP6_ACCESS_POINT AccessPoint;
263     EFI_TCP6_OPTION       *ControlOption;
264 } EFI_TCP6_CONFIG_DATA;
265 
266 typedef
267 EFI_STATUS
268 (EFIAPI *EFI_TCP6_GET_MODE_DATA) (
269     IN struct _EFI_TCP6                 *This,
270     OUT EFI_TCP6_CONNECTION_STATE       *Tcp6State      OPTIONAL,
271     OUT EFI_TCP6_CONFIG_DATA            *Tcp6ConfigData OPTIONAL,
272     OUT EFI_IP6_MODE_DATA               *Ip6ModeData    OPTIONAL,
273     OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL,
274     OUT EFI_SIMPLE_NETWORK_MODE         *SnpModeData    OPTIONAL
275     );
276 
277 typedef
278 EFI_STATUS
279 (EFIAPI *EFI_TCP6_CONFIGURE) (
280     IN struct _EFI_TCP6     *This,
281     IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
282     );
283 
284 typedef struct {
285     EFI_EVENT  Event;
286     EFI_STATUS Status;
287 } EFI_TCP6_COMPLETION_TOKEN;
288 
289 typedef struct {
290     EFI_TCP6_COMPLETION_TOKEN CompletionToken;
291 } EFI_TCP6_CONNECTION_TOKEN;
292 
293 typedef
294 EFI_STATUS
295 (EFIAPI *EFI_TCP6_CONNECT) (
296     IN struct _EFI_TCP6          *This,
297     IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
298     );
299 
300 typedef struct {
301     EFI_TCP6_COMPLETION_TOKEN CompletionToken;
302     EFI_HANDLE                NewChildHandle;
303 } EFI_TCP6_LISTEN_TOKEN;
304 
305 typedef
306 EFI_STATUS
307 (EFIAPI *EFI_TCP6_ACCEPT) (
308     IN struct _EFI_TCP6      *This,
309     IN EFI_TCP6_LISTEN_TOKEN *ListenToken
310     );
311 
312 typedef struct {
313     UINT32 FragmentLength;
314     VOID   *FragmentBuffer;
315 } EFI_TCP6_FRAGMENT_DATA;
316 
317 typedef struct {
318     BOOLEAN                UrgentFlag;
319     UINT32                 DataLength;
320     UINT32                 FragmentCount;
321     EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
322 } EFI_TCP6_RECEIVE_DATA;
323 
324 typedef struct {
325     BOOLEAN                Push;
326     BOOLEAN                Urgent;
327     UINT32                 DataLength;
328     UINT32                 FragmentCount;
329     EFI_TCP6_FRAGMENT_DATA FragmentTable[1];
330 } EFI_TCP6_TRANSMIT_DATA;
331 
332 typedef struct {
333     EFI_TCP6_COMPLETION_TOKEN  CompletionToken;
334     union {
335 	EFI_TCP6_RECEIVE_DATA  *RxData;
336 	EFI_TCP6_TRANSMIT_DATA *TxData;
337     }                          Packet;
338 } EFI_TCP6_IO_TOKEN;
339 
340 typedef
341 EFI_STATUS
342 (EFIAPI *EFI_TCP6_TRANSMIT) (
343     IN struct _EFI_TCP6  *This,
344     IN EFI_TCP6_IO_TOKEN *Token
345     );
346 
347 typedef
348 EFI_STATUS
349 (EFIAPI *EFI_TCP6_RECEIVE) (
350     IN struct _EFI_TCP6  *This,
351     IN EFI_TCP6_IO_TOKEN *Token
352     );
353 
354 typedef struct {
355     EFI_TCP6_COMPLETION_TOKEN CompletionToken;
356     BOOLEAN                   AbortOnClose;
357 } EFI_TCP6_CLOSE_TOKEN;
358 
359 typedef
360 EFI_STATUS
361 (EFIAPI *EFI_TCP6_CLOSE)(
362     IN struct _EFI_TCP6     *This,
363     IN EFI_TCP6_CLOSE_TOKEN *CloseToken
364     );
365 
366 typedef
367 EFI_STATUS
368 (EFIAPI *EFI_TCP6_CANCEL)(
369     IN struct _EFI_TCP6          *This,
370     IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
371     );
372 
373 typedef
374 EFI_STATUS
375 (EFIAPI *EFI_TCP6_POLL) (
376     IN struct _EFI_TCP6 *This
377     );
378 
379 typedef struct _EFI_TCP6 {
380     EFI_TCP6_GET_MODE_DATA GetModeData;
381     EFI_TCP6_CONFIGURE     Configure;
382     EFI_TCP6_CONNECT       Connect;
383     EFI_TCP6_ACCEPT        Accept;
384     EFI_TCP6_TRANSMIT      Transmit;
385     EFI_TCP6_RECEIVE       Receive;
386     EFI_TCP6_CLOSE         Close;
387     EFI_TCP6_CANCEL        Cancel;
388     EFI_TCP6_POLL          Poll;
389 } EFI_TCP6;
390 
391 #endif /* _EFI_TCP_H */
392