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

📄 dm3ntsch.c

📁 ipt网关源码
💻 C
📖 第 1 页 / 共 3 页
字号:
    TSC_MsgGetCallInfoCmplt_t    CallInfoCmplt;
    TSC_CallInfo_t               CallInfoElement;                

	lpSession = (GateSession *)(((LPDM3NetTSC)(pTsc->lpUserInfo))->lpUserInfo);
	stateFxn = lpSession->stateFxn;
    lpDm3NetTsc = (LPDM3NetTSC)(pTsc->lpUserInfo);

   /* 
    * First check if there was an error associated with the GetCallInfo command.
    */
   if (pStdErr) {
      switch(pStdErr->ErrorCode) {
         case Std_ErrBusy:
            printf("Got Std_ErrBusy as a respond to GetCallInfo.\n");
            break;
         
         case TSC_ErrCallIdentifier:
            printf("Got TSC_ErrCallIdentifier as a respond to GetCallInfo.\n");
            break;
         
         case TSC_ErrBadParm:
            printf("Got TSC_ErrBadParm as a respond to GetCallInfo.\n");
            break;
         
         default:    // All other errors
            printf("Got unknown error as a respond to GetCallInfo.\n");
            break;
      }
   }
   else {   // This is a normal message response to the command
 
      TSC_MsgGetCallInfoCmplt_get( pReplyMsg, 
                                   &CallInfoCmplt, 
                                   unOffset);

      /* Extract the Call information elements */
      unOffset = TSC_MsgGetCallInfoCmplt_varStart;

      /* For each call info extract the data */
      for (unCount = 0; unCount < CallInfoCmplt.Count; unCount++) {
          
         /* Get the fixed part of this element.  Note that on return, the
          * offset value will have been automatically updated by the macro
          * and will point to the start of the variable part of this data.
          */
         TSC_CallInfo_get(pReplyMsg, 
                          &CallInfoElement, 
                          unOffset);

         /* Extract the reply information */
		   NetTsc_Extract_Reply_Info(pTsc, CallInfoElement, pReplyMsg, &unOffset);
         

      } 

     /* Call the appropriate state machine function in the demo */
      rc = (*stateFxn)(lpDm3NetTsc, TSC_MsgGetCallInfoCmplt, NULL);
	
   }

   return (NULL);
}

///////////////////////////////////////////////////////////////////////
//        NAME : OnNetTscChanStateEvt
// DESCRIPTION : Called when channel state event is recieved 
//       INPUT : pTsc      Pointer to the TSC instance data structure
//             : pEvtData  Pointer to the Call State Structure.
//      OUTPUT : None.
//     RETURNS : A User defineable pointer to VOID
//    CAUTIONS : None.
///////////////////////////////////////////////////////////////////////
LPVOID OnNetTscChanStateEvt (LPDM3TSC pTsc, 
                          TSC_EvtChanState_t *pEvtData)
{

	GateSession   *lpCamelSession;
    gateStateFxn  stateFxn;
	USHORT        sessionNumber;
	BOOL          rc;
	LPDM3NetTSC       lpDm3NetTsc;

	lpCamelSession = ((LPDM3NetTSC)(pTsc->lpUserInfo))->lpUserInfo;
	stateFxn = lpCamelSession->stateFxn;
	sessionNumber = lpCamelSession->sessionNumber;
    lpDm3NetTsc = (LPDM3NetTSC)(pTsc->lpUserInfo);

   //TO DO: Insert application specific processing for this event here
   switch (pEvtData->Type) {
	   case TSC_EvtChanState_Type_OutOfService:
            /* Call the appropriate state nachine function in the demo */
		   rc = (*stateFxn)(lpDm3NetTsc, pEvtData->Type, (void *)pEvtData);
   
            /* Check return code */
            if(rc != DM3SUCCESS) {
               printf("State Machine Error on NetTSC Channel %d Event lx%x\n", 
                      sessionNumber, pEvtData->Type);
            }
			
		break;
   default:
      // Invalid Call State 
      printf("Got unexpected Chan State 0x%x.\n", pEvtData->Type);
      break;
   }

   return (NULL);
}

///////////////////////////////////////////////////////////////////////
//        NAME : OnNetTscMakeCallCmplt
// DESCRIPTION : called when a respond to make call is recieved
//       INPUT : pTsc      Pointer to the TSC instance data structure
//             : *EvtData  Pointer to the message payload
//             : *pStdErr  Pointer to the error payload or NULL if none.
//      OUTPUT : None.
//     RETURNS : A User defineable pointer to VOID
//    CAUTIONS : None.
///////////////////////////////////////////////////////////////////////
LPVOID OnNetTscMakeCallCmplt (LPDM3TSC pTsc, 
                           TSC_MsgMakeCallCmplt_t *pEvtData,
                           Std_MsgError_t *pStdErr)
{

	GateSession * pCamelSession;
    gateStateFxn   stateFxn;
	BOOL          rc;

   /* 
    * First check if there was an error associated with this command.  
    * The application writer should fill in the error handling code.
    */
   if (pStdErr) {
      switch(pStdErr->ErrorCode) 
      {
      case Std_ErrBusy:
         printf("Got Std_ErrBusy as a respond to MakeCall.\n");
            break;

         case TSC_ErrUnsupportedOp:
            printf("Got TSC_ErrUnsupportedOp as a respond to MakeCall.\n");
            break;

         case TSC_ErrChanState:
            printf("Got TSC_ErrChanState as a respond to MakeCall.\n");
            break;

         case TSC_ErrKVSetNotSupported:
            printf("Got TSC_ErrKVSetNotSupported as a respond to MakeCall.\n");
            break;

         default:    // All other errors
            printf("Got  unknown error as a respond to MakeCall.\n");
            break;
      }
   }
   else {   // This is a normal message response to a Make Call command
    
       pTsc->unCallState = CallState_Initiated;
       pCamelSession = (GateSession*)(((LPDM3NetTSC)(pTsc->lpUserInfo))->lpUserInfo);
       stateFxn = pCamelSession->stateFxn;


	   /* Call the appropriate state machine function in the demo */
       rc = (*stateFxn)(&(pCamelSession->NetTscComp),
                        TSC_MsgMakeCallCmplt,
                        NULL);

  }

   return (NULL);
}

