📄 cc0main.c
字号:
return(OK);
}
mask = msg_ptr[4 + flag3] & 0x60; /* layer 1 identification */
if(mask != 0x20)
{
return(NG);
}
mask = msg_ptr[4 + flag3] & 0x1f; /* user information layer1 protocol */
if( ((mask >= 0x01) && (mask <= 0x03)) ||
((mask >= 0x07) && (mask <= 0x09)) )
{
;
}
else if(mask != 0x04) /*G.726 32Kbit/s*/
{
return(NG);
}
if(!(msg_ptr[4 + flag3] & 0x80)) /*OCT 5's extention bit=0*/
{
if(msg_ptr[1] < 4 + flag3)
{
return(NG);
}
}
/* ignore the 5a,5b,5c,5d*/
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER 13 */
/* CALL void cc_code0_high_capability_chk */
/* PARAM msg_ptr is high layer compatibility element info buffer. */
/* DISCRIPTION: msg_ptr[0]: emement_id---HIGH_LAYER_CAPIBILITY */
/* msg_ptr[1]: HIGH_LAYER_CAPIBILITY content length. */
/* msg_ptr[2]: include coding standard(bit 6,7), */
/* interpretation(bit 3-5)and presentation method of protocol profile*/
/* (bit 1,2) */
/* msg_ptr[3]: high layer characteristics identification(bit1-7) */
/* msg_ptr[4]: extended high layer characteristics identification(bit1-7) */
/* RETURN: the element info whether or not effect. */
/****************************************************************************/
U1 cc_code0_high_capability_chk( U1 *msg_ptr )
{
U1 mask;
if(msg_ptr[2] & 0x80) /* extention bit=1 */
{
mask = msg_ptr[2] & 0x1c; /* interpretation bits */
if(mask != 0x10) /* 0x10 indicator the first high layer characteristics
identification is used in the call */
{
return(NG);
}
mask = msg_ptr[2] & 0x03; /* presentation method of protocol profile */
if(mask != 0x01) /* 0x01 indicator high layer protocol profile
(without specification of attributes) */
{
return(NG);
}
}
else
{
return(NG);
}
if(msg_ptr[1] < 2)
{
return(OK);
}
mask = msg_ptr[3] & 0x7f; /*high layer characteristics indentification*/
if( (mask != 0x01) && (mask != 0x04) && (mask != 0x21) && (mask != 0x24) &&
(mask != 0x28) && (mask != 0x31) && (mask != 0x32) && (mask != 0x33) &&
(mask != 0x35) && (mask != 0x38) && (mask != 0x41) && (mask != 0x5e) &&
(mask != 0x5f) && (mask != 0x60) && (mask != 0x61) )
{
return(NG);
}
if(msg_ptr[3] & 0x80) /*if oct 4 bit8=1,*/
{
if(msg_ptr[1] > 2)
{
return(NG); /*the length should =2*/
}
return(OK);
}
else
{
if(msg_ptr[1] < 3) /*IF bit8=0,the length should be =3*/
{
return(NG);
}
}
if(msg_ptr[4] & 0x80) /*if 4a exists and extention bit=1*/
{
mask = msg_ptr[4] & 0x7f; /*extended high layer characteristics identification */
if( (mask != 0x01) && (mask != 0x04) && (mask != 0x21) &&
(mask != 0x24) && (mask != 0x28) && (mask != 0x31) &&
(mask != 0x32) && (mask != 0x33) && (mask != 0x35) &&
(mask != 0x38) && (mask != 0x41) && (mask != 0x60) &&
(mask != 0x61) )
{
return(NG);
}
}
else
{
return(NG);
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER */
/* CALL U1 cc_code0_user_user_chk( U1 *msg_ptr) */
/* PARAM unsigned char *msg_ptr : user-user information element buffer*/
/* FUNC check user-user information element*/
/* RETURN the element info whether or not effect. */
/* */
/****************************************************************************/
U1 cc_code0_user_user_chk( U1 *msg_ptr )
{
if (version >= V3)
{
if (p_msg_header->msg_type != L2_USER) /* if not received user information message */
{
if (msg_ptr[1] > 129)/* information element content length > 129 */
{
return(NG);
}
}
switch (msg_ptr[2]) /* protocol discriminator */
{
case 0x00: /* user-specific protocol */
case 0x01: /* OSI high layer protocol */
case 0x04: /* IA5 characters */
case 0x08: /* RCR STD-28 call control message */
case 0x42: /* common channel interface between PBXs */
case 0x43: /* common format of specific application */
break;
default:
return(NG);
}
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER */
/* CALL U1 cc_code0_charge_advice_chk( U1 *msg_ptr) */
/* PARAM unsigned char *msg_ptr : charge advice information element buffer*/
/* FUNC check charge advice information element */
/* RETURN the element info whether or not effect. */
/* */
/****************************************************************************/
U1 cc_code0_charge_advice_chk( U1 *msg_ptr )
{
U1 mask;
U1 i;
if(msg_ptr[2] & 0x80) /* extension bit is 1 */
{
if(msg_ptr[2] & 0x70) /* bit 5-7 is reserved */
{
return(NG);
}
mask = msg_ptr[2] & 0x0f; /* bit 1-4 is charge type */
if( (mask != 0x02) && (mask < 0x08) ) /* reserved */
{
return(NG);
}
}
else /* extension bit is 0*/
{
return(NG);
}
for(i = 3; i < msg_ptr[1]+2; i++) /* charge indicate */
{
if(msg_ptr[i] & 0x80) /* extension bit is 0 */
{
return(NG);
}
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER */
/* CALL U1 cc_code5_ps_num_chk( U1 *msg_ptr) */
/* PARAM unsigned char *msg_ptr : PS identity information element buffer*/
/* FUNC check PS identity information element */
/* RETURN the element info whether or not effect.
OK:normal
NG:wrong*/
/* */
/****************************************************************************/
U1 cc_code5_ps_num_chk( U1 *msg_ptr )
{
U1 mask;
if(msg_ptr[2] & 0x80) /* bit8 is reserved */
{
return(NG);
}
mask = msg_ptr[2] & 0x70; /* bit 5-7 is paging service type */
if( (mask == 0x00) || (mask == 0x40) ) /* 0x00 is reserved */
/* 0x40 shows paging service by BCD 13 digits or less digit PS number */
{
return(NG);
}
if(mask == 0x50) /* shows paging service by extension paging service type */
{
if((msg_ptr[8] & 0x0f) != 0x02) /* maybe reserved except 0x02 and 0x04 */
{
return(NG);
}
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER */
/* CALL U1 cc_code5_man_call_origin_chk( U1 *msg_ptr) */
/* PARAM unsigned char *msg_ptr : manual call origination information element buffer*/
/* FUNC check manual call origination information element */
/* RETURN the element info whether or not effect.
OK:normal
NG:wrong */
/* */
/****************************************************************************/
U1 cc_code5_man_call_origin_chk( U1 *msg_ptr )
{
U1 mask;
if(msg_ptr[2] & 0x80) /* extension bit is 1 */
{
mask = msg_ptr[2] & 0x7f; /* bit 1-7 is manual call content */
if(mask != 0x01) /* reserved except 0x01 */
{
return(NG);
}
}
else /* extension bit not used */
{
return(NG);
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER */
/* CALL U1 cc_code5_comm_type_chk( U1 *msg_ptr) */
/* PARAM unsigned char *msg_ptr :communication type information element buffer*/
/* FUNC check communication type information element */
/* RETURN the element info whether or not effect.
OK:normal
NG:wrong */
/* */
/****************************************************************************/
U1 cc_code5_comm_type_chk( U1 *msg_ptr )
{
U1 mask;
if(msg_ptr[2] & 0x80) /* used extension bit */
{
mask = msg_ptr[2] & 0x7f; /* bit1-7 is communication type */
if( (mask != 0x00) && (mask != 0x01) ) /* reserved except 0x00,0x01 */
{
return(NG);
}
}
else /* not used extension bit */
{
return(NG);
}
return(OK);
}
/****************************************************************************/
/* */
/* NUMBER XX */
/* CALL U1 seam_outo_jump( void ) */
/* PARAM -- */
/* FUNC */
/* */
/****************************************************************************/
void seam_outo_jump(void)
{
cc_stop_time(0x01); /* TC303P stop */
Cc_recall_flg = 0; /* recall state */
// SYS_WORK->call_state = ST_ACTV;
Cc_sts = ST_ACTV; /* call state is communication state */
SYS_WORK->tsk_id = TASKMNG; /* cc state is communication state */
OUT_PRIEVT->evt_cod = ECC;
OUT_PRIEVT->pri_cod = PSCALPRC; /* event code */
m_excreq((U2*) &SYS_WORK->tsk_id ); /* message type */
}
/************************************************************************/
/*Function Name : cc_check_msg_header */
/*Function : check message header */
/* Process : */
/* Comment : check protocol discriminator,call reference, */
/* and message type */
/* Author : tara zhang */
/* Time : 2003/08/02 */
/* Return Value : OK: message header is correct */
/* NG: message header err,then this message should ignore*/
/* Parameter : none */
/************************************************************************/
/** Modify by: MMM, MM/dd/yy */
/** Modify purpose: */
/************************************************************************/
U1 cc_check_msg_header( cc_msg_header* p_msg_header ) //zch0710
{
U1 ret = NG;
int i;
U1 msg_cause = 0;
if ((( p_msg_header->call_reference[0] & 0x0f) == 0x01 )&& ( p_msg_header->protocol_id == CC_ID ) )
{/*CC part: call reference length is 1,protocol discriminator is 0x45 */
ret = OK;
}
for( i = 0; i < CC_L2_TBL_MAX; i++ )
{
if( p_msg_header->msg_type == cc_l2_msg_tbl[i] )
{
break;
}
}
if(i == CC_L2_TBL_MAX-1) /* if not find message type */
{
msg_cause = 0x62; /* message not compatible with call state or message not exist or not implemented. */
return (ret);
}
if((Cc_sts == ST_NULL) && (L2CC_SETUP == p_msg_header->msg_type))
{
if(p_msg_header->call_reference[1] &0x80) /* call reference flag: 0 indictor sent from call origin side;
1 indictor sent to call origin side */
{
msg_cause = 0x51; /* call reference value error */
return (ret); /* if call reference error,then the message ignore */
}
else
{
Cc_rxnum = p_msg_header->call_reference[1]; /* MO side: call reference flag should be 0*/
Cc_txnum = p_msg_header->call_reference[1] |0x80; /* call reference flag should be 1: MT side */
ret = OK;
}
}
else if((Cc_sts >= ST_CALINT) && (Cc_sts <= ST_ACTV))
{ /* check received call reference value whether or not correct */
if(((Cc_rxnum ^ p_msg_header->call_reference[1]) &0x7f )
|| ((p_msg_header->call_reference[1] ^ ~(Cc_txnum &0x80)) &0x80))
{
msg_cause = 0x51; /* call reference value error */
return (ret);
}
}
return (ret);
}
/****************************************************************************
NUMBER 2
CALL U1 cc_cause_rel_comp(void)
PARAM reason: cause type
FUNC send call release complete message to cs
RETURN void
Revision History:
Modification Tracking
Author Date Number Description of Changes
------------------------- ------------ ---------- ------------------------------
tara zhang 08/06/2003 Initial version.
****************************************************************************/
void cc_cause_rel_comp(U1 reason)
{
SYS_WORK->out_ptr = (U1*)&OUT_MSGDAT->dat[4];
cc_cause_write( reason );
OUT_MSGDAT->len= CC_FMT_SZ+5;
cc_msg_write( CCL2_RELEASE_COMPLETE );
OUT_DLDEVT->dl_sou = 1;
m_excreq( (U2*)&SYS_WORK->tsk_id );
/////////////////////////////////////////
OUT_PRIEVT->buf_adr = m_hntbuf( );
//W_out_msg_p = OUT_PRIEVT->buf_adr+MSB_S;
SYS_WORK->out_ptr = OUT_PRIEVT->buf_adr+MSB_S;
cc_cause_write( reason );
OUT_PRIEVT->inf_adr = OUT_PRIEVT->buf_adr+MSB_S;
OUT_PRIEVT->inf_len = 5;
SYS_WORK->tsk_id = TASKMNG;
OUT_PRIEVT->evt_cod = ECC;
OUT_PRIEVT->pri_cod = PSCALFAL;
m_excreq( (U2*)&SYS_WORK->tsk_id );
}
/****************************************************************************
NUMBER 2
CALL U1 cc_cause_release(void)
PARAM reason: cause type
msg_flag:message content state
msg_type:message type
FUNC send call release message to cs
RETURN void
Revision History:
Modification Tracking
Author Date Number Description of Changes
------------------------- ------------ ---------- ------------------------------
tara zhang 08/06/2003 Initial version.
****************************************************************************/
void cc_cause_release(U1 reason,U1 msg_flag,U1 msg_type)
{
//OUT_DLDEVT->msg_adr = (CC_MSGDAT *)m_hntbuf( ); //zch1030
OUT_MSGDAT->len = CC_FMT_SZ;
if( msg_flag & BIT2 ) /* manda information element absnet */
reason = 0x60; /* cause value#96 (mandatory informatin element is missing)*/
else if( msg_flag & BIT3 ) /* manda information element content error*/
reason = 0x64; /* cause value#100 */
else if( msg_flag & BIT1 ) /* unknown infroamtion element */
reason = 0x63; /* cause value#99 */
else if ( msg_flag & BIT4 ) /* option informatin element */
reason = 0x64; /* cause value#100 */
if ( reason )
{
//W_out_msg_p = OUT_msg_jadr;
SYS_WORK->out_ptr = (U1*)&OUT_MSGDAT->dat[4];
cc_cause_write( reason );
OUT_MSGDAT->len += 5;
}
//cc_msg_write( CCL2_RELEASE_COMPLETE );
cc_msg_write(msg_type);
}
#undef __CC0MAIN_C_
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -