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

📄 cc1ind.c

📁 phs 源代码 小灵通协议源代码 phs source code
💻 C
📖 第 1 页 / 共 5 页
字号:
	{
		i = 0;
		while(input_ptr < &IN_MSGDAT->dat[4] + length)
		{
			info_len = input_ptr[1] +2;    /* every information element content length */
			if ( info_len < 2 )
				info_len = 0xFF;

			for( ; i < PROCEED_ELEMENT_CNT; i++ )
			{
				if(*input_ptr == cc_proceed_info[i].element_id)
				{
					ret = cc_info_element_chk(input_ptr);  /* check information element content */

//					if(ret == NG )
//						msg_cause = 0x64;	/* information element content error */
					if(ret == NG && (cc_proceed_info[i].man_flag == MANDA))
						msg_flag |= BIT4;	/* mandatory information element content error */
					else if(ret == NG)
						msg_flag |= BIT3;  /* option information element content error */

					move_up_b( output_ptr, input_ptr, info_len );
					PACKED_INT(output_ptr) += info_len;
					PACKED_INT(input_ptr) += info_len;

					OUT_PRIEVT->inf_len += info_len;
					i++;
					break;
				}
				else if(*input_ptr != cc_proceed_info[i].element_id)
				{
					if(cc_proceed_info[i].option_id == MANDA)
					{
						msg_flag |= BIT2;   // mandatory information element is missing
						i++;
						break;
					}
					continue;

				}
			}
			if (i == PROCEED_ELEMENT_CNT)
			{
				msg_flag |= BIT1;  /* information element not exist / not implemented */
			}
		}
	}
	else
		msg_flag |= BIT2;  // mandatory information element is missing

	if((msg_flag & 0xfa) == 0)   /* send proceed indication to MN */
	{
		cc_stop_time( TC303ON );  /* stop timer tc303P	*/

		SYS_WORK->tsk_id = TASKMNG;		/* set task id*/
		OUT_PRIEVT->evt_cod = ECC;      	/*  set event code */
		OUT_PRIEVT->pri_cod = PSCALREC; /*set message type */
#ifdef EXT_IO
        HisOut(0,0xda,0x0b,0,0);
#endif
		m_excreq( (U2*)&SYS_WORK->tsk_id );

		if(p_state_table->state != 0xff)
		{
//			SYS_WORK->call_state = p_state_table->state;
			Cc_sts = (U1)p_state_table->state;
		}
	}

 	if(msg_flag)  /* messag have some error */
	{
	     reason = 0x62;
	     cc_cause_state(reason,msg_flag);
	}
}

