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

📄 cc2req.c

📁 phs 源代码 小灵通协议源代码 phs source code
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_infomation_req( )
{
	//U1	len_plus;
	U2 length = IN_PRIEVT->inf_len;		 	/* input message data length */
	U1 info_len = 0;
	U1 *input_ptr = IN_PRIEVT->inf_adr;       /* input message data pointer */
	U1 *output_ptr = NULL;                  /* output message data pointer */
	int i;
	U1 ret = NG_FF;

	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( );  /* get memory */
	//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
	OUT_MSGDAT->len = 4;    /* send message header length */

	output_ptr = (U1*)&OUT_MSGDAT->dat[4];    		/* output message data pointer */
	while(input_ptr < IN_PRIEVT->inf_adr + length)
	{
		info_len = input_ptr[1] +2;             /* every information element length */
		if ( info_len < 2 )
			info_len = 0xFF;
		for( i = 0; i < INFORMATION_ELEMENT_CNT; i++ )/* match message information element in table */
		{
			if(*input_ptr == cc_information_info[i].element_id)
			{
				ret = cc_info_element_chk(input_ptr);

				if(*input_ptr & BIT8)  /* single information element */
					info_len = 1;

				move_up_b( output_ptr, input_ptr, info_len );
				PACKED_INT(output_ptr) += info_len;
				PACKED_INT(input_ptr) += info_len;
				OUT_MSGDAT->len += info_len;
				break;
			}
		}
	}

	cc_msg_write( CCL2_INFO );		/* write information message */
	if ( IN_PRIEVT->add_dat )               	/* need transfer confirm */
	{
		OUT_DLDEVT->dl_sou = 1;         	/* need transfer confirm */
		disconnect_complete_flag = 4;
	}
	m_excreq((U2*) &SYS_WORK->tsk_id );          /* send out */
}


/************************************************************************/
/*Function Name : cc_facility_req						*/
/*Function	: handle facility message	  		*/
/* Process	: 							*/
/* Comment 	: parse facility message from MN,then send message to L2 	*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_facility_req( )
{
	//U1	len_plus;
	U2 length = IN_PRIEVT->inf_len;     	 	/* input message data length */
	U1 info_len = 0;
	U1 *input_ptr = IN_PRIEVT->inf_adr;       /* input message data pointer */
	U1 *output_ptr = NULL;                  /* output message data pointer */
	int i;
	U1 ret = NG_FF;

	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory */
	//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
	OUT_MSGDAT->len = 4;   /* send message  header length */

	output_ptr = (U1*)&OUT_MSGDAT->dat[4];       		/* output message data pointer */
	while(input_ptr < IN_PRIEVT->inf_adr + length)
	{
		info_len = input_ptr[1] +2;                     /* every information element length */
		if ( info_len < 2 )
			info_len = 0xFF;
		for( i = 0; i < FACILITY_ELEMENT_CNT; i++ )/* match message information element in table */
		{
			if(*input_ptr == cc_facility_info[i].element_id)
			{
				ret = cc_info_element_chk(input_ptr);

				if(*input_ptr & BIT8)  /* single information element */
					info_len = 1;

				move_up_b( output_ptr, input_ptr, info_len );
				PACKED_INT(output_ptr) += info_len;
				PACKED_INT(input_ptr) += info_len;
				OUT_MSGDAT->len += info_len;
				break;
			}
		}
	}
	cc_msg_write( CCL2_FACILITY );            /* write facility message */
	m_excreq((U2*) &SYS_WORK->tsk_id );            /* send out */
}


