📄 cc1ind.c
字号:
if(OUT_PRIEVT->buf_adr == NULL)
{
return;
}
OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S;
SYS_WORK->out_ptr = OUT_PRIEVT->inf_adr;
cc_cause_write( Cc_cause_back ); /* write cause value info */
OUT_PRIEVT->inf_len = 5;
Cc_cause_back = 0;
}
}
else if(length > 0)
{
i = 0;
while(input_ptr < &IN_MSGDAT->dat[4] + length)
{
info_len = input_ptr[1] +2;
if ( info_len < 2 )
info_len = 0xFF;
for( ; i < RELEASE_COMP_ELEMENT_CNT; i++ )
{
if(*input_ptr == cc_release_comp_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(*input_ptr & BIT8)
{
PACKED_INT(input_ptr) ++;
if(ret == NG && lock_shift_flag== 1)
msg_flag |= BIT4;
}
else
{
if(ret == NG && (cc_release_comp_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_release_comp_info[i].element_id)
{
if(cc_release_comp_info[i].option_id == MANDA)
{
msg_flag |= BIT2; // mandatory information element is missing
i++;
break;
}
continue;
}
}
if (i == RELEASE_COMP_ELEMENT_CNT)
{
msg_flag |= BIT1;
}
}
if ( OUT_PRIEVT->inf_len == 0 )
{
m_frebuf( OUT_PRIEVT->buf_adr );
OUT_PRIEVT->buf_adr = 0;
OUT_PRIEVT->inf_adr = 0;
}
}
else
msg_flag |= BIT2;
SYS_WORK->tsk_id = TASKMNG; /* set task id */
OUT_PRIEVT->evt_cod = ECC; /* set event code */
OUT_PRIEVT->pri_cod = PSCALFAL; /* set message type */
m_excreq((U2*) &SYS_WORK->tsk_id ); /* send out */
cc_stop_time( 0xff ); /* stop all timer */
cc_reference_clear(); /* cc initial */
if(msg_flag & BIT3) /* option information element content error*/
{
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* get memory */
if(OUT_DLDEVT->msg_adr == NULL)
{
return;
}
OUT_MSGDAT->len = 12; /* output message data length */
SYS_WORK->out_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer*/
cc_cause_write( 0x64 ); /* write cause value info*/
// SYS_WORK->call_state = Cc_sts;
PACKED_INT(SYS_WORK->out_ptr)++;
cc_call_state_write(); /* write call state info */
cc_msg_write( CCL2_STATE ); /*write status message */
OUT_DLDEVT->dl_sou = 1;
m_excreq( (U2*)&SYS_WORK->tsk_id );
}
}
/************************************************************************/
/*Function Name : cc_facility_ind */
/*Function : handle the facility message received from CS. */
/* Process : */
/* Comment : parse facility message,if message content is correct */
/* then send facility 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_facility_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;
// if (( Cc_sts ) && (SYS_WORK->call_state == ST_NULL))
// {
// cc_p0_err();
// return;
// }
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 */
i = 0;
while(input_ptr < &IN_MSGDAT->dat[4] + length)
{
info_len = input_ptr[1] +2;
if ( info_len < 2 )
info_len = 0xFF;
for( ; i < FACILITY_ELEMENT_CNT; i++ )
{
if(*input_ptr == cc_facility_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(ret == NG && (cc_facility_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_facility_info[i].element_id)
{
if(cc_facility_info[i].option_id == MANDA)
{
msg_flag |= BIT2; // mandatory information element is missing
i++;
break;
}
continue;
}
}
if (i == FACILITY_ELEMENT_CNT)
{
msg_flag |= BIT1;
}
}
if ( OUT_PRIEVT->inf_len == 0 )
{
m_frebuf( OUT_PRIEVT->buf_adr );
OUT_PRIEVT->buf_adr = 0;
OUT_PRIEVT->inf_adr = 0;
}
if (( msg_flag & 0xfa ) == 0 )
{
SYS_WORK->tsk_id = TASKMNG; /* set task id */
OUT_PRIEVT->evt_cod = ECC; /* set event code */
OUT_PRIEVT->pri_cod = PSFCLTY; /* set message type */
m_excreq((U2*) &SYS_WORK->tsk_id ); /* send out */
}
if (msg_flag ) /* message information element have some error*/
{
reason = 0x62;
cc_cause_state(reason,msg_flag);
}
}
/************************************************************************/
/*Function Name : cc_state_enquiry_ind */
/*Function : handle the status enquiry message received from CS. */
/* Process : */
/* Comment : parse status enquiry message,if message content is correct */
/* then send call state to cs */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : none */
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
void cc_state_enquiry_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;
// if (( Cc_sts ) && (SYS_WORK->call_state == ST_NULL))
// {
// SYS_WORK->call_reference_value = Cc_txnum;
// }
OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); /* malloc memory */
if(OUT_DLDEVT->msg_adr == NULL)
{
return;
}
//OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S; /* output pointer address */
output_ptr = (U1*)(OUT_DLDEVT->msg_adr + 6 + 4); /* output pointer address */
OUT_MSGDAT->len = 0; /* output data length */
if(length > 0)
{
i = 0;
while(input_ptr < &IN_MSGDAT->dat[4] + length)
{
info_len = input_ptr[1] +2; /* information element length */
if ( info_len < 2 )
info_len = 0xFF;
for( ; i < STATE_ENQUIRY_ELEMENT_CNT; i++ )
{
if(*input_ptr == cc_state_enquiry_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr);
if(ret == NG && (cc_state_enquiry_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_MSGDAT->len += info_len;
i++;
break;
}
else
msg_flag |= BIT1; /* information element not exist */
}
}
}
reason = 0x1e; /* cause value#30:(response to status enquiry)*/
if ( msg_flag & BIT2 ) /* manda information element absnet*/
reason = 0x60; /* cause value#96*/
else if ( msg_flag & BIT3 ) /* manda information element content error */
reason = 0x64; /* cause value#100 */
else if( msg_flag & BIT1 ) /* unknown information element */
reason = 0x63; /* cause value#99 */
else if ( msg_flag & BIT4 ) /* option informatin element */
reason = 0x64; /* cause value#100 */
SYS_WORK->out_ptr = (U1*)&OUT_MSGDAT->dat[4]; /* output message data pointer*/
cc_cause_write( reason ); /* write cause info*/
PACKED_INT(SYS_WORK->out_ptr)++;
cc_call_state_write(); /* write calls state ifno */
OUT_MSGDAT->len = 12; /* output message data length */
cc_msg_write( CCL2_STATE ); /* write status message */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
}
/************************************************************************/
/*Function Name : cc_infomation_ind */
/*Function : handle the information message received from CS. */
/* Process : */
/* Comment : parse information message,if message content is correct */
/* then send information 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_infomation_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) /* message not contains infomation element */
{
m_frebuf(OUT_PRIEVT->buf_adr);
OUT_PRIEVT->inf_len = 0;
OUT_PRIEVT->buf_adr = 0;
OUT_PRIEVT->inf_adr = 0;
msg_flag = 0;
}
else if(length >0)
{
i = 0;
while(input_ptr < &IN_MSGDAT->dat[4] + length)
{
info_len = input_ptr[1] +2;
if ( info_len < 2 )
info_len = 0xFF;
for( ; i < INFORMATION_ELEMENT_CNT; i++ )
{
if(*input_ptr == cc_information_info[i].element_id)
{
ret = cc_info_element_chk(input_ptr); /* check informaion element content */
if(*input_ptr & BIT8) /* single information element */
{
PACKED_INT(input_ptr) ++;
if(ret == NG && lock_shift_flag== 1)
msg_flag |= BIT4;
}
else
{
if(ret == NG && (cc_information_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_information_info[i].element_id)
{
if(cc_information_info[i].option_id == MANDA)
{
msg_flag |= BIT2; // mandatory information element is missing
i++;
break;
}
continue;
}
}
if (i == INFORMATION_ELEMENT_CNT)
{
msg_flag |= BIT1;
}
}
if ( OUT_PRIEVT->inf_len == 0 )
{
m_frebuf( OUT_PRIEVT->buf_adr );
OUT_PRIEVT->buf_adr = 0;
OUT_PRIEVT->inf_adr = 0;
}
}
else
msg_flag |= BIT2; // mandatory information element is missing
if((msg_flag & 0xfa) == 0)
{
SYS_WORK->tsk_id = TASKMNG; /* set task id */
OUT_PRIEVT->evt_cod = ECC; /* set event code */
OUT_PRIEVT->pri_cod = PSADDINF; /* set message type */
m_excreq( (U2*)&SYS_WORK->tsk_id ); /* send out */
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -