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