⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transacmng.c

📁 内容正如其名
💻 C
📖 第 1 页 / 共 5 页
字号:
  Assert(pTransacMng);  Assert(pRspOutList);   /* Check if outgoing response in rspsend list is expired */  SListReset(pRspOutList);  while ((pRspOut = SListGetCurData(pRspOutList)) != NULL)  {    /* Increase the elapse time of this response */    pRspOut->dwTimeDuration += pTransacMng->TickTimer.wTimerInterval;        if (pRspOut->dwTimeDuration >= pTransacMng->dwTimerHIST)    {      /* Response expired, remove it from the list */      SListDelCurNode(pRspOutList);      /* Free the response */      ClearTranRspOut(pRspOut);      free(pRspOut);    }    else      SListNextNode(pRspOutList);  }}/****************************************************************************** * Function          : ProcessResponseWaitAckTimeOut * * Description       : Check if every Mgcp outgoing transaction response waiting *                     ACK is expired, if yes, remove it from the response list, *                     otherwise update the elapse time. *                      * Input parameters  : pTransacMng - TransactionManager handle *                     pRspWaitingAckList - Point to the list of the response *                                          waiting ACK. * * Output parameters :  * * Return value      : None * * Comments          :  * * History           : *  2005/09/10       : Creation * * Date              : Sep 10 2005, Frank ZHANG ******************************************************************************/void ProcessResponseWaitAckTimeOut(H_MGCP_TRANSAC_MANAGER pTransacMng,                                   SLIST *pRspWaitingAckList){  TRANSAC_RSP_WAIT_ACK *pRspWaitAck;  Assert(pTransacMng);  Assert(pRspWaitingAckList);    SListReset(pRspWaitingAckList);  while ((pRspWaitAck = SListGetCurData(pRspWaitingAckList)) != NULL)  {    /* Increase the elapse time of this response */    pRspWaitAck->dwTimeDuration += pTransacMng->TickTimer.wTimerInterval;    /* Check if this outgoing response is expired */       if (pRspWaitAck->dwTimeDuration >= pTransacMng->dwTimerHIST)    {      /* Response expired, remove it from the list */      SListDelCurNode(pRspWaitingAckList);      /* Free the response */      ClearTranRspOutWaitAck(pRspWaitAck);      free(pRspWaitAck);    }    else    {      /* Check if need re-send this response */      if (pRspWaitAck->dwTimeDuration <= pTransacMng->dwTimerMax          && pRspWaitAck->wRetranCounter < pTransacMng->wCounterMax2)      {        /* If RTO timeout ? */        if (pRspWaitAck->dwRTO < pTransacMng->TickTimer.wTimerInterval)        {          /*Re-send the response */          SendMgcpRspOut(pTransacMng, pRspWaitAck->pRspOut, TRUE);            /* Increment the retransmission counter and recalculate the RTO */          pRspWaitAck->wRetranCounter++;           pRspWaitAck->dwRTO = RTO_DEFAULT*pRspWaitAck->wRetranCounter;        }        else        {          /* Decrease the RTO */          pRspWaitAck->dwRTO -= pTransacMng->TickTimer.wTimerInterval;        }      }        SListNextNode(pRspWaitingAckList);    }  }}/****************************************************************************** * Function          : ProcessAckedResponseTimeOut * * Description       : Check if every Mgcp outgoing transaction AckResponse is *                     expired, if yes, remove it from the response list, *                     otherwise updata the elapse time. *                      * Input parameters  : pTransacMng - TransactionManager handle  * * Output parameters :  * * Return value      : None * * Comments          :  * * History           : *  2005/09/10       : Creation * * Date              : Sep 10 2005, Frank ZHANG ******************************************************************************/void ProcessAckedResponseTimeOut(H_MGCP_TRANSAC_MANAGER pTransacMng){  TRANSAC_RSP_WAIT_ACK *pRspAcked;   SListReset(&pTransacMng->MsgList.RspAckReceivedList);  while ((pRspAcked = SListGetCurData(&pTransacMng->MsgList.RspAckReceivedList)) != NULL)  {    /* Updata elapse time of this outgoing response */    pRspAcked->dwTimeDuration += pTransacMng->TickTimer.wTimerInterval;    /* Check if this outgoing response is expired */       if (pRspAcked->dwTimeDuration > pTransacMng->dwTimerHIST)    {      /* Response expired, remove it from the list */      SListDelCurNode(&pTransacMng->MsgList.RspAckReceivedList);      /* Free the response */      ClearTranRspOutWaitAck(pRspAcked);      free(pRspAcked);    }    else      SListNextNode(&pTransacMng->MsgList.RspAckReceivedList);  }}/****************************************************************************** * Function          : ProcessResponsetAckTimeOut * * Description       : Check if every Mgcp outgoing transaction Response ACK is *                     expired, if yes, remove it from the response list, *                     otherwise updata the elapse time. *                      * Input parameters  : pTransacMng - TransactionManager handle  * * Output parameters :  * * Return value      : None * * Comments          :  * * History           : *  2005/09/10       : Creation * * Date              : Sep 10 2005, Frank ZHANG ******************************************************************************/void ProcessResponsetAckTimeOut(H_MGCP_TRANSAC_MANAGER pTransacMng){  TRANSAC_RSPACK_OUT *pRspAck;   SListReset(&pTransacMng->MsgList.AckRspSentList);  while ((pRspAck = SListGetCurData(&pTransacMng->MsgList.AckRspSentList)) != NULL)  {    /* Updata elapse time of this outgoing response */    pRspAck->dwTimeDuration += pTransacMng->TickTimer.wTimerInterval;    /* Check if this outgoing response is expired */       if (pRspAck->dwTimeDuration > pTransacMng->dwTimerHIST)    {      /* Response expired, remove it from the list */      SListDelCurNode(&pTransacMng->MsgList.AckRspSentList);      /* Free the response */      free(pRspAck);    }    else      SListNextNode(&pTransacMng->MsgList.AckRspSentList);  }}/****************************************************************************** * Function          : CheckDNSToGetMoreCA * * Description       : Use DNS service to get more IP address of the Notified *                     Entity: *                     1) If DNS checking is the first time, only check if there *                        have new resolved IP addresses different to the first *                        IP address of the NotifiedEnity, if have, update the *                        NotifiedEntity IP list and return TRUE; otherwise  *                        remain the NotifiedEntity IP list unchanged and return *                        FALSE; *                     2) If DNS checking is not the first time, If get new *                        resolved IP addresses, copy them into the IP address *                        list and return TRUE; otherwise, remain the *                        NotifiedEntity IP list unchanged and return FALSE. *                     NOTE: If the current address index is the first on, the *                     DNS resolution is the first time, else if the index is *                     the last one, the DNS resolution is the last time. *                      * Input parameters  : pNotifiedEntity - Pointer to NofifiedEntity.  * * Output parameters :  * * Return value      : TRUE If new IP address is got, otherwise return FALSE. * * Comments          :  * * History           : *  2005/09/11       : Creation * * Date              : Sep 11 2005, Frank ZHANG ******************************************************************************/BOOL CheckDNSToGetMoreCA(NOTIFIED_ENTITY *pNotifiedEntity){  int i = 0;  int j = 0;  struct hostent *pHostList;  BOOL bFound = FALSE;  DWORD dwTmpIp = 0;  DWORD dwHostIp;  DWORD TmpAddressList[MAX_IP_ADDRESS];  WORD wTmpIndex = 0;  Assert(pNotifiedEntity);  memset(TmpAddressList, 0, sizeof(TmpAddressList));    if (pNotifiedEntity->pcDomainName == NULL)    return FALSE;  /* Check whether the host name is dot decimal format */  if (IsDotDecimalAddress(pNotifiedEntity->pcDomainName))  {    return FALSE;  }  /* Resolve the DNS, if fail to resolve, return false*/  if ((pHostList = gethostbyname(pNotifiedEntity->pcDomainName)) == NULL)    return FALSE;  /* If this is the first DNS check ? */  if (pNotifiedEntity->wCurAddrIndex == 0)  {    /* The address index must start from 1 because the first       address still occupy the index 0 */    WORD wIndex = 1;    DWORD dwFirstAddr = pNotifiedEntity->pIPAddrList[0];        /* Copy the new resolved address into the NE address list, if the        original fist addree is in the new address list, exclude it */    while (pHostList->h_addr_list[i] != NULL)    {      dwHostIp = ntohl(*((DWORD*)pHostList->h_addr_list[i]));      if (dwHostIp != dwFirstAddr)      {        bFound = TRUE;        pNotifiedEntity->pIPAddrList[wIndex] = dwHostIp;        wIndex++;        if (wIndex >= MAX_IP_ADDRESS)          break;      }      i++;    }    /* Found new address ? */    if (bFound)    {      /* If get new address, the current address index must change to be         the second address */      pNotifiedEntity->wCurAddrIndex = 1;      pNotifiedEntity->wAddrNum = wIndex;      return TRUE;    }    else return FALSE;  }  else if (pNotifiedEntity->wCurAddrIndex == pNotifiedEntity->wAddrNum-1)  {    /* The last check, check if new address is resolved */      while (pHostList->h_addr_list[i] != NULL)    {      bFound = FALSE;      dwTmpIp = ntohl(*((DWORD*)pHostList->h_addr_list[i]));            /* If current resolved address has been in the original address list ? */      for (j = 0; j < pNotifiedEntity->wAddrNum; j++)      {        if (dwTmpIp == pNotifiedEntity->pIPAddrList[j])        {          bFound = TRUE;          break;        }      }        /* If resolved address is a new, append it into the tmp address list */      if (!bFound)      {        TmpAddressList[wTmpIndex] = dwTmpIp;        wTmpIndex++;          if (wTmpIndex >= MAX_IP_ADDRESS)          break;      }        /* Check next */      i++;    }      /* If get new address and the current NE still has capcity to       store the new address, append them into the NE address list */    if ((wTmpIndex > 0) && (pNotifiedEntity->wAddrNum < MAX_IP_ADDRESS))    {      memcpy(&pNotifiedEntity->pIPAddrList[pNotifiedEntity->wCurAddrIndex+1],             TmpAddressList,             sizeof(DWORD)*(MAX_IP_ADDRESS-pNotifiedEntity->wAddrNum));            pNotifiedEntity->wCurAddrIndex++;      /* Get the actaul address number */      if (wTmpIndex > (MAX_IP_ADDRESS-pNotifiedEntity->wAddrNum))        pNotifiedEntity->wAddrNum = MAX_IP_ADDRESS;      else        pNotifiedEntity->wAddrNum += wTmpIndex;            return TRUE;    }    else return FALSE;  }  return FALSE;}/****************************************************************************** * Function          : ProcessCommandOutTimeOut * * Description       : Implement the outgoing Mgcp command retransmission  *                     procedure defined in RFC3435. *                      * Input parameters  : pTransacMng - TransactionManager handle  * * Output parameters :  * * Return value      : None * * Comments          :  * * History           : *  2005/09/11       : Creation * * Date              : Sep 11 2005, Frank ZHANG ******************************************************************************/void ProcessCommandOutTimeOut(H_MGCP_TRANSAC_MANAGER pTransacMng){  TRANSAC_CMD_OUT *pTranCmdOut;   /* Check the command send list */  SListReset(&pTransacMng->MsgList.CmdSentList);  while ((pTranCmdOut = SListGetCurData(&pTransacMng->MsgList.CmdSentList)) != NULL)  {    /* Updata elapse time of this outgoing command */    pTranCmdOut->dwTim

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -