]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
dab714aa | 2 | Tcp function header file.\r |
83cbd279 | 3 | \r |
d551cc64 | 4 | Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r |
e5eed7d3 | 5 | This program and the accompanying materials\r |
83cbd279 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
dfc1f033 | 8 | http://opensource.org/licenses/bsd-license.php<BR>\r |
83cbd279 | 9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
83cbd279 | 13 | **/\r |
14 | \r | |
15 | #ifndef _TCP4_FUNC_H_\r | |
16 | #define _TCP4_FUNC_H_\r | |
17 | \r | |
18 | //\r | |
19 | // Declaration of all the functions in TCP\r | |
20 | // protocol. It is intended to keep tcp.h\r | |
21 | // clear.\r | |
22 | //\r | |
23 | \r | |
24 | //\r | |
25 | // Functions in tcp.c\r | |
26 | //\r | |
dfc1f033 | 27 | \r |
28 | /**\r | |
29 | Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.\r | |
30 | \r | |
31 | @param Addr Pointer to the IP address needs to match.\r | |
32 | @param Port The port number needs to match.\r | |
33 | \r | |
34 | @return The Tcb which matches the <Addr Port> paire exists or not.\r | |
35 | \r | |
36 | **/\r | |
83cbd279 | 37 | BOOLEAN\r |
38 | TcpFindTcbByPeer (\r | |
39 | IN EFI_IPv4_ADDRESS *Addr,\r | |
40 | IN TCP_PORTNO Port\r | |
41 | );\r | |
42 | \r | |
dfc1f033 | 43 | /**\r |
44 | Locate the TCP_CB related to the socket pair.\r | |
45 | \r | |
46 | @param LocalPort The local port number.\r | |
47 | @param LocalIp The local IP address.\r | |
48 | @param RemotePort The remote port number.\r | |
49 | @param RemoteIp The remote IP address.\r | |
50 | @param Syn Whether to search the listen sockets, if TRUE, the\r | |
51 | listen sockets are searched.\r | |
52 | \r | |
53 | @return Pointer to the related TCP_CB, if NULL no match is found.\r | |
54 | \r | |
55 | **/\r | |
56 | TCP_CB *\r | |
83cbd279 | 57 | TcpLocateTcb (\r |
58 | IN TCP_PORTNO LocalPort,\r | |
59 | IN UINT32 LocalIp,\r | |
60 | IN TCP_PORTNO RemotePort,\r | |
61 | IN UINT32 RemoteIp,\r | |
62 | IN BOOLEAN Syn\r | |
63 | );\r | |
64 | \r | |
dfc1f033 | 65 | /**\r |
66 | Insert a Tcb into the proper queue.\r | |
67 | \r | |
68 | @param Tcb Pointer to the TCP_CB to be inserted.\r | |
69 | \r | |
70 | @retval 0 The Tcb is inserted successfully.\r | |
71 | @retval -1 Error condition occurred.\r | |
72 | \r | |
73 | **/\r | |
83cbd279 | 74 | INTN\r |
75 | TcpInsertTcb (\r | |
76 | IN TCP_CB *Tcb\r | |
77 | );\r | |
78 | \r | |
dfc1f033 | 79 | /**\r |
80 | Clone a TCP_CB from Tcb.\r | |
81 | \r | |
82 | @param Tcb Pointer to the TCP_CB to be cloned.\r | |
83 | \r | |
84 | @return Pointer to the new cloned TCP_CB, if NULL error condition occurred.\r | |
85 | \r | |
86 | **/\r | |
87 | TCP_CB *\r | |
83cbd279 | 88 | TcpCloneTcb (\r |
89 | IN TCP_CB *Tcb\r | |
90 | );\r | |
91 | \r | |
dfc1f033 | 92 | /**\r |
93 | Compute an ISS to be used by a new connection.\r | |
94 | \r | |
95 | @return The result ISS.\r | |
96 | \r | |
97 | **/\r | |
83cbd279 | 98 | TCP_SEQNO\r |
99 | TcpGetIss (\r | |
100 | VOID\r | |
101 | );\r | |
102 | \r | |
dfc1f033 | 103 | /**\r |
104 | Initialize the Tcb local related members.\r | |
105 | \r | |
106 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
107 | \r | |
108 | **/\r | |
83cbd279 | 109 | VOID\r |
110 | TcpInitTcbLocal (\r | |
77f00155 | 111 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 112 | );\r |
113 | \r | |
dfc1f033 | 114 | /**\r |
115 | Initialize the peer related members.\r | |
116 | \r | |
117 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
118 | @param Seg Pointer to the segment that contains the peer's\r | |
119 | intial info.\r | |
120 | @param Opt Pointer to the options announced by the peer.\r | |
121 | \r | |
122 | **/\r | |
83cbd279 | 123 | VOID\r |
124 | TcpInitTcbPeer (\r | |
77f00155 | 125 | IN OUT TCP_CB *Tcb,\r |
126 | IN TCP_SEG *Seg,\r | |
127 | IN TCP_OPTION *Opt\r | |
83cbd279 | 128 | );\r |
129 | \r | |
dfc1f033 | 130 | /**\r |
131 | Get the local mss.\r | |
132 | \r | |
133 | @param Sock Pointer to the socket to get mss\r | |
134 | \r | |
135 | @return The mss size.\r | |
136 | \r | |
137 | **/\r | |
83cbd279 | 138 | UINT16\r |
139 | TcpGetRcvMss (\r | |
dfc1f033 | 140 | IN SOCKET *Sock\r |
83cbd279 | 141 | );\r |
142 | \r | |
dfc1f033 | 143 | /**\r |
144 | Set the Tcb's state.\r | |
145 | \r | |
146 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
147 | @param State The state to be set.\r | |
148 | \r | |
149 | **/\r | |
83cbd279 | 150 | VOID\r |
151 | TcpSetState (\r | |
77f00155 | 152 | IN OUT TCP_CB *Tcb,\r |
153 | IN UINT8 State\r | |
83cbd279 | 154 | );\r |
155 | \r | |
156 | //\r | |
157 | // Functions in Tcp4Output.c\r | |
158 | //\r | |
dfc1f033 | 159 | /**\r |
160 | Send the segment to IP via IpIo function.\r | |
161 | \r | |
162 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
163 | @param Nbuf Pointer to the TCP segment to be sent.\r | |
164 | @param Src Source address of the TCP segment.\r | |
165 | @param Dest Destination address of the TCP segment.\r | |
166 | \r | |
167 | @retval 0 The segment was sent out successfully.\r | |
168 | @retval -1 The segment was failed to send.\r | |
169 | \r | |
170 | **/\r | |
83cbd279 | 171 | INTN\r |
172 | TcpSendIpPacket (\r | |
dfc1f033 | 173 | IN TCP_CB *Tcb,\r |
174 | IN NET_BUF *Nbuf,\r | |
175 | IN UINT32 Src,\r | |
176 | IN UINT32 Dest\r | |
83cbd279 | 177 | );\r |
178 | \r | |
dfc1f033 | 179 | /**\r |
180 | Check whether to send data/SYN/FIN and piggy back an ACK.\r | |
181 | \r | |
182 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
183 | @param Force Whether to ignore the sender's SWS avoidance algorithm and send\r | |
184 | out data by force.\r | |
185 | \r | |
186 | @return The number of bytes sent.\r | |
187 | \r | |
188 | **/\r | |
83cbd279 | 189 | INTN\r |
190 | TcpToSendData (\r | |
77f00155 | 191 | IN OUT TCP_CB *Tcb,\r |
192 | IN INTN Force\r | |
83cbd279 | 193 | );\r |
194 | \r | |
dfc1f033 | 195 | /**\r |
196 | Check whether to send an ACK or delayed ACK.\r | |
197 | \r | |
198 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
199 | \r | |
200 | **/\r | |
83cbd279 | 201 | VOID\r |
202 | TcpToSendAck (\r | |
77f00155 | 203 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 204 | );\r |
205 | \r | |
dfc1f033 | 206 | /**\r |
207 | Send an ACK immediately.\r | |
208 | \r | |
209 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
210 | \r | |
211 | **/\r | |
83cbd279 | 212 | VOID\r |
213 | TcpSendAck (\r | |
77f00155 | 214 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 215 | );\r |
216 | \r | |
dfc1f033 | 217 | /**\r |
218 | Send a zero probe segment. It can be used by keepalive and zero window probe.\r | |
219 | \r | |
220 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
221 | \r | |
222 | @retval 0 The zero probe segment was sent out successfully.\r | |
223 | @retval other Error condition occurred.\r | |
224 | \r | |
225 | **/\r | |
83cbd279 | 226 | INTN\r |
227 | TcpSendZeroProbe (\r | |
77f00155 | 228 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 229 | );\r |
230 | \r | |
dfc1f033 | 231 | /**\r |
232 | Process the data and FIN flag, check whether to deliver\r | |
233 | data to the socket layer.\r | |
234 | \r | |
235 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
236 | \r | |
237 | @retval 0 No error occurred to deliver data.\r | |
238 | @retval -1 Error condition occurred. Proper response is to reset the\r | |
239 | connection.\r | |
240 | \r | |
241 | **/\r | |
83cbd279 | 242 | INTN\r |
243 | TcpDeliverData (\r | |
77f00155 | 244 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 245 | );\r |
246 | \r | |
dfc1f033 | 247 | /**\r |
248 | Send a RESET segment in response to the segment received.\r | |
249 | \r | |
250 | @param Tcb Pointer to the TCP_CB of this TCP instance, may be NULL.\r | |
251 | @param Head TCP header of the segment that triggers the reset.\r | |
252 | @param Len Length of the segment that triggers the reset.\r | |
253 | @param Local Local IP address.\r | |
254 | @param Remote Remote peer's IP address.\r | |
255 | \r | |
256 | @retval 0 A reset is sent or no need to send it.\r | |
257 | @retval -1 No reset is sent.\r | |
258 | \r | |
259 | **/\r | |
83cbd279 | 260 | INTN\r |
261 | TcpSendReset (\r | |
dfc1f033 | 262 | IN TCP_CB *Tcb,\r |
263 | IN TCP_HEAD *Head,\r | |
264 | IN INT32 Len,\r | |
265 | IN UINT32 Local,\r | |
266 | IN UINT32 Remote\r | |
83cbd279 | 267 | );\r |
268 | \r | |
dfc1f033 | 269 | /**\r |
270 | Compute the sequence space left in the old receive window.\r | |
271 | \r | |
272 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
273 | \r | |
274 | @return The sequence space left in the old receive window.\r | |
275 | \r | |
276 | **/\r | |
83cbd279 | 277 | UINT32\r |
278 | TcpRcvWinOld (\r | |
279 | IN TCP_CB *Tcb\r | |
280 | );\r | |
281 | \r | |
dfc1f033 | 282 | /**\r |
283 | Compute the current receive window.\r | |
284 | \r | |
285 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
286 | \r | |
287 | @return The size of the current receive window, in bytes.\r | |
288 | \r | |
289 | **/\r | |
83cbd279 | 290 | UINT32\r |
291 | TcpRcvWinNow (\r | |
292 | IN TCP_CB *Tcb\r | |
293 | );\r | |
294 | \r | |
dfc1f033 | 295 | /**\r |
296 | Retransmit the segment from sequence Seq.\r | |
297 | \r | |
298 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
299 | @param Seq The sequence number of the segment to be retransmitted.\r | |
300 | \r | |
301 | @retval 0 Retransmission succeeded.\r | |
302 | @retval -1 Error condition occurred.\r | |
303 | \r | |
304 | **/\r | |
83cbd279 | 305 | INTN\r |
306 | TcpRetransmit (\r | |
307 | IN TCP_CB *Tcb,\r | |
308 | IN TCP_SEQNO Seq\r | |
309 | );\r | |
310 | \r | |
dfc1f033 | 311 | /**\r |
312 | Compute how much data to send.\r | |
313 | \r | |
314 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
315 | @param Force Whether to ignore the sender's SWS avoidance algorithm and send\r | |
316 | out data by force.\r | |
317 | \r | |
318 | @return The length of the data can be sent, if 0, no data can be sent.\r | |
319 | \r | |
320 | **/\r | |
83cbd279 | 321 | UINT32\r |
322 | TcpDataToSend (\r | |
323 | IN TCP_CB *Tcb,\r | |
324 | IN INTN Force\r | |
325 | );\r | |
326 | \r | |
dfc1f033 | 327 | /**\r |
328 | Verify that the segment is in good shape.\r | |
329 | \r | |
330 | @param Nbuf Buffer that contains the segment to be checked.\r | |
331 | \r | |
332 | @retval 0 The segment is broken.\r | |
333 | @retval 1 The segment is in good shape.\r | |
334 | \r | |
335 | **/\r | |
83cbd279 | 336 | INTN\r |
337 | TcpVerifySegment (\r | |
338 | IN NET_BUF *Nbuf\r | |
339 | );\r | |
340 | \r | |
dfc1f033 | 341 | /**\r |
342 | Verify that all the segments in SndQue are in good shape.\r | |
343 | \r | |
344 | @param Head Pointer to the head node of the SndQue.\r | |
345 | \r | |
346 | @retval 0 At least one segment is broken.\r | |
347 | @retval 1 All segments in the specific queue are in good shape.\r | |
348 | \r | |
349 | **/\r | |
83cbd279 | 350 | INTN\r |
351 | TcpCheckSndQue (\r | |
e48e37fc | 352 | IN LIST_ENTRY *Head\r |
83cbd279 | 353 | );\r |
354 | \r | |
dfc1f033 | 355 | /**\r |
356 | Get a segment from the Tcb's SndQue.\r | |
357 | \r | |
358 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
359 | @param Seq The sequence number of the segment.\r | |
360 | @param Len The maximum length of the segment.\r | |
361 | \r | |
362 | @return Pointer to the segment, if NULL some error occurred.\r | |
363 | \r | |
364 | **/\r | |
83cbd279 | 365 | NET_BUF *\r |
366 | TcpGetSegmentSndQue (\r | |
367 | IN TCP_CB *Tcb,\r | |
368 | IN TCP_SEQNO Seq,\r | |
369 | IN UINT32 Len\r | |
370 | );\r | |
371 | \r | |
dfc1f033 | 372 | /**\r |
373 | Get a segment from the Tcb's socket buffer.\r | |
374 | \r | |
375 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
376 | @param Seq The sequence number of the segment.\r | |
377 | @param Len The maximum length of the segment.\r | |
378 | \r | |
379 | @return Pointer to the segment, if NULL some error occurred.\r | |
380 | \r | |
381 | **/\r | |
83cbd279 | 382 | NET_BUF *\r |
383 | TcpGetSegmentSock (\r | |
384 | IN TCP_CB *Tcb,\r | |
385 | IN TCP_SEQNO Seq,\r | |
386 | IN UINT32 Len\r | |
387 | );\r | |
388 | \r | |
dfc1f033 | 389 | /**\r |
390 | Get a segment starting from sequence Seq of a maximum\r | |
391 | length of Len.\r | |
392 | \r | |
393 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
394 | @param Seq The sequence number of the segment.\r | |
395 | @param Len The maximum length of the segment.\r | |
396 | \r | |
397 | @return Pointer to the segment, if NULL some error occurred.\r | |
398 | \r | |
399 | **/\r | |
83cbd279 | 400 | NET_BUF *\r |
401 | TcpGetSegment (\r | |
402 | IN TCP_CB *Tcb,\r | |
403 | IN TCP_SEQNO Seq,\r | |
404 | IN UINT32 Len\r | |
405 | );\r | |
406 | \r | |
dfc1f033 | 407 | /**\r |
408 | Get the maximum SndNxt.\r | |
409 | \r | |
410 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
411 | \r | |
412 | @return The sequence number of the maximum SndNxt.\r | |
413 | \r | |
414 | **/\r | |
83cbd279 | 415 | TCP_SEQNO\r |
416 | TcpGetMaxSndNxt (\r | |
417 | IN TCP_CB *Tcb\r | |
418 | );\r | |
419 | \r | |
420 | //\r | |
421 | // Functions from Tcp4Input.c\r | |
422 | //\r | |
dfc1f033 | 423 | /**\r |
424 | Process the received ICMP error messages for TCP.\r | |
425 | \r | |
426 | @param Nbuf Buffer that contains part of the TCP segment without IP header\r | |
427 | truncated from the ICMP error packet.\r | |
428 | @param IcmpErr The ICMP error code interpreted from ICMP error packet.\r | |
429 | @param Src Source address of the ICMP error message.\r | |
430 | @param Dst Destination address of the ICMP error message.\r | |
431 | \r | |
432 | **/\r | |
83cbd279 | 433 | VOID\r |
434 | TcpIcmpInput (\r | |
435 | IN NET_BUF *Nbuf,\r | |
b45b45b2 | 436 | IN UINT8 IcmpErr,\r |
83cbd279 | 437 | IN UINT32 Src,\r |
438 | IN UINT32 Dst\r | |
439 | );\r | |
440 | \r | |
dfc1f033 | 441 | /**\r |
442 | Process the received TCP segments.\r | |
443 | \r | |
444 | @param Nbuf Buffer that contains received TCP segment without IP header.\r | |
445 | @param Src Source address of the segment, or the peer's IP address.\r | |
446 | @param Dst Destination address of the segment, or the local end's IP\r | |
447 | address.\r | |
448 | \r | |
449 | @retval 0 Segment is processed successfully. It is either accepted or\r | |
450 | discarded. But no connection is reset by the segment.\r | |
451 | @retval -1 A connection is reset by the segment.\r | |
452 | \r | |
453 | **/\r | |
83cbd279 | 454 | INTN\r |
455 | TcpInput (\r | |
456 | IN NET_BUF *Nbuf,\r | |
457 | IN UINT32 Src,\r | |
458 | IN UINT32 Dst\r | |
459 | );\r | |
460 | \r | |
dfc1f033 | 461 | /**\r |
462 | Check whether the sequence number of the incoming segment is acceptable.\r | |
463 | \r | |
464 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
465 | @param Seg Pointer to the incoming segment.\r | |
466 | \r | |
467 | @retval 1 The sequence number is acceptable.\r | |
468 | @retval 0 The sequence number is not acceptable.\r | |
469 | \r | |
470 | **/\r | |
83cbd279 | 471 | INTN\r |
472 | TcpSeqAcceptable (\r | |
473 | IN TCP_CB *Tcb,\r | |
474 | IN TCP_SEG *Seg\r | |
475 | );\r | |
476 | \r | |
dfc1f033 | 477 | /**\r |
478 | NewReno fast recovery, RFC3782.\r | |
479 | \r | |
480 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
481 | @param Seg Segment that triggers the fast recovery.\r | |
482 | \r | |
483 | **/\r | |
83cbd279 | 484 | VOID\r |
485 | TcpFastRecover (\r | |
77f00155 | 486 | IN OUT TCP_CB *Tcb,\r |
487 | IN TCP_SEG *Seg\r | |
83cbd279 | 488 | );\r |
489 | \r | |
dfc1f033 | 490 | /**\r |
491 | NewReno fast loss recovery, RFC3792.\r | |
492 | \r | |
493 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
494 | @param Seg Segment that triggers the fast loss recovery.\r | |
495 | \r | |
496 | **/\r | |
83cbd279 | 497 | VOID\r |
498 | TcpFastLossRecover (\r | |
77f00155 | 499 | IN OUT TCP_CB *Tcb,\r |
500 | IN TCP_SEG *Seg\r | |
83cbd279 | 501 | );\r |
502 | \r | |
dfc1f033 | 503 | /**\r |
504 | Compute the RTT as specified in RFC2988.\r | |
505 | \r | |
506 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
507 | @param Measure Currently measured RTT in heart beats.\r | |
508 | \r | |
509 | **/\r | |
83cbd279 | 510 | VOID\r |
511 | TcpComputeRtt (\r | |
77f00155 | 512 | IN OUT TCP_CB *Tcb,\r |
513 | IN UINT32 Measure\r | |
83cbd279 | 514 | );\r |
515 | \r | |
dfc1f033 | 516 | /**\r |
517 | Trim off the data outside the tcb's receive window.\r | |
518 | \r | |
519 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
520 | @param Nbuf Pointer to the NET_BUF containing the received tcp segment.\r | |
521 | \r | |
dfc1f033 | 522 | **/\r |
276dcc1b | 523 | VOID\r |
83cbd279 | 524 | TcpTrimInWnd (\r |
525 | IN TCP_CB *Tcb,\r | |
dfc1f033 | 526 | IN NET_BUF *Nbuf\r |
83cbd279 | 527 | );\r |
528 | \r | |
dfc1f033 | 529 | /**\r |
530 | Store the data into the reassemble queue.\r | |
531 | \r | |
532 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
533 | @param Nbuf Pointer to the buffer containing the data to be queued.\r | |
534 | \r | |
535 | **/\r | |
83cbd279 | 536 | VOID\r |
537 | TcpQueueData (\r | |
77f00155 | 538 | IN OUT TCP_CB *Tcb,\r |
539 | IN NET_BUF *Nbuf\r | |
83cbd279 | 540 | );\r |
541 | \r | |
dfc1f033 | 542 | /**\r |
543 | Ajust the send queue or the retransmit queue.\r | |
544 | \r | |
545 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
546 | @param Ack The acknowledge seuqence number of the received segment.\r | |
547 | \r | |
548 | **/\r | |
83cbd279 | 549 | VOID\r |
550 | TcpAdjustSndQue (\r | |
551 | IN TCP_CB *Tcb,\r | |
552 | IN TCP_SEQNO Ack\r | |
553 | );\r | |
554 | \r | |
555 | //\r | |
556 | // Functions from Tcp4Misc.c\r | |
557 | //\r | |
dfc1f033 | 558 | /**\r |
559 | Compute the TCP segment's checksum.\r | |
560 | \r | |
561 | @param Nbuf Pointer to the buffer that contains the TCP\r | |
562 | segment.\r | |
563 | @param HeadSum The checksum value of the fixed part of pseudo\r | |
564 | header.\r | |
565 | \r | |
566 | @return The checksum value.\r | |
567 | \r | |
568 | **/\r | |
83cbd279 | 569 | UINT16\r |
570 | TcpChecksum (\r | |
dfc1f033 | 571 | IN NET_BUF *Nbuf,\r |
572 | IN UINT16 HeadSum\r | |
83cbd279 | 573 | );\r |
574 | \r | |
dfc1f033 | 575 | /**\r |
576 | Translate the information from the head of the received TCP\r | |
577 | segment Nbuf contains and fill it into a TCP_SEG structure.\r | |
578 | \r | |
579 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
580 | @param Nbuf Pointer to the buffer contains the TCP segment.\r | |
581 | \r | |
582 | @return Pointer to the TCP_SEG that contains the translated TCP head information.\r | |
583 | \r | |
584 | **/\r | |
83cbd279 | 585 | TCP_SEG *\r |
586 | TcpFormatNetbuf (\r | |
77f00155 | 587 | IN TCP_CB *Tcb,\r |
588 | IN OUT NET_BUF *Nbuf\r | |
83cbd279 | 589 | );\r |
590 | \r | |
dfc1f033 | 591 | /**\r |
592 | Initialize an active connection.\r | |
593 | \r | |
594 | @param Tcb Pointer to the TCP_CB that wants to initiate a\r | |
595 | connection.\r | |
596 | \r | |
597 | **/\r | |
83cbd279 | 598 | VOID\r |
599 | TcpOnAppConnect (\r | |
77f00155 | 600 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 601 | );\r |
602 | \r | |
dfc1f033 | 603 | /**\r |
604 | Application has consumed some data, check whether\r | |
605 | to send a window updata ack or a delayed ack.\r | |
606 | \r | |
607 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
608 | \r | |
609 | **/\r | |
276dcc1b | 610 | VOID\r |
83cbd279 | 611 | TcpOnAppConsume (\r |
612 | IN TCP_CB *Tcb\r | |
613 | );\r | |
614 | \r | |
dfc1f033 | 615 | /**\r |
616 | Initiate the connection close procedure, called when\r | |
617 | applications want to close the connection.\r | |
618 | \r | |
619 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
620 | \r | |
621 | **/\r | |
83cbd279 | 622 | VOID\r |
623 | TcpOnAppClose (\r | |
77f00155 | 624 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 625 | );\r |
626 | \r | |
dfc1f033 | 627 | /**\r |
628 | Check whether the application's newly delivered data can be sent out.\r | |
629 | \r | |
630 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
631 | \r | |
632 | @retval 0 Whether the data is sent out or is buffered for\r | |
633 | further sending.\r | |
634 | @retval -1 The Tcb is not in a state that data is permitted to\r | |
635 | be sent out.\r | |
636 | \r | |
637 | **/\r | |
83cbd279 | 638 | INTN\r |
639 | TcpOnAppSend (\r | |
77f00155 | 640 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 641 | );\r |
642 | \r | |
dfc1f033 | 643 | /**\r |
644 | Abort the connection by sending a reset segment, called\r | |
645 | when the application wants to abort the connection.\r | |
646 | \r | |
647 | @param Tcb Pointer to the TCP_CB of the TCP instance.\r | |
648 | \r | |
649 | **/\r | |
83cbd279 | 650 | VOID\r |
651 | TcpOnAppAbort (\r | |
652 | IN TCP_CB *Tcb\r | |
653 | );\r | |
654 | \r | |
dfc1f033 | 655 | /**\r |
656 | Reset the connection related with Tcb.\r | |
657 | \r | |
658 | @param Tcb Pointer to the TCP_CB of the connection to be\r | |
659 | reset.\r | |
660 | \r | |
661 | **/\r | |
83cbd279 | 662 | VOID\r |
663 | TcpResetConnection (\r | |
664 | IN TCP_CB *Tcb\r | |
665 | );\r | |
666 | \r | |
667 | //\r | |
668 | // Functions in Tcp4Timer.c\r | |
669 | //\r | |
dfc1f033 | 670 | /**\r |
671 | Close the TCP connection.\r | |
672 | \r | |
673 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
674 | \r | |
675 | **/\r | |
83cbd279 | 676 | VOID\r |
677 | TcpClose (\r | |
77f00155 | 678 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 679 | );\r |
680 | \r | |
dfc1f033 | 681 | /**\r |
682 | Heart beat timer handler, queues the DPC at TPL_CALLBACK.\r | |
683 | \r | |
684 | @param Event Timer event signaled, ignored.\r | |
685 | @param Context Context of the timer event, ignored.\r | |
686 | \r | |
687 | **/\r | |
83cbd279 | 688 | VOID\r |
689 | EFIAPI\r | |
690 | TcpTicking (\r | |
691 | IN EFI_EVENT Event,\r | |
692 | IN VOID *Context\r | |
693 | );\r | |
694 | \r | |
dfc1f033 | 695 | /**\r |
696 | Enable a TCP timer.\r | |
697 | \r | |
698 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
699 | @param Timer The index of the timer to be enabled.\r | |
700 | @param TimeOut The timeout value of this timer.\r | |
701 | \r | |
702 | **/\r | |
83cbd279 | 703 | VOID\r |
704 | TcpSetTimer (\r | |
77f00155 | 705 | IN OUT TCP_CB *Tcb,\r |
706 | IN UINT16 Timer,\r | |
707 | IN UINT32 TimeOut\r | |
83cbd279 | 708 | );\r |
709 | \r | |
dfc1f033 | 710 | /**\r |
711 | Clear one TCP timer.\r | |
712 | \r | |
713 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
714 | @param Timer The index of the timer to be cleared.\r | |
715 | \r | |
716 | **/\r | |
83cbd279 | 717 | VOID\r |
718 | TcpClearTimer (\r | |
77f00155 | 719 | IN OUT TCP_CB *Tcb,\r |
720 | IN UINT16 Timer\r | |
83cbd279 | 721 | );\r |
722 | \r | |
dfc1f033 | 723 | /**\r |
724 | Clear all TCP timers.\r | |
725 | \r | |
726 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
727 | \r | |
728 | **/\r | |
83cbd279 | 729 | VOID\r |
730 | TcpClearAllTimer (\r | |
77f00155 | 731 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 732 | );\r |
733 | \r | |
dfc1f033 | 734 | /**\r |
735 | Enable the window prober timer and set the timeout value.\r | |
736 | \r | |
737 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
738 | \r | |
739 | **/\r | |
83cbd279 | 740 | VOID\r |
741 | TcpSetProbeTimer (\r | |
77f00155 | 742 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 743 | );\r |
744 | \r | |
dfc1f033 | 745 | /**\r |
746 | Enable the keepalive timer and set the timeout value.\r | |
747 | \r | |
748 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
749 | \r | |
750 | **/\r | |
83cbd279 | 751 | VOID\r |
752 | TcpSetKeepaliveTimer (\r | |
77f00155 | 753 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 754 | );\r |
755 | \r | |
dfc1f033 | 756 | /**\r |
757 | Backoff the RTO.\r | |
758 | \r | |
759 | @param Tcb Pointer to the TCP_CB of this TCP instance.\r | |
760 | \r | |
761 | **/\r | |
83cbd279 | 762 | VOID\r |
763 | TcpBackoffRto (\r | |
77f00155 | 764 | IN OUT TCP_CB *Tcb\r |
83cbd279 | 765 | );\r |
766 | \r | |
dfc1f033 | 767 | /**\r |
768 | Install the device path protocol on the TCP instance.\r | |
769 | \r | |
770 | @param Sock Pointer to the socket representing the TCP instance.\r | |
771 | \r | |
772 | @retval EFI_SUCCESS The device path protocol is installed.\r | |
773 | @retval other Failed to install the device path protocol.\r | |
774 | \r | |
775 | **/\r | |
83cbd279 | 776 | EFI_STATUS\r |
777 | TcpInstallDevicePath (\r | |
dfc1f033 | 778 | IN SOCKET *Sock\r |
83cbd279 | 779 | );\r |
780 | \r | |
781 | #endif\r |