Beispiel #1
0
/**
  Check the segment against PAWS.

  @param[in]  Tcb     Pointer to the TCP_CB of this TCP instance.
  @param[in]  TSVal   The timestamp value.

  @retval     1       The segment passed the PAWS check.
  @retval     0       The segment failed to pass the PAWS check.

**/
UINT32
TcpPawsOK (
  IN TCP_CB *Tcb,
  IN UINT32 TSVal
  )
{
  //
  // PAWS as defined in RFC1323, buggy...
  //
  if (TCP_TIME_LT (TSVal, Tcb->TsRecent) &&
      TCP_TIME_LT (Tcb->TsRecentAge + TCP_PAWS_24DAY, mTcpTick)
      ) {

    return 0;

  }

  return 1;
}
Beispiel #2
0
/**
  Update the timer status and the next expire time according to the timers
  to expire in a specific future time slot.

  @param  Tcb      Pointer to the TCP_CB of this TCP instance.

**/
VOID
TcpUpdateTimer (
  IN OUT TCP_CB *Tcb
  )
{
  UINT16  Index;

  //
  // Don't use a too large value to init NextExpire
  // since mTcpTick wraps around as sequence no does.
  //
  Tcb->NextExpire = 65535;
  TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);

  for (Index = 0; Index < TCP_TIMER_NUMBER; Index++) {

    if (TCP_TIMER_ON (Tcb->EnabledTimer, Index) &&
        TCP_TIME_LT (Tcb->Timer[Index], mTcpTick + Tcb->NextExpire)) {

      Tcb->NextExpire = TCP_SUB_TIME (Tcb->Timer[Index], mTcpTick);
      TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);
    }
  }
}