]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
21922c7a023853999259966c6efdf6c014eec8a7
3 Copyright (c) 2005 - 2006, Intel Corporation<BR>
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php<BR>
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 // Declaration of all the functions in TCP
19 // protocol. It is intended to keep tcp.h
28 Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.
30 @param Addr Pointer to the IP address needs to match.
31 @param Port The port number needs to match.
33 @return The Tcb which matches the <Addr Port> paire exists or not.
38 IN EFI_IPv4_ADDRESS
*Addr
,
43 Locate the TCP_CB related to the socket pair.
45 @param LocalPort The local port number.
46 @param LocalIp The local IP address.
47 @param RemotePort The remote port number.
48 @param RemoteIp The remote IP address.
49 @param Syn Whether to search the listen sockets, if TRUE, the
50 listen sockets are searched.
52 @return Pointer to the related TCP_CB, if NULL no match is found.
57 IN TCP_PORTNO LocalPort
,
59 IN TCP_PORTNO RemotePort
,
65 Insert a Tcb into the proper queue.
67 @param Tcb Pointer to the TCP_CB to be inserted.
69 @retval 0 The Tcb is inserted successfully.
70 @retval -1 Error condition occurred.
79 Clone a TCP_CB from Tcb.
81 @param Tcb Pointer to the TCP_CB to be cloned.
83 @return Pointer to the new cloned TCP_CB, if NULL error condition occurred.
92 Compute an ISS to be used by a new connection.
94 @return The result ISS.
103 Initialize the Tcb local related members.
105 @param Tcb Pointer to the TCP_CB of this TCP instance.
114 Initialize the peer related members.
116 @param Tcb Pointer to the TCP_CB of this TCP instance.
117 @param Seg Pointer to the segment that contains the peer's
119 @param Opt Pointer to the options announced by the peer.
132 @param Sock Pointer to the socket to get mss
134 @return The mss size.
145 @param Tcb Pointer to the TCP_CB of this TCP instance.
146 @param State The state to be set.
156 // Functions in Tcp4Output.c
159 Send the segment to IP via IpIo function.
161 @param Tcb Pointer to the TCP_CB of this TCP instance.
162 @param Nbuf Pointer to the TCP segment to be sent.
163 @param Src Source address of the TCP segment.
164 @param Dest Destination address of the TCP segment.
166 @retval 0 The segment was sent out successfully.
167 @retval -1 The segment was failed to send.
179 Check whether to send data/SYN/FIN and piggy back an ACK.
181 @param Tcb Pointer to the TCP_CB of this TCP instance.
182 @param Force Whether to ignore the sender's SWS avoidance algorithm and send
185 @return The number of bytes sent.
195 Check whether to send an ACK or delayed ACK.
197 @param Tcb Pointer to the TCP_CB of this TCP instance.
206 Send an ACK immediately.
208 @param Tcb Pointer to the TCP_CB of this TCP instance.
217 Send a zero probe segment. It can be used by keepalive and zero window probe.
219 @param Tcb Pointer to the TCP_CB of this TCP instance.
221 @retval 0 The zero probe segment was sent out successfully.
222 @retval other Error condition occurred.
231 Process the data and FIN flag, check whether to deliver
232 data to the socket layer.
234 @param Tcb Pointer to the TCP_CB of this TCP instance.
236 @retval 0 No error occurred to deliver data.
237 @retval -1 Error condition occurred. Proper response is to reset the
247 Send a RESET segment in response to the segment received.
249 @param Tcb Pointer to the TCP_CB of this TCP instance, may be NULL.
250 @param Head TCP header of the segment that triggers the reset.
251 @param Len Length of the segment that triggers the reset.
252 @param Local Local IP address.
253 @param Remote Remote peer's IP address.
255 @retval 0 A reset is sent or no need to send it.
256 @retval -1 No reset is sent.
269 Compute the sequence space left in the old receive window.
271 @param Tcb Pointer to the TCP_CB of this TCP instance.
273 @return The sequence space left in the old receive window.
282 Compute the current receive window.
284 @param Tcb Pointer to the TCP_CB of this TCP instance.
286 @return The size of the current receive window, in bytes.
295 Retransmit the segment from sequence Seq.
297 @param Tcb Pointer to the TCP_CB of this TCP instance.
298 @param Seq The sequence number of the segment to be retransmitted.
300 @retval 0 Retransmission succeeded.
301 @retval -1 Error condition occurred.
311 Compute how much data to send.
313 @param Tcb Pointer to the TCP_CB of this TCP instance.
314 @param Force Whether to ignore the sender's SWS avoidance algorithm and send
317 @return The length of the data can be sent, if 0, no data can be sent.
327 Verify that the segment is in good shape.
329 @param Nbuf Buffer that contains the segment to be checked.
331 @retval 0 The segment is broken.
332 @retval 1 The segment is in good shape.
341 Verify that all the segments in SndQue are in good shape.
343 @param Head Pointer to the head node of the SndQue.
345 @retval 0 At least one segment is broken.
346 @retval 1 All segments in the specific queue are in good shape.
355 Get a segment from the Tcb's SndQue.
357 @param Tcb Pointer to the TCP_CB of this TCP instance.
358 @param Seq The sequence number of the segment.
359 @param Len The maximum length of the segment.
361 @return Pointer to the segment, if NULL some error occurred.
365 TcpGetSegmentSndQue (
372 Get a segment from the Tcb's socket buffer.
374 @param Tcb Pointer to the TCP_CB of this TCP instance.
375 @param Seq The sequence number of the segment.
376 @param Len The maximum length of the segment.
378 @return Pointer to the segment, if NULL some error occurred.
389 Get a segment starting from sequence Seq of a maximum
392 @param Tcb Pointer to the TCP_CB of this TCP instance.
393 @param Seq The sequence number of the segment.
394 @param Len The maximum length of the segment.
396 @return Pointer to the segment, if NULL some error occurred.
407 Get the maximum SndNxt.
409 @param Tcb Pointer to the TCP_CB of this TCP instance.
411 @return The sequence number of the maximum SndNxt.
420 // Functions from Tcp4Input.c
423 Process the received ICMP error messages for TCP.
425 @param Nbuf Buffer that contains part of the TCP segment without IP header
426 truncated from the ICMP error packet.
427 @param IcmpErr The ICMP error code interpreted from ICMP error packet.
428 @param Src Source address of the ICMP error message.
429 @param Dst Destination address of the ICMP error message.
435 IN ICMP_ERROR IcmpErr
,
441 Process the received TCP segments.
443 @param Nbuf Buffer that contains received TCP segment without IP header.
444 @param Src Source address of the segment, or the peer's IP address.
445 @param Dst Destination address of the segment, or the local end's IP
448 @retval 0 Segment is processed successfully. It is either accepted or
449 discarded. But no connection is reset by the segment.
450 @retval -1 A connection is reset by the segment.
461 Check whether the sequence number of the incoming segment is acceptable.
463 @param Tcb Pointer to the TCP_CB of this TCP instance.
464 @param Seg Pointer to the incoming segment.
466 @retval 1 The sequence number is acceptable.
467 @retval 0 The sequence number is not acceptable.
477 NewReno fast recovery, RFC3782.
479 @param Tcb Pointer to the TCP_CB of this TCP instance.
480 @param Seg Segment that triggers the fast recovery.
490 NewReno fast loss recovery, RFC3792.
492 @param Tcb Pointer to the TCP_CB of this TCP instance.
493 @param Seg Segment that triggers the fast loss recovery.
503 Compute the RTT as specified in RFC2988.
505 @param Tcb Pointer to the TCP_CB of this TCP instance.
506 @param Measure Currently measured RTT in heart beats.
516 Trim off the data outside the tcb's receive window.
518 @param Tcb Pointer to the TCP_CB of this TCP instance.
519 @param Nbuf Pointer to the NET_BUF containing the received tcp segment.
521 @return 0 The data is trimmed.
531 Store the data into the reassemble queue.
533 @param Tcb Pointer to the TCP_CB of this TCP instance.
534 @param Nbuf Pointer to the buffer containing the data to be queued.
544 Ajust the send queue or the retransmit queue.
546 @param Tcb Pointer to the TCP_CB of this TCP instance.
547 @param Ack The acknowledge seuqence number of the received segment.
557 // Functions from Tcp4Misc.c
560 Compute the TCP segment's checksum.
562 @param Nbuf Pointer to the buffer that contains the TCP
564 @param HeadSum The checksum value of the fixed part of pseudo
567 @return The checksum value.
577 Translate the information from the head of the received TCP
578 segment Nbuf contains and fill it into a TCP_SEG structure.
580 @param Tcb Pointer to the TCP_CB of this TCP instance.
581 @param Nbuf Pointer to the buffer contains the TCP segment.
583 @return Pointer to the TCP_SEG that contains the translated TCP head information.
593 Initialize an active connection.
595 @param Tcb Pointer to the TCP_CB that wants to initiate a
605 Application has consumed some data, check whether
606 to send a window updata ack or a delayed ack.
608 @param Tcb Pointer to the TCP_CB of this TCP instance.
617 Initiate the connection close procedure, called when
618 applications want to close the connection.
620 @param Tcb Pointer to the TCP_CB of this TCP instance.
629 Check whether the application's newly delivered data can be sent out.
631 @param Tcb Pointer to the TCP_CB of this TCP instance.
633 @retval 0 Whether the data is sent out or is buffered for
635 @retval -1 The Tcb is not in a state that data is permitted to
645 Abort the connection by sending a reset segment, called
646 when the application wants to abort the connection.
648 @param Tcb Pointer to the TCP_CB of the TCP instance.
657 Reset the connection related with Tcb.
659 @param Tcb Pointer to the TCP_CB of the connection to be
669 // Functions in Tcp4Timer.c
672 Close the TCP connection.
674 @param Tcb Pointer to the TCP_CB of this TCP instance.
683 Heart beat timer handler, queues the DPC at TPL_CALLBACK.
685 @param Event Timer event signaled, ignored.
686 @param Context Context of the timer event, ignored.
699 @param Tcb Pointer to the TCP_CB of this TCP instance.
700 @param Timer The index of the timer to be enabled.
701 @param TimeOut The timeout value of this timer.
714 @param Tcb Pointer to the TCP_CB of this TCP instance.
715 @param Timer The index of the timer to be cleared.
725 Clear all TCP timers.
727 @param Tcb Pointer to the TCP_CB of this TCP instance.
736 Enable the window prober timer and set the timeout value.
738 @param Tcb Pointer to the TCP_CB of this TCP instance.
747 Enable the keepalive timer and set the timeout value.
749 @param Tcb Pointer to the TCP_CB of this TCP instance.
753 TcpSetKeepaliveTimer (
760 @param Tcb Pointer to the TCP_CB of this TCP instance.
769 Set the Tdp4 variable data.
771 @param Tcp4Service Pointer to Tcp4 service data.
773 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
774 @retval other Set variable failed.
779 IN TCP4_SERVICE_DATA
*Tcp4Service
783 Clear the variable and free the resource.
785 @param Tcp4Service Pointer to Tcp4 service data.
789 TcpClearVariableData (
790 IN TCP4_SERVICE_DATA
*Tcp4Service
794 Install the device path protocol on the TCP instance.
796 @param Sock Pointer to the socket representing the TCP instance.
798 @retval EFI_SUCCESS The device path protocol is installed.
799 @retval other Failed to install the device path protocol.
803 TcpInstallDevicePath (