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. **/
| 1027 | |
| 1028 | **/ |
| 1029 | INTN |
| 1030 | TcpSendZeroProbe ( |
| 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. |
no test coverage detected