Home | History | Annotate | Download | only in TcpDxe

Lines Matching refs:Tcb

47   Initialize the Tcb local related members.

49 @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
54 IN OUT TCP_CB *Tcb
60 if (Tcb->Sk->IpVersion == IP_VERSION_4) {
61 Tcb->HeadSum = NetPseudoHeadChecksum (
62 Tcb->LocalEnd.Ip.Addr[0],
63 Tcb->RemoteEnd.Ip.Addr[0],
68 Tcb->HeadSum = NetIp6PseudoHeadChecksum (
69 &Tcb->LocalEnd.Ip.v6,
70 &Tcb->RemoteEnd.Ip.v6,
76 Tcb->Iss = TcpGetIss ();
77 Tcb->SndUna = Tcb->Iss;
78 Tcb->SndNxt = Tcb->Iss;
80 Tcb->SndWl2 = Tcb->Iss;
81 Tcb->SndWnd = 536;
83 Tcb->RcvWnd = GET_RCV_BUFFSIZE (Tcb->Sk);
88 Tcb->RcvWndScale = 0;
90 Tcb->ProbeTimerOn = FALSE;
96 @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
103 IN OUT TCP_CB *Tcb,
110 ASSERT ((Tcb != NULL) && (Seg != NULL) && (Opt != NULL));
113 Tcb->SndWnd = Seg->Wnd;
114 Tcb->SndWndMax = Tcb->SndWnd;
115 Tcb->SndWl1 = Seg->Seq;
118 Tcb->SndWl2 = Seg->Ack;
120 Tcb->SndWl2 = Tcb->Iss + 1;
124 Tcb->SndMss = (UINT16) MAX (64, Opt->Mss);
126 RcvMss = TcpGetRcvMss (Tcb->Sk);
127 if (Tcb->SndMss > RcvMss) {
128 Tcb->SndMss = RcvMss;
135 Tcb->RcvMss = 536;
138 Tcb->CWnd = Tcb->SndMss;
140 Tcb->Irs = Seg->Seq;
141 Tcb->RcvNxt = Tcb->Irs + 1;
143 Tcb->RcvWl2 = Tcb->RcvNxt;
145 if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_WS) && !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS)) {
147 Tcb->SndWndScale = Opt->WndScale;
149 Tcb->RcvWndScale = TcpComputeScale (Tcb);
150 TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS);
156 Tcb->RcvWndScale = 0;
159 if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_TS) && !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS)) {
161 TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_TS);
162 TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS);
164 Tcb->TsRecent = Opt->TSVal;
171 Tcb->SndMss -= TCP_OPTION_TS_ALIGNED_LEN;
231 Locate a listen TCB that matchs the Local and Remote.
300 Try to find one Tcb whose <Ip, Port> equals to <IN Addr, IN Port>.
308 @retval TRUE The Tcb which matches the <Addr Port> pair exists.
321 TCP_CB *Tcb;
328 Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
330 if ((Version == Tcb->Sk->IpVersion) &&
331 TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
332 (LocalPort == Tcb->LocalEnd.Port)
340 Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
342 if ((Version == Tcb->Sk->IpVersion) &&
343 TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
344 (LocalPort == Tcb->LocalEnd.Port)
381 TCP_CB *Tcb;
393 Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
395 if ((Version == Tcb->Sk->IpVersion) &&
396 TCP_PEER_EQUAL (&Remote, &Tcb->RemoteEnd, Version) &&
397 TCP_PEER_EQUAL (&Local, &Tcb->LocalEnd, Version)
400 RemoveEntryList (&Tcb->List);
401 InsertHeadList (&mTcpRunQue, &Tcb->List);
403 return Tcb;
418 Insert a Tcb into the proper queue.
420 @param[in] Tcb Pointer to the TCP_CB to be inserted.
422 @retval 0 The Tcb was inserted successfully.
428 IN TCP_CB *Tcb
436 (Tcb != NULL) &&
438 (Tcb->State == TCP_LISTEN) ||
439 (Tcb->State == TCP_SYN_SENT) ||
440 (Tcb->State == TCP_SYN_RCVD) ||
441 (Tcb->State == TCP_CLOSED)
445 if (Tcb->LocalEnd.Port == 0) {
451 if (Tcb->State == TCP_LISTEN) {
456 // Check that the Tcb isn't already on the list.
461 if (TCP_PEER_EQUAL (&Tcb->LocalEnd, &Node->LocalEnd, Tcb->Sk->IpVersion) &&
462 TCP_PEER_EQUAL (&Tcb->RemoteEnd, &Node->RemoteEnd, Tcb->Sk->IpVersion)
469 InsertHeadList (Head, &Tcb->List);
476 Clone a TCP_CB from Tcb.
478 @param[in] Tcb Pointer to the TCP_CB to be cloned.
485 IN TCP_CB *Tcb
496 CopyMem (Clone, Tcb, sizeof (TCP_CB));
501 NET_GET_REF (Tcb->IpInfo);
507 Clone->Sk = SockClone (Tcb->Sk);
576 Set the Tcb's state.
578 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
584 IN TCP_CB *Tcb,
588 ASSERT (Tcb->State < (sizeof (mTcpStateName) / sizeof (CHAR16 *)));
593 "Tcb (%p) state %s --> %s\n",
594 Tcb,
595 mTcpStateName[Tcb->State],
599 Tcb->State = State;
604 SockConnEstablished (Tcb->Sk);
606 if (Tcb->Parent != NULL) {
611 TcpInstallDevicePath (Tcb->Sk);
618 SockConnClosed (Tcb->Sk);
658 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
666 IN TCP_CB *Tcb,
684 Seg->Wnd = (NTOHS (Head->Wnd) << Tcb->SndWndScale);
708 @param[in, out] Tcb Pointer to the TCP_CB that wants to initiate a
714 IN OUT TCP_CB *Tcb
717 TcpInitTcbLocal (Tcb);
718 TcpSetState (Tcb, TCP_SYN_SENT);
720 TcpSetTimer (Tcb, TCP_TIMER_CONNECT, Tcb->ConnectTimeout);
721 TcpToSendData (Tcb, 1);
728 @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
733 IN OUT TCP_CB *Tcb
736 ASSERT (Tcb != NULL);
738 if (!IsListEmpty (&Tcb->RcvQue) || GET_RCV_DATASIZE (Tcb->Sk) != 0) {
742 "TcpOnAppClose: connection reset because data is lost for TCB %p\n",
743 Tcb)
746 TcpResetConnection (Tcb);
747 TcpClose (Tcb);
751 switch (Tcb->State) {
755 TcpSetState (Tcb, TCP_CLOSED);
760 TcpSetState (Tcb, TCP_FIN_WAIT_1);
764 TcpSetState (Tcb, TCP_LAST_ACK);
770 TcpToSendData (Tcb, 1);
776 @param[in, out] Tcb Pointer to the TCP_CB of this TCP instance.
779 @retval -1 The Tcb is not in a state that data is permitted to
785 IN OUT TCP_CB *Tcb
789 switch (Tcb->State) {
802 TcpToSendData (Tcb, 0);
823 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
828 IN TCP_CB *Tcb
833 switch (Tcb->State) {
835 TcpOld = TcpRcvWinOld (Tcb);
836 if (TcpRcvWinNow (Tcb) > TcpOld) {
838 if (TcpOld < Tcb->RcvMss) {
842 "TcpOnAppConsume: send a window update for a window closed Tcb %p\n",
843 Tcb)
846 TcpSendAck (Tcb);
847 } else if (Tcb->DelayedAck == 0) {
851 "TcpOnAppConsume: scheduled a delayed ACK to update window for Tcb %p\n",
852 Tcb)
855 Tcb->DelayedAck = 1;
870 @param[in] Tcb Pointer to the TCP_CB of the TCP instance.
875 IN TCP_CB *Tcb
880 "TcpOnAppAbort: connection reset issued by application for TCB %p\n",
881 Tcb)
884 switch (Tcb->State) {
890 TcpResetConnection (Tcb);
896 TcpSetState (Tcb, TCP_CLOSED);
900 Reset the connection related with Tcb.
902 @param[in] Tcb Pointer to the TCP_CB of the connection to be reset.
907 IN TCP_CB *Tcb
930 Nhead->Seq = HTONL (Tcb->SndNxt);
931 Nhead->Ack = HTONL (Tcb->RcvNxt);
932 Nhead->SrcPort = Tcb->LocalEnd.Port;
933 Nhead->DstPort = Tcb->RemoteEnd.Port;
939 Nhead->Checksum = TcpChecksum (Nbuf, Tcb->HeadSum);
941 TcpSendIpPacket (Tcb, Nbuf, &Tcb->LocalEnd.Ip, &Tcb->RemoteEnd.Ip, Tcb->Sk->IpVersion);
962 TCP_CB *Tcb;
972 Tcb = TcpProto->TcpPcb;
974 LocalPort = NTOHS (Tcb->LocalEnd.Port);
975 RemotePort = NTOHS (Tcb->RemoteEnd.Port);
980 Tcb->LocalEnd.Ip.Addr[0],
982 Tcb->RemoteEnd.Ip.Addr[0],
985 Tcb->UseDefaultAddr
988 IP4_COPY_ADDRESS (&Ip4DPathNode.SubnetMask, &Tcb->SubnetMask);
995 &Tcb->LocalEnd.Ip.v6,
997 &Tcb->RemoteEnd.Ip.v6,