/************************************************************************/
/*Function Name : cc_connect_ind						*/
/*Function	: handle the call connect message received from CS.	*/
/* Process	: 							*/
/* Comment 	: parse connect message,if message content is correct 	*/
/*			then send connect indiction to MN			*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_connect_ind()
{
	U1 *input_ptr = (U1*)&IN_MSGDAT->dat[4];    /* input message data,not contain message header */
	U1 *output_ptr = NULL;                /* output message buffer */
	U1 length = IN_MSGDAT->len - 4;        /* the length not contain header */
	U1 info_len = 0;
	U1 msg_flag = 0;
	U1 ret = NG_FF;
	int i;
	U1 reason =0;

	OUT_PRIEVT->buf_adr = m_hntbuf( );			/* malloc memory */
	if(OUT_PRIEVT->buf_adr == NULL)
	{
		return;
	}

	OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S;          /* output pointer address */
	output_ptr = OUT_PRIEVT->inf_adr;                       /* output pointer address */
	OUT_PRIEVT->inf_len = 0;                                /* output data length */

	if(length == 0)    /* not contain any information element */
	{
		m_frebuf(OUT_PRIEVT->buf_adr);
		OUT_PRIEVT->inf_len = 0;
		OUT_PRIEVT->buf_adr = 0;
		OUT_PRIEVT->inf_adr = 0;
	}
	else if(length > 0)
	{
		i= 0;
		while(input_ptr < &IN_MSGDAT->dat[4] + length)
		{
			info_len = input_ptr[1] +2;   /* every information element content length */
			if ( info_len < 2 )
				info_len = 0xFF;

			for( i = 0; i < CONNECT_ELEMENT_CNT; i++ )
			{
				if(*input_ptr == cc_connect_info[i].element_id)
				{
					ret = cc_info_element_chk(input_ptr);   /* check information element content */

//					if(ret == NG )
//						msg_cause = 0x64;	/* information element content error */
					if(ret == NG && (cc_connect_info[i].man_flag == MANDA))
						msg_flag |= BIT4;	/* mandatory information element content error */
					else if(ret == NG)
						msg_flag |= BIT3;  /* option information element content error */

					move_up_b( output_ptr, input_ptr, info_len );
					PACKED_INT(output_ptr) += info_len;
					PACKED_INT(input_ptr) += info_len;

					OUT_PRIEVT->inf_len += info_len;
					i++;
					break;
				}
				else if(*input_ptr != cc_connect_info[i].element_id)
				{
					if(cc_connect_info[i].option_id == MANDA)
					{
						msg_flag |= BIT2;    // mandatory information element is missing
						i++;
						break;
						//return;
					}
					continue;
				}
			}
			if (i == CONNECT_ELEMENT_CNT)
			{
				msg_flag |= BIT1; /* information element not exist / not implemented */
			}

		}
	}
	else
		msg_flag |= BIT2;   // mandatory information element is missing

	if((msg_flag & 0xfa) == 0)
	{
		cc_stop_time( TC303ON );   /* stop timer tc303P	*/

		if ( OUT_PRIEVT->inf_len == 0 )
		{
			m_frebuf( OUT_PRIEVT->buf_adr ); /* free memory */
			OUT_PRIEVT->buf_adr = 0;
			OUT_PRIEVT->inf_adr = 0;
		}

		SYS_WORK->tsk_id = TASKMNG;			/* set task id */
		OUT_PRIEVT->evt_cod = ECC;              	/* set event code */
		OUT_PRIEVT->pri_cod = PSCALPRC;         /* send message type */
		m_excreq( (U2*)&SYS_WORK->tsk_id );          /* send out */

		Cc_recall_flg = 0;  /* recall state */

		if(p_state_table->state != 0xff)    //zch0710
		{
//			SYS_WORK->call_state = p_state_table->state;
			Cc_sts = (U1)p_state_table->state;  /* cc state change to P10 state */
		}
	}

	if(msg_flag)  /* message info element have error  */
	{
	     reason = 0x62;
	     cc_cause_state(reason,msg_flag);
	}
}

/************************************************************************/
/*Function Name : cc_connect_ack_ind						*/
/*Function	: handle the call connect ack message received from CS.	*/
/* Process	: 							*/
/* Comment 	: parse connect ack message,if message content is correct 	*/
/*			then send connect indiction to MN			*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_connect_ack_ind( )
{
	U1 *input_ptr = (U1*)&IN_MSGDAT->dat[4];        /* input message data,not contain message header */
	U1 *output_ptr = NULL;                    /* output message buffer */
	U1 length = IN_MSGDAT->len - 4;            /* the length not contain header */
	U1 info_len = 0;
	U1 msg_flag = 0;
	U1 ret = NG_FF;
	int i;
	U1 reason =0;

	OUT_PRIEVT->buf_adr = m_hntbuf( );			/* malloc memory */
	if(OUT_PRIEVT->buf_adr == NULL)
	{
		return;
	}

	OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S;          /* output pointer address */
	output_ptr = OUT_PRIEVT->inf_adr;                       /* output pointer address */
	OUT_PRIEVT->inf_len = 0;                                /* output data length */

	if(length == 0)
	{
		m_frebuf(OUT_PRIEVT->buf_adr);
		OUT_PRIEVT->inf_len = 0;
		OUT_PRIEVT->buf_adr = 0;
		OUT_PRIEVT->inf_adr = 0;
	}
	else if(length > 0)
	{
		i = 0;
		while(input_ptr < &IN_MSGDAT->dat[4] + length)
		{
			info_len = input_ptr[1] +2;    /* every information element content length */
			if ( info_len < 2 )
				info_len = 0xFF;

			for( ; i < CONNECT_ACK_ELEMENT_CNT; i++ )
			{
				if(*input_ptr == cc_connect_ack_info[i].element_id)
				{
					ret = cc_info_element_chk(input_ptr);  /* check information element content */

//					if(ret == NG )
//						msg_cause = 0x64;	/* information element content error */
					if(ret == NG && (cc_connect_ack_info[i].man_flag == MANDA))
						msg_flag |= BIT4;	/* mandatory information element content error */
					else if(ret == NG)
						msg_flag |= BIT3;  	/* option information element content error */

					move_up_b( output_ptr, input_ptr, info_len );
					PACKED_INT(output_ptr) += info_len;
					PACKED_INT(input_ptr) += info_len;

					OUT_PRIEVT->inf_len += info_len;
					i++;
					break;
				}
				else if(*input_ptr != cc_connect_ack_info[i].element_id)
				{
					if(cc_connect_ack_info[i].option_id == MANDA)
					{
						msg_flag |= BIT2;   // mandatory information element is missing
						i++;
						break;
					}
					continue;
				}
			}
			if (i == CONNECT_ACK_ELEMENT_CNT)
			{
				msg_flag |= BIT1;   /* information element not exist / not implemented */
			}
		}
	}
	else
		msg_flag |= BIT2;

	if((msg_flag & 0xfa) == 0)
	{
		cc_stop_time( TC313ON );


		SYS_WORK->tsk_id = TASKMNG;
		OUT_PRIEVT->evt_cod = ECC;
		OUT_PRIEVT->pri_cod = PSCALPRC;
		m_excreq( (U2*)&SYS_WORK->tsk_id );

		if(p_state_table->state != 0xff)    //zch0710
		{
//			SYS_WORK->call_state = p_state_table->state;
			Cc_sts = (U1)p_state_table->state;
		}
	}
	if(msg_flag)
	{
	     reason = 0x62;
	     cc_cause_state(reason,msg_flag);
	}
}

