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