1 | /** @file
|
---|
2 | Declaration of external functions shared in TCP driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
---|
5 | Copyright (c) Microsoft Corporation
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef _TCP_FUNC_H_
|
---|
11 | #define _TCP_FUNC_H_
|
---|
12 |
|
---|
13 | #include "TcpOption.h"
|
---|
14 |
|
---|
15 | #define TCP_COMP_VAL(Min, Max, Default, Val) \
|
---|
16 | ((((Val) <= (Max)) && ((Val) >= (Min))) ? (Val) : (Default))
|
---|
17 |
|
---|
18 | /**
|
---|
19 | Timeout handler prototype.
|
---|
20 |
|
---|
21 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
22 |
|
---|
23 | **/
|
---|
24 | typedef
|
---|
25 | VOID
|
---|
26 | (*TCP_TIMER_HANDLER) (
|
---|
27 | IN OUT TCP_CB *Tcb
|
---|
28 | );
|
---|
29 |
|
---|
30 | //
|
---|
31 | // Functions in TcpMisc.c
|
---|
32 | //
|
---|
33 |
|
---|
34 | /**
|
---|
35 | Initialize the Tcb locally related members.
|
---|
36 |
|
---|
37 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
38 |
|
---|
39 | @retval EFI_SUCCESS The operation completed successfully
|
---|
40 | @retval others The underlying functions failed and could not complete the operation
|
---|
41 |
|
---|
42 | **/
|
---|
43 | EFI_STATUS
|
---|
44 | TcpInitTcbLocal (
|
---|
45 | IN OUT TCP_CB *Tcb
|
---|
46 | );
|
---|
47 |
|
---|
48 | /**
|
---|
49 | Initialize the peer related members.
|
---|
50 |
|
---|
51 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
52 | @param[in] Seg Pointer to the segment that contains the peer's initial information.
|
---|
53 | @param[in] Opt Pointer to the options announced by the peer.
|
---|
54 |
|
---|
55 | **/
|
---|
56 | VOID
|
---|
57 | TcpInitTcbPeer (
|
---|
58 | IN OUT TCP_CB *Tcb,
|
---|
59 | IN TCP_SEG *Seg,
|
---|
60 | IN TCP_OPTION *Opt
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.
|
---|
65 |
|
---|
66 | @param[in] Addr Pointer to the IP address needs to match.
|
---|
67 | @param[in] Port The port number needs to match.
|
---|
68 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack.
|
---|
69 | IP_VERSION_6 indicates TCP is running on IP6 stack.
|
---|
70 |
|
---|
71 |
|
---|
72 | @retval TRUE The Tcb which matches the <Addr Port> pairs exists.
|
---|
73 | @retval FALSE Otherwise
|
---|
74 |
|
---|
75 | **/
|
---|
76 | BOOLEAN
|
---|
77 | TcpFindTcbByPeer (
|
---|
78 | IN EFI_IP_ADDRESS *Addr,
|
---|
79 | IN TCP_PORTNO Port,
|
---|
80 | IN UINT8 Version
|
---|
81 | );
|
---|
82 |
|
---|
83 | /**
|
---|
84 | Locate the TCP_CB related to the socket pair.
|
---|
85 |
|
---|
86 | @param[in] LocalPort The local port number.
|
---|
87 | @param[in] LocalIp The local IP address.
|
---|
88 | @param[in] RemotePort The remote port number.
|
---|
89 | @param[in] RemoteIp The remote IP address.
|
---|
90 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack,
|
---|
91 | IP_VERSION_6 indicates TCP is running on IP6 stack.
|
---|
92 | @param[in] Syn If TRUE, the listen sockets are searched.
|
---|
93 |
|
---|
94 | @return Pointer to the related TCP_CB. If NULL, no match is found.
|
---|
95 |
|
---|
96 | **/
|
---|
97 | TCP_CB *
|
---|
98 | TcpLocateTcb (
|
---|
99 | IN TCP_PORTNO LocalPort,
|
---|
100 | IN EFI_IP_ADDRESS *LocalIp,
|
---|
101 | IN TCP_PORTNO RemotePort,
|
---|
102 | IN EFI_IP_ADDRESS *RemoteIp,
|
---|
103 | IN UINT8 Version,
|
---|
104 | IN BOOLEAN Syn
|
---|
105 | );
|
---|
106 |
|
---|
107 | /**
|
---|
108 | Insert a Tcb into the proper queue.
|
---|
109 |
|
---|
110 | @param[in] Tcb Pointer to the TCP_CB to be inserted.
|
---|
111 |
|
---|
112 | @retval 0 The Tcb was inserted successfully.
|
---|
113 | @retval -1 An error condition occurred.
|
---|
114 |
|
---|
115 | **/
|
---|
116 | INTN
|
---|
117 | TcpInsertTcb (
|
---|
118 | IN TCP_CB *Tcb
|
---|
119 | );
|
---|
120 |
|
---|
121 | /**
|
---|
122 | Clone a TCP_CB from Tcb.
|
---|
123 |
|
---|
124 | @param[in] Tcb Pointer to the TCP_CB to be cloned.
|
---|
125 |
|
---|
126 | @return Pointer to the new cloned TCP_CB. If NULL, an error condition occurred.
|
---|
127 |
|
---|
128 | **/
|
---|
129 | TCP_CB *
|
---|
130 | TcpCloneTcb (
|
---|
131 | IN TCP_CB *Tcb
|
---|
132 | );
|
---|
133 |
|
---|
134 | /**
|
---|
135 | Get the local mss.
|
---|
136 |
|
---|
137 | @param[in] Sock Pointer to the socket to get mss.
|
---|
138 |
|
---|
139 | @return The mss size.
|
---|
140 |
|
---|
141 | **/
|
---|
142 | UINT16
|
---|
143 | TcpGetRcvMss (
|
---|
144 | IN SOCKET *Sock
|
---|
145 | );
|
---|
146 |
|
---|
147 | /**
|
---|
148 | Set the Tcb's state.
|
---|
149 |
|
---|
150 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
151 | @param[in] State The state to be set.
|
---|
152 |
|
---|
153 | **/
|
---|
154 | VOID
|
---|
155 | TcpSetState (
|
---|
156 | IN TCP_CB *Tcb,
|
---|
157 | IN UINT8 State
|
---|
158 | );
|
---|
159 |
|
---|
160 | /**
|
---|
161 | Compute the TCP segment's checksum.
|
---|
162 |
|
---|
163 | @param[in] Nbuf Pointer to the buffer that contains the TCP segment.
|
---|
164 | @param[in] HeadSum The checksum value of the fixed part of pseudo header.
|
---|
165 |
|
---|
166 | @return The checksum value.
|
---|
167 |
|
---|
168 | **/
|
---|
169 | UINT16
|
---|
170 | TcpChecksum (
|
---|
171 | IN NET_BUF *Nbuf,
|
---|
172 | IN UINT16 HeadSum
|
---|
173 | );
|
---|
174 |
|
---|
175 | /**
|
---|
176 | Translate the information from the head of the received TCP
|
---|
177 | segment Nbuf contains, and fill it into a TCP_SEG structure.
|
---|
178 |
|
---|
179 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
180 | @param[in, out] Nbuf Pointer to the buffer contains the TCP segment.
|
---|
181 |
|
---|
182 | @return Pointer to the TCP_SEG that contains the translated TCP head information.
|
---|
183 |
|
---|
184 | **/
|
---|
185 | TCP_SEG *
|
---|
186 | TcpFormatNetbuf (
|
---|
187 | IN TCP_CB *Tcb,
|
---|
188 | IN OUT NET_BUF *Nbuf
|
---|
189 | );
|
---|
190 |
|
---|
191 | /**
|
---|
192 | Initialize an active connection,
|
---|
193 |
|
---|
194 | @param[in, out] Tcb Pointer to the TCP_CB that wants to initiate a
|
---|
195 | connection.
|
---|
196 |
|
---|
197 | @retval EFI_SUCCESS The operation completed successfully
|
---|
198 | @retval others The underlying functions failed and could not complete the operation
|
---|
199 |
|
---|
200 | **/
|
---|
201 | EFI_STATUS
|
---|
202 | TcpOnAppConnect (
|
---|
203 | IN OUT TCP_CB *Tcb
|
---|
204 | );
|
---|
205 |
|
---|
206 | /**
|
---|
207 | Application has consumed some data, check whether
|
---|
208 | to send a window update ack or a delayed ack.
|
---|
209 |
|
---|
210 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
211 |
|
---|
212 | **/
|
---|
213 | VOID
|
---|
214 | TcpOnAppConsume (
|
---|
215 | IN TCP_CB *Tcb
|
---|
216 | );
|
---|
217 |
|
---|
218 | /**
|
---|
219 | Initiate the connection close procedure, called when
|
---|
220 | applications want to close the connection.
|
---|
221 |
|
---|
222 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
223 |
|
---|
224 | **/
|
---|
225 | VOID
|
---|
226 | TcpOnAppClose (
|
---|
227 | IN OUT TCP_CB *Tcb
|
---|
228 | );
|
---|
229 |
|
---|
230 | /**
|
---|
231 | Check whether the application's newly delivered data can be sent out.
|
---|
232 |
|
---|
233 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
234 |
|
---|
235 | @retval 0 The data has been sent out successfully.
|
---|
236 | @retval -1 The Tcb is not in a state that data is permitted to
|
---|
237 | be sent out.
|
---|
238 |
|
---|
239 | **/
|
---|
240 | INTN
|
---|
241 | TcpOnAppSend (
|
---|
242 | IN OUT TCP_CB *Tcb
|
---|
243 | );
|
---|
244 |
|
---|
245 | /**
|
---|
246 | Abort the connection by sending a reset segment: called
|
---|
247 | when the application wants to abort the connection.
|
---|
248 |
|
---|
249 | @param[in] Tcb Pointer to the TCP_CB of the TCP instance.
|
---|
250 |
|
---|
251 | **/
|
---|
252 | VOID
|
---|
253 | TcpOnAppAbort (
|
---|
254 | IN TCP_CB *Tcb
|
---|
255 | );
|
---|
256 |
|
---|
257 | /**
|
---|
258 | Reset the connection related with Tcb.
|
---|
259 |
|
---|
260 | @param[in] Tcb Pointer to the TCP_CB of the connection to be reset.
|
---|
261 |
|
---|
262 | **/
|
---|
263 | VOID
|
---|
264 | TcpResetConnection (
|
---|
265 | IN TCP_CB *Tcb
|
---|
266 | );
|
---|
267 |
|
---|
268 | /**
|
---|
269 | Install the device path protocol on the TCP instance.
|
---|
270 |
|
---|
271 | @param[in] Sock Pointer to the socket representing the TCP instance.
|
---|
272 |
|
---|
273 | @retval EFI_SUCCESS The device path protocol installed.
|
---|
274 | @retval other Failed to install the device path protocol.
|
---|
275 |
|
---|
276 | **/
|
---|
277 | EFI_STATUS
|
---|
278 | TcpInstallDevicePath (
|
---|
279 | IN SOCKET *Sock
|
---|
280 | );
|
---|
281 |
|
---|
282 | //
|
---|
283 | // Functions in TcpOutput.c
|
---|
284 | //
|
---|
285 |
|
---|
286 | /**
|
---|
287 | Compute the sequence space left in the old receive window.
|
---|
288 |
|
---|
289 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
290 |
|
---|
291 | @return The sequence space left in the old receive window.
|
---|
292 |
|
---|
293 | **/
|
---|
294 | UINT32
|
---|
295 | TcpRcvWinOld (
|
---|
296 | IN TCP_CB *Tcb
|
---|
297 | );
|
---|
298 |
|
---|
299 | /**
|
---|
300 | Compute the current receive window.
|
---|
301 |
|
---|
302 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
303 |
|
---|
304 | @return The size of the current receive window, in bytes.
|
---|
305 |
|
---|
306 | **/
|
---|
307 | UINT32
|
---|
308 | TcpRcvWinNow (
|
---|
309 | IN TCP_CB *Tcb
|
---|
310 | );
|
---|
311 |
|
---|
312 | /**
|
---|
313 | Get the maximum SndNxt.
|
---|
314 |
|
---|
315 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
316 |
|
---|
317 | @return The sequence number of the maximum SndNxt.
|
---|
318 |
|
---|
319 | **/
|
---|
320 | TCP_SEQNO
|
---|
321 | TcpGetMaxSndNxt (
|
---|
322 | IN TCP_CB *Tcb
|
---|
323 | );
|
---|
324 |
|
---|
325 | /**
|
---|
326 | Compute how much data to send.
|
---|
327 |
|
---|
328 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
329 | @param[in] Force If TRUE, ignore the sender's SWS avoidance algorithm
|
---|
330 | and send out data by force.
|
---|
331 |
|
---|
332 | @return The length of the data that can be sent. If 0, no data can be sent.
|
---|
333 |
|
---|
334 | **/
|
---|
335 | UINT32
|
---|
336 | TcpDataToSend (
|
---|
337 | IN TCP_CB *Tcb,
|
---|
338 | IN INTN Force
|
---|
339 | );
|
---|
340 |
|
---|
341 | /**
|
---|
342 | Retransmit the segment from sequence Seq.
|
---|
343 |
|
---|
344 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
345 | @param[in] Seq The sequence number of the segment to be retransmitted.
|
---|
346 |
|
---|
347 | @retval 0 The retransmission succeeded.
|
---|
348 | @retval -1 An error condition occurred.
|
---|
349 |
|
---|
350 | **/
|
---|
351 | INTN
|
---|
352 | TcpRetransmit (
|
---|
353 | IN TCP_CB *Tcb,
|
---|
354 | IN TCP_SEQNO Seq
|
---|
355 | );
|
---|
356 |
|
---|
357 | /**
|
---|
358 | Check whether to send data/SYN/FIN and piggyback an ACK.
|
---|
359 |
|
---|
360 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
361 | @param[in] Force If TRUE, ignore the sender's SWS avoidance algorithm
|
---|
362 | and send out data by force.
|
---|
363 |
|
---|
364 | @return The number of bytes sent.
|
---|
365 |
|
---|
366 | **/
|
---|
367 | INTN
|
---|
368 | TcpToSendData (
|
---|
369 | IN OUT TCP_CB *Tcb,
|
---|
370 | IN INTN Force
|
---|
371 | );
|
---|
372 |
|
---|
373 | /**
|
---|
374 | Check whether to send an ACK or delayed ACK.
|
---|
375 |
|
---|
376 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
377 |
|
---|
378 | **/
|
---|
379 | VOID
|
---|
380 | TcpToSendAck (
|
---|
381 | IN OUT TCP_CB *Tcb
|
---|
382 | );
|
---|
383 |
|
---|
384 | /**
|
---|
385 | Send an ACK immediately.
|
---|
386 |
|
---|
387 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
388 |
|
---|
389 | **/
|
---|
390 | VOID
|
---|
391 | TcpSendAck (
|
---|
392 | IN OUT TCP_CB *Tcb
|
---|
393 | );
|
---|
394 |
|
---|
395 | /**
|
---|
396 | Send a zero probe segment. It can be used by keepalive and zero window probe.
|
---|
397 |
|
---|
398 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
399 |
|
---|
400 | @retval 0 The zero probe segment was sent out successfully.
|
---|
401 | @retval other An error condition occurred.
|
---|
402 |
|
---|
403 | **/
|
---|
404 | INTN
|
---|
405 | TcpSendZeroProbe (
|
---|
406 | IN OUT TCP_CB *Tcb
|
---|
407 | );
|
---|
408 |
|
---|
409 | /**
|
---|
410 | Send a RESET segment in response to the segment received.
|
---|
411 |
|
---|
412 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance, may be NULL.
|
---|
413 | @param[in] Head TCP header of the segment that triggers the reset.
|
---|
414 | @param[in] Len Length of the segment that triggers the reset.
|
---|
415 | @param[in] Local Local IP address.
|
---|
416 | @param[in] Remote Remote peer's IP address.
|
---|
417 | @param[in] Version IP_VERSION_4 indicates TCP is running on IP4 stack,
|
---|
418 | IP_VERSION_6 indicates TCP is running on IP6 stack.
|
---|
419 |
|
---|
420 | @retval 0 A reset is sent or no need to send it.
|
---|
421 | @retval -1 No reset is sent.
|
---|
422 |
|
---|
423 | **/
|
---|
424 | INTN
|
---|
425 | TcpSendReset (
|
---|
426 | IN TCP_CB *Tcb,
|
---|
427 | IN TCP_HEAD *Head,
|
---|
428 | IN INT32 Len,
|
---|
429 | IN EFI_IP_ADDRESS *Local,
|
---|
430 | IN EFI_IP_ADDRESS *Remote,
|
---|
431 | IN UINT8 Version
|
---|
432 | );
|
---|
433 |
|
---|
434 | /**
|
---|
435 | Verify that the segment is in good shape.
|
---|
436 |
|
---|
437 | @param[in] Nbuf Buffer that contains the segment to be checked.
|
---|
438 |
|
---|
439 | @retval 0 The segment is broken.
|
---|
440 | @retval 1 The segment is in good shape.
|
---|
441 |
|
---|
442 | **/
|
---|
443 | INTN
|
---|
444 | TcpVerifySegment (
|
---|
445 | IN NET_BUF *Nbuf
|
---|
446 | );
|
---|
447 |
|
---|
448 | //
|
---|
449 | // Functions from TcpInput.c
|
---|
450 | //
|
---|
451 |
|
---|
452 | /**
|
---|
453 | Process the received ICMP error messages for TCP.
|
---|
454 |
|
---|
455 | @param[in] Nbuf Buffer that contains part of the TCP segment without IP header
|
---|
456 | truncated from the ICMP error packet.
|
---|
457 | @param[in] IcmpErr The ICMP error code interpreted from an ICMP error packet.
|
---|
458 | @param[in] Src Source address of the ICMP error message.
|
---|
459 | @param[in] Dst Destination address of the ICMP error message.
|
---|
460 | @param[in] Version IP_VERSION_4 indicates IP4 stack, IP_VERSION_6 indicates
|
---|
461 | IP6 stack.
|
---|
462 |
|
---|
463 | **/
|
---|
464 | VOID
|
---|
465 | TcpIcmpInput (
|
---|
466 | IN NET_BUF *Nbuf,
|
---|
467 | IN UINT8 IcmpErr,
|
---|
468 | IN EFI_IP_ADDRESS *Src,
|
---|
469 | IN EFI_IP_ADDRESS *Dst,
|
---|
470 | IN UINT8 Version
|
---|
471 | );
|
---|
472 |
|
---|
473 | /**
|
---|
474 | Process the received TCP segments.
|
---|
475 |
|
---|
476 | @param[in] Nbuf Buffer that contains received TCP segment without an IP header.
|
---|
477 | @param[in] Src Source address of the segment, or the peer's IP address.
|
---|
478 | @param[in] Dst Destination address of the segment, or the local end's IP
|
---|
479 | address.
|
---|
480 | @param[in] Version IP_VERSION_4 indicates IP4 stack, IP_VERSION_6 indicates
|
---|
481 | IP6 stack.
|
---|
482 |
|
---|
483 | @retval 0 The segment processed successfully. It is either accepted or
|
---|
484 | discarded. But no connection is reset by the segment.
|
---|
485 | @retval -1 A connection is reset by the segment.
|
---|
486 |
|
---|
487 | **/
|
---|
488 | INTN
|
---|
489 | TcpInput (
|
---|
490 | IN NET_BUF *Nbuf,
|
---|
491 | IN EFI_IP_ADDRESS *Src,
|
---|
492 | IN EFI_IP_ADDRESS *Dst,
|
---|
493 | IN UINT8 Version
|
---|
494 | );
|
---|
495 |
|
---|
496 | //
|
---|
497 | // Functions in TcpTimer.c
|
---|
498 | //
|
---|
499 |
|
---|
500 | /**
|
---|
501 | Close the TCP connection.
|
---|
502 |
|
---|
503 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
504 |
|
---|
505 | **/
|
---|
506 | VOID
|
---|
507 | TcpClose (
|
---|
508 | IN OUT TCP_CB *Tcb
|
---|
509 | );
|
---|
510 |
|
---|
511 | /**
|
---|
512 | Heart beat timer handler, queues the DPC at TPL_CALLBACK.
|
---|
513 |
|
---|
514 | @param[in] Event Timer event signaled, ignored.
|
---|
515 | @param[in] Context Context of the timer event, ignored.
|
---|
516 |
|
---|
517 | **/
|
---|
518 | VOID
|
---|
519 | EFIAPI
|
---|
520 | TcpTicking (
|
---|
521 | IN EFI_EVENT Event,
|
---|
522 | IN VOID *Context
|
---|
523 | );
|
---|
524 |
|
---|
525 | /**
|
---|
526 | Enable a TCP timer.
|
---|
527 |
|
---|
528 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
529 | @param[in] Timer The index of the timer to be enabled.
|
---|
530 | @param[in] TimeOut The timeout value of this timer.
|
---|
531 |
|
---|
532 | **/
|
---|
533 | VOID
|
---|
534 | TcpSetTimer (
|
---|
535 | IN OUT TCP_CB *Tcb,
|
---|
536 | IN UINT16 Timer,
|
---|
537 | IN UINT32 TimeOut
|
---|
538 | );
|
---|
539 |
|
---|
540 | /**
|
---|
541 | Clear one TCP timer.
|
---|
542 |
|
---|
543 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
544 | @param[in] Timer The index of the timer to be cleared.
|
---|
545 |
|
---|
546 | **/
|
---|
547 | VOID
|
---|
548 | TcpClearTimer (
|
---|
549 | IN OUT TCP_CB *Tcb,
|
---|
550 | IN UINT16 Timer
|
---|
551 | );
|
---|
552 |
|
---|
553 | /**
|
---|
554 | Clear all TCP timers.
|
---|
555 |
|
---|
556 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
557 |
|
---|
558 | **/
|
---|
559 | VOID
|
---|
560 | TcpClearAllTimer (
|
---|
561 | IN OUT TCP_CB *Tcb
|
---|
562 | );
|
---|
563 |
|
---|
564 | /**
|
---|
565 | Enable the window prober timer and set the timeout value.
|
---|
566 |
|
---|
567 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
568 |
|
---|
569 | **/
|
---|
570 | VOID
|
---|
571 | TcpSetProbeTimer (
|
---|
572 | IN OUT TCP_CB *Tcb
|
---|
573 | );
|
---|
574 |
|
---|
575 | /**
|
---|
576 | Enable the keepalive timer and set the timeout value.
|
---|
577 |
|
---|
578 | @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
579 |
|
---|
580 | **/
|
---|
581 | VOID
|
---|
582 | TcpSetKeepaliveTimer (
|
---|
583 | IN OUT TCP_CB *Tcb
|
---|
584 | );
|
---|
585 |
|
---|
586 | //
|
---|
587 | // Functions in TcpIo.c
|
---|
588 | //
|
---|
589 |
|
---|
590 | /**
|
---|
591 | Packet receive callback function provided to IP_IO. Used to call
|
---|
592 | the proper function to handle the packet received by IP.
|
---|
593 |
|
---|
594 | @param[in] Status Result of the receive request.
|
---|
595 | @param[in] IcmpErr Valid when Status is EFI_ICMP_ERROR.
|
---|
596 | @param[in] NetSession The IP session for the received packet.
|
---|
597 | @param[in] Pkt Packet received.
|
---|
598 | @param[in] Context The data provided by the user for the received packet when
|
---|
599 | the callback is registered in IP_IO_OPEN_DATA::RcvdContext.
|
---|
600 | This is an optional parameter that may be NULL.
|
---|
601 |
|
---|
602 | **/
|
---|
603 | VOID
|
---|
604 | EFIAPI
|
---|
605 | TcpRxCallback (
|
---|
606 | IN EFI_STATUS Status,
|
---|
607 | IN UINT8 IcmpErr,
|
---|
608 | IN EFI_NET_SESSION_DATA *NetSession,
|
---|
609 | IN NET_BUF *Pkt,
|
---|
610 | IN VOID *Context OPTIONAL
|
---|
611 | );
|
---|
612 |
|
---|
613 | /**
|
---|
614 | Send the segment to IP via IpIo function.
|
---|
615 |
|
---|
616 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
617 | @param[in] Nbuf Pointer to the TCP segment to be sent.
|
---|
618 | @param[in] Src Source address of the TCP segment.
|
---|
619 | @param[in] Dest Destination address of the TCP segment.
|
---|
620 | @param[in] Version IP_VERSION_4 or IP_VERSION_6
|
---|
621 |
|
---|
622 | @retval 0 The segment was sent out successfully.
|
---|
623 | @retval -1 The segment failed to be sent.
|
---|
624 |
|
---|
625 | **/
|
---|
626 | INTN
|
---|
627 | TcpSendIpPacket (
|
---|
628 | IN TCP_CB *Tcb,
|
---|
629 | IN NET_BUF *Nbuf,
|
---|
630 | IN EFI_IP_ADDRESS *Src,
|
---|
631 | IN EFI_IP_ADDRESS *Dest,
|
---|
632 | IN UINT8 Version
|
---|
633 | );
|
---|
634 |
|
---|
635 | /**
|
---|
636 | Refresh the remote peer's Neighbor Cache State if already exists.
|
---|
637 |
|
---|
638 | @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
|
---|
639 | @param[in] Neighbor Source address of the TCP segment.
|
---|
640 | @param[in] Timeout Time in 100-ns units that this entry will remain
|
---|
641 | in the neighbor cache. A value of zero means that
|
---|
642 | the entry is permanent. A value of non-zero means
|
---|
643 | that the entry is dynamic and will be deleted
|
---|
644 | after Timeout.
|
---|
645 |
|
---|
646 | @retval EFI_SUCCESS Successfully updated the neighbor relationship.
|
---|
647 | @retval EFI_NOT_STARTED The IpIo is not configured.
|
---|
648 | @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
|
---|
649 | @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
|
---|
650 | @retval EFI_NOT_FOUND This entry is not in the neighbor table.
|
---|
651 |
|
---|
652 | **/
|
---|
653 | EFI_STATUS
|
---|
654 | Tcp6RefreshNeighbor (
|
---|
655 | IN TCP_CB *Tcb,
|
---|
656 | IN EFI_IP_ADDRESS *Neighbor,
|
---|
657 | IN UINT32 Timeout
|
---|
658 | );
|
---|
659 |
|
---|
660 | //
|
---|
661 | // Functions in TcpDispatcher.c
|
---|
662 | //
|
---|
663 |
|
---|
664 | /**
|
---|
665 | The protocol handler provided to the socket layer, used to
|
---|
666 | dispatch the socket level requests by calling the corresponding
|
---|
667 | TCP layer functions.
|
---|
668 |
|
---|
669 | @param[in] Sock Pointer to the socket of this TCP instance.
|
---|
670 | @param[in] Request The code of this operation request.
|
---|
671 | @param[in] Data Pointer to the operation specific data passed in
|
---|
672 | together with the operation request. This is an
|
---|
673 | optional parameter that may be NULL.
|
---|
674 |
|
---|
675 | @retval EFI_SUCCESS The socket request completed successfully.
|
---|
676 | @retval other The error status returned by the corresponding TCP
|
---|
677 | layer function.
|
---|
678 |
|
---|
679 | **/
|
---|
680 | EFI_STATUS
|
---|
681 | TcpDispatcher (
|
---|
682 | IN SOCKET *Sock,
|
---|
683 | IN UINT8 Request,
|
---|
684 | IN VOID *Data OPTIONAL
|
---|
685 | );
|
---|
686 |
|
---|
687 | #endif
|
---|