]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
2 Tcp function header file.
4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php<BR>
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 // Declaration of all the functions in TCP
20 // protocol. It is intended to keep tcp.h
29 Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.
31 @param Addr Pointer to the IP address needs to match.
32 @param Port The port number needs to match.
34 @return The Tcb which matches the <Addr Port> paire exists or not.
39 IN EFI_IPv4_ADDRESS
*Addr
,
44 Locate the TCP_CB related to the socket pair.
46 @param LocalPort The local port number.
47 @param LocalIp The local IP address.
48 @param RemotePort The remote port number.
49 @param RemoteIp The remote IP address.
50 @param Syn Whether to search the listen sockets, if TRUE, the
51 listen sockets are searched.
53 @return Pointer to the related TCP_CB, if NULL no match is found.
58 IN TCP_PORTNO LocalPort
,
60 IN TCP_PORTNO RemotePort
,
66 Insert a Tcb into the proper queue.
68 @param Tcb Pointer to the TCP_CB to be inserted.
70 @retval 0 The Tcb is inserted successfully.
71 @retval -1 Error condition occurred.
80 Clone a TCP_CB from Tcb.
82 @param Tcb Pointer to the TCP_CB to be cloned.
84 @return Pointer to the new cloned TCP_CB, if NULL error condition occurred.
93 Compute an ISS to be used by a new connection.
95 @return The result ISS.
104 Initialize the Tcb local related members.
106 @param Tcb Pointer to the TCP_CB of this TCP instance.
115 Initialize the peer related members.
117 @param Tcb Pointer to the TCP_CB of this TCP instance.
118 @param Seg Pointer to the segment that contains the peer's
120 @param Opt Pointer to the options announced by the peer.
133 @param Sock Pointer to the socket to get mss
135 @return The mss size.
146 @param Tcb Pointer to the TCP_CB of this TCP instance.
147 @param State The state to be set.
157 // Functions in Tcp4Output.c
160 Send the segment to IP via IpIo function.
162 @param Tcb Pointer to the TCP_CB of this TCP instance.
163 @param Nbuf Pointer to the TCP segment to be sent.
164 @param Src Source address of the TCP segment.
165 @param Dest Destination address of the TCP segment.
167 @retval 0 The segment was sent out successfully.
168 @retval -1 The segment was failed to send.
180 Check whether to send data/SYN/FIN and piggy back an ACK.
182 @param Tcb Pointer to the TCP_CB of this TCP instance.
183 @param Force Whether to ignore the sender's SWS avoidance algorithm and send
186 @return The number of bytes sent.
196 Check whether to send an ACK or delayed ACK.
198 @param Tcb Pointer to the TCP_CB of this TCP instance.
207 Send an ACK immediately.
209 @param Tcb Pointer to the TCP_CB of this TCP instance.
218 Send a zero probe segment. It can be used by keepalive and zero window probe.
220 @param Tcb Pointer to the TCP_CB of this TCP instance.
222 @retval 0 The zero probe segment was sent out successfully.
223 @retval other Error condition occurred.
232 Process the data and FIN flag, check whether to deliver
233 data to the socket layer.
235 @param Tcb Pointer to the TCP_CB of this TCP instance.
237 @retval 0 No error occurred to deliver data.
238 @retval -1 Error condition occurred. Proper response is to reset the
248 Send a RESET segment in response to the segment received.
250 @param Tcb Pointer to the TCP_CB of this TCP instance, may be NULL.
251 @param Head TCP header of the segment that triggers the reset.
252 @param Len Length of the segment that triggers the reset.
253 @param Local Local IP address.
254 @param Remote Remote peer's IP address.
256 @retval 0 A reset is sent or no need to send it.
257 @retval -1 No reset is sent.
270 Compute the sequence space left in the old receive window.
272 @param Tcb Pointer to the TCP_CB of this TCP instance.
274 @return The sequence space left in the old receive window.
283 Compute the current receive window.
285 @param Tcb Pointer to the TCP_CB of this TCP instance.
287 @return The size of the current receive window, in bytes.
296 Retransmit the segment from sequence Seq.
298 @param Tcb Pointer to the TCP_CB of this TCP instance.
299 @param Seq The sequence number of the segment to be retransmitted.
301 @retval 0 Retransmission succeeded.
302 @retval -1 Error condition occurred.
312 Compute how much data to send.
314 @param Tcb Pointer to the TCP_CB of this TCP instance.
315 @param Force Whether to ignore the sender's SWS avoidance algorithm and send
318 @return The length of the data can be sent, if 0, no data can be sent.
328 Verify that the segment is in good shape.
330 @param Nbuf Buffer that contains the segment to be checked.
332 @retval 0 The segment is broken.
333 @retval 1 The segment is in good shape.
342 Verify that all the segments in SndQue are in good shape.
344 @param Head Pointer to the head node of the SndQue.
346 @retval 0 At least one segment is broken.
347 @retval 1 All segments in the specific queue are in good shape.
356 Get a segment from the Tcb's SndQue.
358 @param Tcb Pointer to the TCP_CB of this TCP instance.
359 @param Seq The sequence number of the segment.
360 @param Len The maximum length of the segment.
362 @return Pointer to the segment, if NULL some error occurred.
366 TcpGetSegmentSndQue (
373 Get a segment from the Tcb's socket buffer.
375 @param Tcb Pointer to the TCP_CB of this TCP instance.
376 @param Seq The sequence number of the segment.
377 @param Len The maximum length of the segment.
379 @return Pointer to the segment, if NULL some error occurred.
390 Get a segment starting from sequence Seq of a maximum
393 @param Tcb Pointer to the TCP_CB of this TCP instance.
394 @param Seq The sequence number of the segment.
395 @param Len The maximum length of the segment.
397 @return Pointer to the segment, if NULL some error occurred.
408 Get the maximum SndNxt.
410 @param Tcb Pointer to the TCP_CB of this TCP instance.
412 @return The sequence number of the maximum SndNxt.
421 // Functions from Tcp4Input.c
424 Process the received ICMP error messages for TCP.
426 @param Nbuf Buffer that contains part of the TCP segment without IP header
427 truncated from the ICMP error packet.
428 @param IcmpErr The ICMP error code interpreted from ICMP error packet.
429 @param Src Source address of the ICMP error message.
430 @param Dst Destination address of the ICMP error message.
442 Process the received TCP segments.
444 @param Nbuf Buffer that contains received TCP segment without IP header.
445 @param Src Source address of the segment, or the peer's IP address.
446 @param Dst Destination address of the segment, or the local end's IP
449 @retval 0 Segment is processed successfully. It is either accepted or
450 discarded. But no connection is reset by the segment.
451 @retval -1 A connection is reset by the segment.
462 Check whether the sequence number of the incoming segment is acceptable.
464 @param Tcb Pointer to the TCP_CB of this TCP instance.
465 @param Seg Pointer to the incoming segment.
467 @retval 1 The sequence number is acceptable.
468 @retval 0 The sequence number is not acceptable.
478 NewReno fast recovery, RFC3782.
480 @param Tcb Pointer to the TCP_CB of this TCP instance.
481 @param Seg Segment that triggers the fast recovery.
491 NewReno fast loss recovery, RFC3792.
493 @param Tcb Pointer to the TCP_CB of this TCP instance.
494 @param Seg Segment that triggers the fast loss recovery.
504 Compute the RTT as specified in RFC2988.
506 @param Tcb Pointer to the TCP_CB of this TCP instance.
507 @param Measure Currently measured RTT in heart beats.
517 Trim off the data outside the tcb's receive window.
519 @param Tcb Pointer to the TCP_CB of this TCP instance.
520 @param Nbuf Pointer to the NET_BUF containing the received tcp segment.
530 Store the data into the reassemble queue.
532 @param Tcb Pointer to the TCP_CB of this TCP instance.
533 @param Nbuf Pointer to the buffer containing the data to be queued.
543 Ajust the send queue or the retransmit queue.
545 @param Tcb Pointer to the TCP_CB of this TCP instance.
546 @param Ack The acknowledge seuqence number of the received segment.
556 // Functions from Tcp4Misc.c
559 Compute the TCP segment's checksum.
561 @param Nbuf Pointer to the buffer that contains the TCP
563 @param HeadSum The checksum value of the fixed part of pseudo
566 @return The checksum value.
576 Translate the information from the head of the received TCP
577 segment Nbuf contains and fill it into a TCP_SEG structure.
579 @param Tcb Pointer to the TCP_CB of this TCP instance.
580 @param Nbuf Pointer to the buffer contains the TCP segment.
582 @return Pointer to the TCP_SEG that contains the translated TCP head information.
592 Initialize an active connection.
594 @param Tcb Pointer to the TCP_CB that wants to initiate a
604 Application has consumed some data, check whether
605 to send a window updata ack or a delayed ack.
607 @param Tcb Pointer to the TCP_CB of this TCP instance.
616 Initiate the connection close procedure, called when
617 applications want to close the connection.
619 @param Tcb Pointer to the TCP_CB of this TCP instance.
628 Check whether the application's newly delivered data can be sent out.
630 @param Tcb Pointer to the TCP_CB of this TCP instance.
632 @retval 0 Whether the data is sent out or is buffered for
634 @retval -1 The Tcb is not in a state that data is permitted to
644 Abort the connection by sending a reset segment, called
645 when the application wants to abort the connection.
647 @param Tcb Pointer to the TCP_CB of the TCP instance.
656 Reset the connection related with Tcb.
658 @param Tcb Pointer to the TCP_CB of the connection to be
668 // Functions in Tcp4Timer.c
671 Close the TCP connection.
673 @param Tcb Pointer to the TCP_CB of this TCP instance.
682 Heart beat timer handler, queues the DPC at TPL_CALLBACK.
684 @param Event Timer event signaled, ignored.
685 @param Context Context of the timer event, ignored.
698 @param Tcb Pointer to the TCP_CB of this TCP instance.
699 @param Timer The index of the timer to be enabled.
700 @param TimeOut The timeout value of this timer.
713 @param Tcb Pointer to the TCP_CB of this TCP instance.
714 @param Timer The index of the timer to be cleared.
724 Clear all TCP timers.
726 @param Tcb Pointer to the TCP_CB of this TCP instance.
735 Enable the window prober timer and set the timeout value.
737 @param Tcb Pointer to the TCP_CB of this TCP instance.
746 Enable the keepalive timer and set the timeout value.
748 @param Tcb Pointer to the TCP_CB of this TCP instance.
752 TcpSetKeepaliveTimer (
759 @param Tcb Pointer to the TCP_CB of this TCP instance.
768 Install the device path protocol on the TCP instance.
770 @param Sock Pointer to the socket representing the TCP instance.
772 @retval EFI_SUCCESS The device path protocol is installed.
773 @retval other Failed to install the device path protocol.
777 TcpInstallDevicePath (