MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / TcpSendZeroProbe

Function TcpSendZeroProbe

NetworkPkg/TcpDxe/TcpOutput.c:1029–1059  ·  view source on GitHub ↗

Send a zero probe segment. It can be used by keepalive and zero window probe. @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance. @retval 0 The zero probe segment was sent out successfully. @retval other An error condition occurred. **/

Source from the content-addressed store, hash-verified

1027
1028**/
1029INTN
1030TcpSendZeroProbe (
1031 IN OUT TCP_CB *Tcb
1032 )
1033{
1034 NET_BUF *Nbuf;
1035 TCP_SEG *Seg;
1036 INTN Result;
1037
1038 Nbuf = NetbufAlloc (TCP_MAX_HEAD);
1039
1040 if (Nbuf == NULL) {
1041 return -1;
1042 }
1043
1044 NetbufReserve (Nbuf, TCP_MAX_HEAD);
1045
1046 //
1047 // SndNxt-1 is out of window. The peer should respond
1048 // with an ACK.
1049 //
1050 Seg = TCPSEG_NETBUF (Nbuf);
1051 Seg->Seq = Tcb->SndNxt - 1;
1052 Seg->End = Tcb->SndNxt - 1;
1053 Seg->Flag = TCP_FLG_ACK;
1054
1055 Result = TcpTransmitSegment (Tcb, Nbuf);
1056 NetbufFree (Nbuf);
1057
1058 return Result;
1059}
1060
1061/**
1062 Check whether to send an ACK or delayed ACK.

Callers 2

TcpProbeTimeoutFunction · 0.85
TcpKeepaliveTimeoutFunction · 0.85

Calls 3

TcpTransmitSegmentFunction · 0.85
NetbufReserveFunction · 0.50
NetbufFreeFunction · 0.50

Tested by

no test coverage detected