/************************************************************************/
/*Function Name : cc_disconnect_req						*/
/*Function	: handle disconnect  message to cs 	  		*/
/* Process	: 							*/
/* Comment 	: parse disconnect message from MN,then send message to L2 	*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_disconnect_req( )
{
//	U1	len_plus;
	U2 length = IN_PRIEVT->inf_len;		 	/* input message data length */
	U1 info_len = 0;
	U1 *input_ptr = IN_PRIEVT->inf_adr;       /* input message data pointer */
	U1 *output_ptr = NULL;                  /* output message data pointer */
	int i;
	U1 ret = NG_FF;

	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( );	/* get memory*/
	//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
	OUT_MSGDAT->len = 4;                            /* send message header length */

	output_ptr = (U1*)&OUT_MSGDAT->dat[4];		/* output message data pointer */
	while(input_ptr < IN_PRIEVT->inf_adr + length)
	{
		info_len = input_ptr[1] +2;             /* every information element length */
		if ( info_len < 2 )
			info_len = 0xFF;
		for( i = 0; i < DISCONNECT_ELEMENT_CNT; i++ )/* match message information element in table */
		{
			if(*input_ptr == cc_disconnect_info[i].element_id)
			{
				ret = cc_info_element_chk(input_ptr);

				if(*input_ptr & BIT8)  /* single information element */
					info_len = 1;

				move_up_b( output_ptr, input_ptr, info_len );
				PACKED_INT(output_ptr) += info_len;
				PACKED_INT(input_ptr) += info_len;
				OUT_MSGDAT->len += info_len;
				break;
			}
		}
	}
	cc_stop_time( 0xff );	/* stop all timer */
	cc_msg_write( CCL2_DISCONNECT );         /* write disconnect message */
	if ( IN_PRIEVT->add_dat )                	/* need transfer confirm */
	{
		OUT_DLDEVT->dl_sou = 1;          	/* need transfer confirm */
		disconnect_complete_flag = 4;
	}
	m_excreq( (U2*)&SYS_WORK->tsk_id );           /* send out */

	cc_set_time( TC305ON );                  	/* start timer tc305p*/
	if(p_state_table->state != 0xff)
	{
		Cc_sts = (U1)p_state_table->state; /* cc state change to P11 state */
	}
}


/************************************************************************/
/*Function Name : cc_release_req						*/
/*Function	: handle call release message to cs	  		*/
/* Process	: 							*/
/* Comment 	: parse release message from MN,then send message to L2 	*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_release_req( )
{
//	U1	len_plus;
	U2 length = IN_PRIEVT->inf_len;		 	/* input message data length */
	U1 info_len = 0;
	U1 *input_ptr = IN_PRIEVT->inf_adr;       /* input message data pointer */
	U1 *output_ptr = NULL;                  /* output message data pointer */
	int i;
	U1 ret = NG_FF;

	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory*/
	//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
	OUT_MSGDAT->len = 4;                            /* send message header length */

	if(( Cc_sts == ST_DSCIND ) && ( Cc_cause_back ))
	{
		SYS_WORK->out_ptr = (U1*)&OUT_MSGDAT->dat[4];       /* output message data pointer */
		cc_cause_write( Cc_cause_back );   /* write cause value*/
		OUT_MSGDAT->len += 5;  /* message data length */
		Cc_cause_back = 0;
	}
	else
	{
		output_ptr = (U1*)&OUT_MSGDAT->dat[4];		/* output message data pointer */
		while(input_ptr < IN_PRIEVT->inf_adr + length)
		{
			info_len = input_ptr[1] +2;             /* every information element length */
			if ( info_len < 2 )
				info_len = 0xFF;
			for( i = 0; i < RELEASE_ELEMENT_CNT ;i++ )   /* match message information element in table */
			{
				if(*input_ptr == cc_release_info[i].element_id)
				{
					ret = cc_info_element_chk(input_ptr);

					if(*input_ptr & BIT8)  /* single information element */
						info_len = 1;

					move_up_b( output_ptr, input_ptr, info_len );
					PACKED_INT(output_ptr) += info_len;
					PACKED_INT(input_ptr) += info_len;
					OUT_MSGDAT->len += info_len;
					break;
				}
			}
		}
	}
	cc_msg_write( CCL2_RELEASE );		/* write release message*/
	m_excreq( (U2*)&SYS_WORK->tsk_id );          /* send out */

	cc_set_time( TC308ON );                 	/* start timer tc308P */
	Cc_timcm &= ~TC308ON;                   	/* first start tc308P*/
	if(p_state_table->state != 0xff)
	{
		Cc_sts = (U1)p_state_table->state;           /* cc state change to P11 state*/
	}
}