///////////////////////////////////////////////////////////////////////
//        NAME : OnNetTscStdMsgCmplt
// DESCRIPTION : Application Event Handler for standard message responses
//       INPUT : pTsc         Pointer to the TSC instance data structure
//             : ulCmdType    Std Msg Command that initiated this reply
//             : ulReplyType  Type of reply received
//             : pReplyMsg    Complete reply message
//      OUTPUT : None.
//     RETURNS : A User defineable pointer to VOID
//    CAUTIONS : None.
///////////////////////////////////////////////////////////////////////
LPVOID OnNetTscStdMsgCmplt (LPDM3TSC      pTsc, 
                         ULONG         ulCmdType,
                         ULONG         ulReplyType,
                         QMsgRef       pReplyMsg)
{
   UINT              unOffset;
   LPVOID            lpReturnCode = NULL;
   BOOL              rc;
   Std_MsgError_t    ErrorData;
   Std_MsgError_t    *pStdErr = NULL;
   GateSession       *pSession;
   gateStateFxn      stateFxn;
	LPDM3NetTSC       lpDm3NetTsc;
   
   
   pSession = (GateSession*)(((LPDM3NetTSC)(pTsc->lpUserInfo))->lpUserInfo);
   stateFxn = pSession->stateFxn;
    lpDm3NetTsc = (LPDM3NetTSC)(pTsc->lpUserInfo);

   /* Perform the error checking first */
   if (ulReplyType == Std_MsgError) {

      // Extract the error payload
      Std_MsgError_get(pReplyMsg, 
                       &ErrorData, 
                       unOffset);

      pStdErr = &ErrorData;   // Since this is no longer NULL, it also serves 
                              // as a flag indicating the presence of an error.
   }
         

   /* TO DO: The user should fill in the handling for the specific completion 
    * events of interest.  
    */
   switch (ulReplyType) {
     
      case Std_MsgDetectxEvtsCmplt:
      case Std_MsgDetectEvtCmplt:
         /*
          * These events signify that a Detect event command completed 
          * successfully.   At this point, this event is "armed" and
          * a so called "empty MMB" has been put down to catch this event.  
          */

         /* Call the appropriate state nachine function in the demo */
		   rc = (*stateFxn)(lpDm3NetTsc, ulReplyType, NULL);

		   /* Check return code */
		   if(rc != DM3SUCCESS) {
			  printf("State Machine Error Event %d\n", ulReplyType);
		   }   

         break;

      case Std_MsgCancelAllEvtsCmplt:
      case Std_MsgCancelEvtCmplt:
      case Std_MsgCancelxEvtsCmplt:
      case Std_MsgGetParmCmplt:
      case Std_MsgGetxParmsCmplt:
         return (NULL); 
         break;
      default:    
         // An unexpected Reply type.
         printf("Got unexpected Std_Msg 0x%x.\n", ulReplyType);
         break;
   }


   return(NULL);
}

///////////////////////////////////////////////////////////////////////
//        NAME : OnNetTscGetCallStateCmplt
// DESCRIPTION : Called when a respond to TSC_GetCallState is recieved 
//       INPUT : pTsc      Pointer to the TSC instance data structure.
//             : pEvtData  Pointer to the message payload.
//             : pStdErr   Pointer to error information if any.
//      OUTPUT : None.
//     RETURNS : A User defineable pointer to VOID
//    CAUTIONS : None.
///////////////////////////////////////////////////////////////////////
LPVOID OnNetTscGetCallStateCmplt (LPDM3TSC pTsc, 
                               TSC_MsgGetCallStateCmplt_t *pEvtData,
                               Std_MsgError_t *pStdErr)
{
   /* 
    * First check if there was an error associated with this command.
    */
   if (pStdErr) {
      switch(pStdErr->ErrorCode) {
         case Std_ErrBusy:
            printf("Got Std_ErrBusy as a respond to CallState.\n");
            break;

         case TSC_ErrUnsupportedOp:
            printf("Got TSC_ErrUnsupportedOp as a respond to CallState.\n");
            break;
         
         case TSC_ErrChanState:
            printf("Got TSC_ErrChanState as a respond to CallState.\n");
            break;
         
         default:    // All other errors
            printf("Got unknown error as a respond to CallState.\n");
            break;
      }
   }
   else {   // This is a normal message response to this command

      pTsc->unCallState = pEvtData->CallState;

   }

   return (NULL);
}



⌨️ 快捷键说明

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