Set the Tcb's state. @param[in] Tcb Pointer to the TCP_CB of this TCP instance. @param[in] State The state to be set. **/
| 599 | |
| 600 | **/ |
| 601 | VOID |
| 602 | TcpSetState ( |
| 603 | IN TCP_CB *Tcb, |
| 604 | IN UINT8 State |
| 605 | ) |
| 606 | { |
| 607 | ASSERT (Tcb->State < (sizeof (mTcpStateName) / sizeof (CHAR16 *))); |
| 608 | ASSERT (State < (sizeof (mTcpStateName) / sizeof (CHAR16 *))); |
| 609 | |
| 610 | DEBUG ( |
| 611 | (EFI_D_NET, |
| 612 | "Tcb (%p) state %s --> %s\n", |
| 613 | Tcb, |
| 614 | mTcpStateName[Tcb->State], |
| 615 | mTcpStateName[State]) |
| 616 | ); |
| 617 | |
| 618 | Tcb->State = State; |
| 619 | |
| 620 | switch (State) { |
| 621 | case TCP_ESTABLISHED: |
| 622 | |
| 623 | SockConnEstablished (Tcb->Sk); |
| 624 | |
| 625 | if (Tcb->Parent != NULL) { |
| 626 | // |
| 627 | // A new connection is accepted by a listening socket. Install |
| 628 | // the device path. |
| 629 | // |
| 630 | TcpInstallDevicePath (Tcb->Sk); |
| 631 | } |
| 632 | |
| 633 | break; |
| 634 | |
| 635 | case TCP_CLOSED: |
| 636 | |
| 637 | SockConnClosed (Tcb->Sk); |
| 638 | |
| 639 | break; |
| 640 | default: |
| 641 | break; |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | Compute the TCP segment's checksum. |
no test coverage detected