/************************************************************************/
/*Function Name : cc_option_req						*/
/*Function	: handle option message to cs   		*/
/* Process	: 							*/
/* Comment 	: parse option message from MN,then send message to L2 	*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
void cc_option_req( )
{
	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( );   /* get memory */
	OUT_MSGDAT->len = (U1)(IN_PRIEVT->inf_len-1+CC_FMT_SZ);       /* message data length */
	move_up_b( (U1*)(OUT_DLDEVT->msg_adr +10), (U1*)(IN_PRIEVT->inf_adr+1), (U2)(IN_PRIEVT->inf_len-1) );
	cc_msg_write( *IN_PRIEVT->inf_adr );   /* write option message */
	m_excreq( (U2*)&SYS_WORK->tsk_id );         	/* send out */
}


/************************************************************************/
/*Function Name : cc_dial_req						*/
/*Function	: handle facility message to cs 		*/
/* Process	: 							*/
/* Comment 	: parse facility message from MN,then send message to L2 	*/
/* Author 	: tara zhang 						*/
/* Time 	: 2003/08/02 						*/
/* Return Value : none 							*/
/* Parameter 	: none							*/
/************************************************************************/
/** Modify by: MMM, MM/dd/yy						*/
/** Modify purpose:							*/
/************************************************************************/
/*从MN任务发送来的拨号请求*/
void cc_dial_req( )
{
	U1 *input_ptr = IN_PRIEVT->inf_adr;
	U1 *out_ptr = NULL;

	OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( );  /* get memory */
	//OUT_MSGDAT->dat = OUT_DLDEVT->msg_adr +MSB_S;
	out_ptr = (U1*)&OUT_MSGDAT->dat[4];
	OUT_MSGDAT->len = 4;

	*(out_ptr) = FACILITY;			/* facility info element 	*/
	*(out_ptr+2) = 0x91;                  /* remote operation protocol*/
	*(out_ptr+3) = 0xa1;                  /* component type tag*/
	*(out_ptr+5) = 0x02;                  /* invoke identifier tag*/
	*(out_ptr+6) = 0x01;                  /* invoke identifier length*/
	*(out_ptr+7) = Cc_txnum;          /* call reference 	*/
	*(out_ptr+8) = 0x06;                  /* operation value tag*/
	*(out_ptr+9) = 0x09;                  /* operation value length*/
	*(out_ptr+10) = 0x02;			/* 14a*/
	*(out_ptr+11) = 0x83;			/* 14b*/
	*(out_ptr+12) = 0x38;			/* 14c*/
	*(out_ptr+13) = 0x8c;			/* 14d*/
	*(out_ptr+14) = 0x9a;			/* 14e*/
	*(out_ptr+15) = 0x5c;			/* 14f*/
	*(out_ptr+16) = 0x41;			/* 14g*/
	*(out_ptr+17) = 0x01;			/* 14h*/
	*(out_ptr+18) = 0x01;			/* 14i*/
	*(out_ptr+19) = 0x31;			/* 15.1*/
	*(out_ptr+21) = 0x81;			/* 15.3.1 PB singal		*/
	*(out_ptr+22) = *(input_ptr+1);  /* length */
	move_up_b( out_ptr+23, input_ptr+2,(U2)(*(input_ptr+1)) );

	*(out_ptr+20) = *(input_ptr+1) + 2;    /* 15.2 length 		*/
	*(out_ptr+4) = *(out_ptr+20)+ 16;			/* protocol data unit content length */
	*(out_ptr+1) = *(out_ptr+4) + 3;                /* all content length	*/
	OUT_MSGDAT->len = *(out_ptr+1) + 2 +4;           /* message data length */

	/*填写发发送到L2任务的消息*/
	cc_msg_write( CCL2_FACILITY );    /* write facility message */
	OUT_DLDEVT->dl_sou = 1;           /*  need transfer confirm */
	disconnect_complete_flag = 4;
	/*执行L2任务*/
	m_excreq((U2*) &SYS_WORK->tsk_id );
}

#undef __CC2REQ_C_

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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