/************************************************************************/
/*Function Name : cc_setup_ack_ind						*/
/*Function	: handle the setup ack message received from CS.	*/
/* Process	: 							*/
/* Comment 	: parse setup ack message,if message content is correct 	*/
/*			then send setup ack indiction to MN			*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_setup_ack_ind( )
{
	U1 *input_ptr =(U1*)&IN_MSGDAT->dat[4];    /* input message data,not contain message header */
	U1 *output_ptr = NULL;                /* output message buffer */
	U1 length = IN_MSGDAT->len - 4;        /* the length not contain header */
	U1 info_len = 0;
	U1 msg_flag = 0;
	U1 ret = NG_FF;
	int i;
	U1 reason =0;

	OUT_PRIEVT->buf_adr = m_hntbuf( );   			/* malloc memory */
	if(OUT_PRIEVT->buf_adr == NULL)
	{
		return;
	}

	OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S;          /* output pointer address */
	output_ptr = OUT_PRIEVT->inf_adr;                       /* output pointer address */
	OUT_PRIEVT->inf_len = 0;                                /* output data length */

	if(length == 0)
	{
		m_frebuf(OUT_PRIEVT->buf_adr);
		OUT_PRIEVT->inf_len = 0;
		OUT_PRIEVT->buf_adr = 0;
		OUT_PRIEVT->inf_adr = 0;
	}
	else if(length > 0)
	{
		i = 0;
		while(input_ptr < &IN_MSGDAT->dat[4] + length)
		{
			info_len = input_ptr[1] +2;   /* every information element content length */
			if ( info_len < 2 )
				info_len = 0xFF;

			for(; i < SETUP_ACK_ELEMENT_CNT; i++ )
			{
				if(*input_ptr == cc_setup_ack_info[i].element_id)
				{
					ret = cc_info_element_chk(input_ptr);      /* check information element content */

					if(ret == NG && (cc_setup_ack_info[i].man_flag == MANDA))
						msg_flag |= BIT4;	/* mandatory information element content error */
					else if(ret == NG)
						msg_flag |= BIT3;       /* option information element content error */

					move_up_b( output_ptr, input_ptr, info_len );
					PACKED_INT(output_ptr) += info_len;
					PACKED_INT(input_ptr) += info_len;
					OUT_PRIEVT->inf_len += info_len;
					i++;
					break;
				}
				else if(*input_ptr != cc_setup_ack_info[i].element_id)
				{
					if(cc_setup_ack_info[i].option_id == MANDA)
					{
						msg_flag |= BIT2;   // mandatory information element is missing
						i++;
						break;
					}
					continue;
				}
			}
			if (i == SETUP_ACK_ELEMENT_CNT)
			{
				msg_flag |= BIT1;	/* information element not exist / not implemented */
			}
		}
	}
	else
		msg_flag |= BIT2;

	if((msg_flag & 0xfa) == 0)
	{
		cc_stop_time( TC303ON );
		SYS_WORK->tsk_id = TASKMNG;
		OUT_PRIEVT->evt_cod = ECC;
		OUT_PRIEVT->pri_cod = PSCALCNF;
		m_excreq( (U2*)&SYS_WORK->tsk_id );

		if(p_state_table->state != 0xff)    //zch0710
		{

⌨️ 快捷键说明

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