1286 lines
33 KiB
C
1286 lines
33 KiB
C
#include "./include/inc.h"
|
|
#include "./include/var_ext.h"
|
|
|
|
BiccMsg_union msg_union[BICC_MAX_PORT];
|
|
//static up_message_2 up_msg;
|
|
extern void apm_decode(ApmUser_struct *ptr, const u8 *flw_ptr, u8 length);
|
|
extern u32 apm_encode(u8 *flw_ptr, const ApmUser_struct *ptr);
|
|
extern void bicc_prm2msg(BiccMsg_union *msg_ptr, BiccWritePrim_union *prm_ptr, u8 msg_type);
|
|
|
|
void bicc_decode_app(AppTrans_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
int i = 0;
|
|
|
|
ptr->pres = 1;
|
|
ptr->aci[0] = flw_ptr[i];
|
|
if((flw_ptr[i++] >> 7) == 0)
|
|
ptr->aci[1] = flw_ptr[i++];
|
|
ptr->sni = (flw_ptr[i] >> 1) & 0x01;
|
|
ptr->rci = flw_ptr[i++] & 0x01;
|
|
ptr->si = (flw_ptr[i] >> 6) & 0x01;
|
|
ptr->segment = flw_ptr[i] & 0x3f;
|
|
if((flw_ptr[i++] >> 7) == 0)
|
|
ptr->slr = flw_ptr[i++] & 0x7f;
|
|
if(length > i)
|
|
apm_decode(&ptr->apm_info, flw_ptr+i, length-i);
|
|
}
|
|
|
|
u32 bicc_encode_app(u8 *flw_ptr, const AppTrans_struct *ptr)
|
|
{
|
|
int i = 0;
|
|
|
|
flw_ptr[i++] = ptr->aci[0] | 0x80;
|
|
// if((ptr->aci[0] >> 7) == 0)
|
|
// flw_ptr[i++] = ptr->aci[1];
|
|
flw_ptr[i++] = (ptr->sni << 1) + ptr->rci;
|
|
flw_ptr[i++] = ((ptr->si << 6) + ptr->segment) | 0x80;
|
|
return i + apm_encode(flw_ptr+i, &ptr->apm_info);
|
|
}
|
|
|
|
void bicc_decode_backcall(BackCallInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val[0] = flw_ptr[0];
|
|
ptr->val[1] = flw_ptr[1];
|
|
}
|
|
|
|
u32 bicc_encode_backcall(u8 *flw_ptr, const BackCallInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val[0];
|
|
flw_ptr[1] = ptr->val[1];
|
|
return 2;
|
|
}
|
|
|
|
void bicc_decode_calledptynum(CalledPtyNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 2)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nai = flw_ptr[0] & 0x7f;
|
|
ptr->inn = flw_ptr[1] >> 7;
|
|
ptr->npi = (flw_ptr[1] >> 4) & 0x07;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
u32 bicc_encode_calledptynum(u8 *flw_ptr, const CalledPtyNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 2;
|
|
flw_ptr[0] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[1] = ((ptr->inn << 7) + (ptr->npi << 4)) & 0xf0;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
void bicc_decode_callingptynum(CallingPtyNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 2)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nai = flw_ptr[0] & 0x7f;
|
|
ptr->ni = flw_ptr[1] >> 7;
|
|
ptr->npi = (flw_ptr[1] >> 4) & 0x07;
|
|
ptr->apri = (flw_ptr[1] >> 2) & 0x03;
|
|
ptr->si = flw_ptr[1] & 0x03;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
u32 bicc_encode_callingptynum(u8 *flw_ptr, const CallingPtyNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 2;
|
|
flw_ptr[0] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[1] = (ptr->ni << 7) + (ptr->npi << 4) + (ptr->apri << 2) + ptr->si;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
void bicc_decode_callingptycat(CallingPtyCat_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_callingptycat(u8 *flw_ptr, const CallingPtyCat_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
|
|
u32 bicc_encode_cause(u8 *flw_ptr, const CauseInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ((ptr->codingStd << 5) + ptr->location) & 0x7f;
|
|
flw_ptr[1] = 0x80 | ptr->causeVal;
|
|
return 2;
|
|
}
|
|
|
|
void bicc_decode_cause(CauseInd_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->codingStd = (flw_ptr[0] >> 5) & 0x03;
|
|
ptr->location = flw_ptr[0] & 0x0f;
|
|
ptr->causeVal = flw_ptr[1] & 0x7f;
|
|
}
|
|
|
|
|
|
void bicc_decode_cicgrpspv(CicGrpSpv_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_cicgrpspv(u8 *flw_ptr, const CicGrpSpv_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_collectcallreq(CollectCallReq_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_collectcallreq(u8 *flw_ptr, const CollectCallReq_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_conftreat(ConfTreatInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_conftreat(u8 *flw_ptr, const ConfTreatInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_connnum(ConnNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 2)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nai = flw_ptr[0] & 0x7f;
|
|
ptr->npi = (flw_ptr[1] >> 4) & 0x07;
|
|
ptr->apri = (flw_ptr[1] >> 2) & 0x03;
|
|
ptr->si = flw_ptr[1] & 0x03;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
u32 bicc_encode_connnum(u8 *flw_ptr, const ConnNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 2;
|
|
flw_ptr[0] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[1] = ((ptr->npi << 4) + (ptr->apri << 2) + ptr->si) & 0x7f;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
void bicc_decode_genericnumber(GenericNumber_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 3)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nqi = flw_ptr[0];
|
|
ptr->nai = flw_ptr[1] & 0x7f;
|
|
ptr->ni = flw_ptr[2] >> 7;
|
|
ptr->npi = (flw_ptr[2] >> 4) & 0x07;
|
|
ptr->apri = (flw_ptr[2] >> 2) & 0x03;
|
|
ptr->si = flw_ptr[2] & 0x03;
|
|
num_len = length - 3;
|
|
num_ptr = flw_ptr + 3;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[1] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
void bicc_decode_genericDigits(GenericDigits_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u8 num_len;
|
|
int i, j;
|
|
const u8 *num_ptr;
|
|
if(length < 3)
|
|
return;
|
|
ptr->pres = 1;
|
|
|
|
ptr->typeOfDigits = flw_ptr[0] & 0x1f;
|
|
ptr->encodeScheme = flw_ptr[0] & 0xE0;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digits[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digits[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 5) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void bicc_decode_correlationid(CorrelationId_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
bicc_decode_genericDigits(ptr, flw_ptr, length);
|
|
}
|
|
|
|
|
|
u32 bicc_encode_genericnumber(u8 *flw_ptr, const GenericNumber_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 3;
|
|
flw_ptr[0] = ptr->nqi;
|
|
flw_ptr[1] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[2] = (ptr->ni << 7) + (ptr->npi << 4) + (ptr->apri << 2) + ptr->si;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 3;
|
|
}
|
|
|
|
u32 bicc_encode_genericDigits(u8 *flw_ptr, const GenericDigits_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
num_ptr = flw_ptr + 1;
|
|
flw_ptr[0] = (ptr->encodeScheme << 5) + ptr->typeOfDigits;
|
|
flw_ptr[1] = ptr->numOfDigit & 0xff;
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digits[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digits[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
|
|
}
|
|
|
|
|
|
u32 bicc_encode_correlationid(u8 *flw_ptr, const CorrelationId_struct *ptr)
|
|
{
|
|
return bicc_encode_genericDigits(flw_ptr, ptr);
|
|
|
|
}
|
|
|
|
void bicc_decode_eventinfo(EventInfo_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_eventinfo(u8 *flw_ptr, const EventInfo_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_fwdcall(FwdCallInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val[0] = flw_ptr[0];
|
|
ptr->val[1] = flw_ptr[1];
|
|
}
|
|
|
|
u32 bicc_encode_fwdcall(u8 *flw_ptr, const FwdCallInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val[0];
|
|
flw_ptr[1] = ptr->val[1];
|
|
return 2;
|
|
}
|
|
|
|
|
|
void bicc_decode_natconn(NatConnInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_natconn(u8 *flw_ptr, const NatConnInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_origcallednum(OrigCalledNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 2)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nai = flw_ptr[0] & 0x7f;
|
|
ptr->npi = (flw_ptr[1] >> 4) & 0x07;
|
|
ptr->apri = (flw_ptr[1] >> 2) & 0x03;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
u32 bicc_encode_origcallednum(u8 *flw_ptr, const OrigCalledNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 2;
|
|
flw_ptr[0] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[1] = ((ptr->npi << 4) + (ptr->apri << 2)) & 0x7c;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
void bicc_decode_rangestatus(RangeStatus_struct *ptr, const u8 *flw_ptr, u8 length, u8 need_status)
|
|
{
|
|
u8 status_len;
|
|
|
|
ptr->pres = 1;
|
|
ptr->range = flw_ptr[0];
|
|
if(need_status == 1)
|
|
{
|
|
status_len = (((flw_ptr[0]+1)&0x07) == 0)? ((flw_ptr[0]+1)>>3) : (((flw_ptr[0]+1)>>3) + 1);
|
|
memcpy(ptr->status, flw_ptr+1, status_len);
|
|
}
|
|
}
|
|
|
|
u32 bicc_encode_rangestatus(u8 *flw_ptr, const RangeStatus_struct *ptr, u8 need_status)
|
|
{
|
|
u8 status_len;
|
|
|
|
flw_ptr[0] = ptr->range;
|
|
if(need_status == 1)
|
|
{
|
|
status_len = (((ptr->range+1)&0x07) == 0)? ((ptr->range+1)>>3) : (((ptr->range+1)>>3) + 1);
|
|
memcpy(flw_ptr+1, ptr->status, status_len);
|
|
}
|
|
else
|
|
status_len = 0;
|
|
return status_len + 1;
|
|
}
|
|
|
|
void bicc_decode_redirgnum(RedirgNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 2)
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->nai = flw_ptr[0] & 0x7f;
|
|
ptr->npi = (flw_ptr[1] >> 4) & 0x07;
|
|
ptr->apri = (flw_ptr[1] >> 2) & 0x03;
|
|
num_len = length - 2;
|
|
num_ptr = flw_ptr + 2;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
void bicc_decode_redirinfo(RedirInfo_struct *ptr, u8 *flw_ptr, u8 length)
|
|
{
|
|
if(length <= 2)
|
|
return;
|
|
ptr->redInd = flw_ptr[0] & 0x07;
|
|
ptr->origRedirReason = (flw_ptr[0] >> 4) & 0x0f;
|
|
ptr->redirCounter = flw_ptr[1] & 0x07;
|
|
ptr->redirReason = (flw_ptr[1] >> 4) & 0x0f;
|
|
}
|
|
|
|
u32 bicc_encode_redirgnum(u8 *flw_ptr, const RedirgNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 2;
|
|
flw_ptr[0] = (ptr->numOfDigit << 7) + ptr->nai;
|
|
flw_ptr[1] = ((ptr->npi << 4) + (ptr->apri << 2)) & 0x7c;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
u32 bicc_encode_redirinfo(u8 *flw_ptr, const RedirInfo_struct *ptr)
|
|
{
|
|
flw_ptr[0] = (ptr->origRedirReason << 4) + ptr->redInd;
|
|
flw_ptr[1] = (ptr->redirReason << 4) + ptr->redirCounter;
|
|
return 2;
|
|
}
|
|
|
|
void bicc_decode_scfid(ScfId_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
bicc_decode_genericDigits(ptr, flw_ptr, length);
|
|
}
|
|
|
|
u32 bicc_encode_scfid(u8 *flw_ptr, const ScfId_struct *ptr)
|
|
{
|
|
return bicc_encode_genericDigits(flw_ptr, ptr);
|
|
}
|
|
|
|
void bicc_decode_subseqnum(SubseqNum_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
const u8 *num_ptr;
|
|
|
|
if(length <= 1)
|
|
return;
|
|
ptr->pres = 1;
|
|
num_len = length - 1;
|
|
num_ptr = flw_ptr + 1;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
ptr->digit[j++] = num_ptr[i] & 0x0f;
|
|
ptr->digit[j++] = num_ptr[i] >> 4;
|
|
}
|
|
if((flw_ptr[0] >> 7) && (j > 0))
|
|
j--;
|
|
ptr->numOfDigit = j;
|
|
}
|
|
|
|
u32 bicc_encode_subseqnum(u8 *flw_ptr, const SubseqNum_struct *ptr)
|
|
{
|
|
u32 i, j;
|
|
u8 num_len;
|
|
u8 *num_ptr;
|
|
|
|
num_len = ptr->numOfDigit/2 + (ptr->numOfDigit & 0x01);
|
|
num_ptr = flw_ptr + 1;
|
|
flw_ptr[0] = (ptr->numOfDigit & 0x01) << 7;
|
|
for(i = 0, j = 0; i < num_len; i++)
|
|
{
|
|
num_ptr[i] = ptr->digit[j++] & 0x0f;
|
|
num_ptr[i] += ptr->digit[j++] << 4;
|
|
}
|
|
if(ptr->numOfDigit & 0x01)
|
|
num_ptr[i] &= 0x0f;
|
|
return num_len + 2;
|
|
}
|
|
|
|
void bicc_decode_susres(SusResInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_susres(u8 *flw_ptr, const SusResInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_transmedreq(TransMedReq_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_transmedreq(u8 *flw_ptr, const TransMedReq_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_utuind(UserToUserInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->val = *flw_ptr;
|
|
}
|
|
|
|
u32 bicc_encode_utuind(u8 *flw_ptr, const UserToUserInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ptr->val;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_utuinfo(UserToUserInfo_struct *ptr, const u8 *flw_ptr, u8 length)
|
|
{
|
|
if((length == 0) || (length > 129))
|
|
return;
|
|
ptr->pres = 1;
|
|
ptr->len = length;
|
|
memcpy(ptr->val, flw_ptr, length);
|
|
}
|
|
|
|
u32 bicc_encode_utuinfo(u8 *flw_ptr, const UserToUserInfo_struct *ptr)
|
|
{
|
|
memcpy(flw_ptr, ptr->val, ptr->len);
|
|
return ptr->len;
|
|
}
|
|
|
|
void bicc_decode_calldiverinfo(CallDiverInfo_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->notifSubsOption = flw_ptr[0]&0x07;
|
|
ptr->redirReason = (flw_ptr[0]>>3)&0x0f;
|
|
}
|
|
|
|
u32 bicc_encode_calldiverinfo(u8 *flw_ptr, const CallDiverInfo_struct *ptr)
|
|
{
|
|
flw_ptr[0] = ((ptr->redirReason)<<3) + (ptr->notifSubsOption);
|
|
return 1;
|
|
}
|
|
|
|
void bicc_decode_optBackCallInd(OptBackCallInd_struct *ptr, const u8 *flw_ptr)
|
|
{
|
|
ptr->pres = 1;
|
|
ptr->inbandInfoInd = flw_ptr[0]&0x01;
|
|
ptr->callDiverOccurInd = flw_ptr[0]&0x02;
|
|
ptr->simpSegmInd = flw_ptr[0]&0x04;
|
|
ptr->mlppUserInd = flw_ptr[0]&0x08;
|
|
}
|
|
|
|
u32 bicc_encode_optBackCallInd(u8 *flw_ptr, const OptBackCallInd_struct *ptr)
|
|
{
|
|
flw_ptr[0] = (((ptr->mlppUserInd)<<3)+((ptr->simpSegmInd)<<2)+((ptr->callDiverOccurInd<<1))+(ptr->inbandInfoInd))&0x0f;
|
|
return 1;
|
|
}
|
|
|
|
void bicc_send_acm(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccAcm_struct *acm_ptr = &msg_union[pid].acm;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_ACM);
|
|
*(flw_ptr++) = M_ACM;
|
|
flw_ptr += bicc_encode_backcall(flw_ptr, &acm_ptr->backCall);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(acm_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &acm_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(acm_ptr->cause.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CAUSEIND;
|
|
flw_ptr[1] = bicc_encode_cause(flw_ptr+2, &acm_ptr->cause);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(acm_ptr->confTreat.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONFTREATIND;
|
|
flw_ptr[1] = bicc_encode_conftreat(flw_ptr+2, &acm_ptr->confTreat);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(acm_ptr->optBackCall.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_OPTBACKCALLIND;
|
|
flw_ptr[1] = bicc_encode_optBackCallInd(flw_ptr+2, &acm_ptr->optBackCall);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(acm_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &acm_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(acm_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &acm_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_anm(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccAnm_struct *anm_ptr = &msg_union[pid].anm;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_ANM);
|
|
*(flw_ptr++) = M_ANM;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(anm_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &anm_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(anm_ptr->backCall.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_BACKCALLIND;
|
|
flw_ptr[1] = bicc_encode_backcall(flw_ptr+2, &anm_ptr->backCall);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(anm_ptr->confTreat.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONFTREATIND;
|
|
flw_ptr[1] = bicc_encode_conftreat(flw_ptr+2, &anm_ptr->confTreat);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(anm_ptr->connNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONNNUM;
|
|
flw_ptr[1] = bicc_encode_connnum(flw_ptr+2, &anm_ptr->connNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(anm_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &anm_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(anm_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &anm_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_apm(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccApm_struct *apm_ptr = &msg_union[pid].apm;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_APM);
|
|
*(flw_ptr++) = M_APM;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(apm_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &apm_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_cpg(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCpg_struct *cpg_ptr = &msg_union[pid].cpg;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CPG);
|
|
*(flw_ptr++) = M_CPG;
|
|
flw_ptr += bicc_encode_eventinfo(flw_ptr, &cpg_ptr->eventInfo);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(cpg_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &cpg_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->backCall.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_BACKCALLIND;
|
|
flw_ptr[1] = bicc_encode_backcall(flw_ptr+2, &cpg_ptr->backCall);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->calldiver.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CALLDIVERINFO;
|
|
flw_ptr[1] = bicc_encode_calldiverinfo(flw_ptr+2, &cpg_ptr->calldiver);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->cause.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CAUSEIND;
|
|
flw_ptr[1] = bicc_encode_cause(flw_ptr+2, &cpg_ptr->cause);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->confTreat.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONFTREATIND;
|
|
flw_ptr[1] = bicc_encode_conftreat(flw_ptr+2, &cpg_ptr->confTreat);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->connNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONNNUM;
|
|
flw_ptr[1] = bicc_encode_connnum(flw_ptr+2, &cpg_ptr->connNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &cpg_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(cpg_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &cpg_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_cgb(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCgb_struct *cgb_ptr = &msg_union[pid].cgb;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CGB);
|
|
*(flw_ptr++) = M_CGB;
|
|
flw_ptr += bicc_encode_cicgrpspv(flw_ptr, &cgb_ptr->cicGrpSpv);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &cgb_ptr->rangeStatus, 1);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_cgba(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCgba_struct *cgba_ptr = &msg_union[pid].cgba;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CGBA);
|
|
*(flw_ptr++) = M_CGBA;
|
|
flw_ptr += bicc_encode_cicgrpspv(flw_ptr, &cgba_ptr->cicGrpSpv);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &cgba_ptr->rangeStatus, 1);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_cgu(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCgu_struct *cgu_ptr = &msg_union[pid].cgu;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CGU);
|
|
*(flw_ptr++) = M_CGU;
|
|
flw_ptr += bicc_encode_cicgrpspv(flw_ptr, &cgu_ptr->cicGrpSpv);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &cgu_ptr->rangeStatus, 1);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_cgua(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCgua_struct *cgua_ptr = &msg_union[pid].cgua;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CGUA);
|
|
*(flw_ptr++) = M_CGUA;
|
|
flw_ptr += bicc_encode_cicgrpspv(flw_ptr, &cgua_ptr->cicGrpSpv);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &cgua_ptr->rangeStatus, 1);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_grs(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccGrs_struct *grs_ptr = &msg_union[pid].grs;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_GRS);
|
|
*(flw_ptr++) = M_GRS;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &grs_ptr->rangeStatus, 0);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_gra(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccGra_struct *gra_ptr = &msg_union[pid].gra;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_GRA);
|
|
*(flw_ptr++) = M_GRA;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 1;
|
|
flw_ptr[0] = bicc_encode_rangestatus(flw_ptr+1, &gra_ptr->rangeStatus, 1);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_con(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccCon_struct *con_ptr = &msg_union[pid].con;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_CON);
|
|
*(flw_ptr++) = M_CON;
|
|
flw_ptr += bicc_encode_backcall(flw_ptr, &con_ptr->backCall);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(con_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &con_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(con_ptr->confTreat.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONFTREATIND;
|
|
flw_ptr[1] = bicc_encode_conftreat(flw_ptr+2, &con_ptr->confTreat);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(con_ptr->connNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONNNUM;
|
|
flw_ptr[1] = bicc_encode_connnum(flw_ptr+2, &con_ptr->connNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(con_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &con_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(con_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &con_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_iam(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccIam_struct *iam_ptr = &msg_union[pid].iam;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
u8 opt_pointer;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_IAM);
|
|
*(flw_ptr++) = M_IAM;
|
|
flw_ptr += bicc_encode_natconn(flw_ptr, &iam_ptr->natConn);
|
|
flw_ptr += bicc_encode_fwdcall(flw_ptr, &iam_ptr->fwdCall);
|
|
flw_ptr += bicc_encode_callingptycat(flw_ptr, &iam_ptr->callingPtyCat);
|
|
flw_ptr += bicc_encode_transmedreq(flw_ptr, &iam_ptr->transMedReq);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr += 2;
|
|
*(pointer_ptr++) = 2;
|
|
*pointer_ptr = 0;
|
|
flw_ptr[0] = bicc_encode_calledptynum(flw_ptr+1, &iam_ptr->calledPtyNum);
|
|
opt_pointer = flw_ptr[0] + 2;
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
if(iam_ptr->app.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_APPTRANS;
|
|
flw_ptr[1] = bicc_encode_app(flw_ptr+2, &iam_ptr->app);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->callingPtyNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CALLINGPTYNUM;
|
|
flw_ptr[1] = bicc_encode_callingptynum(flw_ptr+2, &iam_ptr->callingPtyNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->collectCallReq.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_COLLECTCALLREQ;
|
|
flw_ptr[1] = bicc_encode_collectcallreq(flw_ptr+2, &iam_ptr->collectCallReq);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->confTreat.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CONFTREATIND;
|
|
flw_ptr[1] = bicc_encode_conftreat(flw_ptr+2, &iam_ptr->confTreat);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->correlationId.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CORRELATIONID;
|
|
flw_ptr[1] = bicc_encode_correlationid(flw_ptr+2, &iam_ptr->correlationId);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->origCalledNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_ORIGCALLEDNUM;
|
|
flw_ptr[1] = bicc_encode_origcallednum(flw_ptr+2, &iam_ptr->origCalledNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->redirgNum.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_REDIRGNUM;
|
|
flw_ptr[1] = bicc_encode_redirgnum(flw_ptr+2, &iam_ptr->redirgNum);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->redirInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_REDIRINFO;
|
|
flw_ptr[1] = bicc_encode_redirinfo(flw_ptr+2, &iam_ptr->redirInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->scfId.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_SCFID;
|
|
flw_ptr[1] = bicc_encode_scfid(flw_ptr+2, &iam_ptr->scfId);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &iam_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(iam_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &iam_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
|
|
void bicc_send_rel(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccRel_struct *rel_ptr = &msg_union[pid].rel;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
u8 opt_pointer;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_REL);
|
|
*(flw_ptr++) = M_REL;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr += 2;
|
|
*(pointer_ptr++) = 2;
|
|
*pointer_ptr = 0;
|
|
flw_ptr[0] = bicc_encode_cause(flw_ptr+1, &rel_ptr->cause);
|
|
opt_pointer = flw_ptr[0] + 2;
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
if(rel_ptr->utuInd.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUIND;
|
|
flw_ptr[1] = bicc_encode_utuind(flw_ptr+2, &rel_ptr->utuInd);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(rel_ptr->utuInfo.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_UTUINFO;
|
|
flw_ptr[1] = bicc_encode_utuinfo(flw_ptr+2, &rel_ptr->utuInfo);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = opt_pointer;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_rlc(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccRlc_struct *rlc_ptr = &msg_union[pid].rlc;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_RLC);
|
|
*(flw_ptr++) = M_RLC;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(rlc_ptr->cause.pres == 1)
|
|
{
|
|
flw_ptr[0] = P_CAUSEIND;
|
|
flw_ptr[1] = bicc_encode_cause(flw_ptr+2, &rlc_ptr->cause);
|
|
flw_ptr += flw_ptr[1] + 2;
|
|
*pointer_ptr = 1;
|
|
}
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
|
|
void bicc_send_rsc(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
|
|
*(flw_ptr++) = M_RSC;
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_res(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccRes_struct *res_ptr = &msg_union[pid].res;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_RES);
|
|
*(flw_ptr++) = M_RES;
|
|
flw_ptr += bicc_encode_susres(flw_ptr, &res_ptr->susRes);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_sus(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccSus_struct *sus_ptr = &msg_union[pid].sus;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_SUS);
|
|
*(flw_ptr++) = M_SUS;
|
|
flw_ptr += bicc_encode_susres(flw_ptr, &sus_ptr->susRes);
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr++;
|
|
*pointer_ptr = 0;
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|
|
|
|
void bicc_send_sam(u32 pid)
|
|
{
|
|
BICC_Port_struct *port_ptr = &Bicc_Data.port_data[pid];
|
|
BiccSam_struct *sam_ptr = &msg_union[pid].sam;
|
|
u8 *flw_ptr = port_ptr->s_mtp_msg.msgList; //message flow pointer
|
|
u8 *pointer_ptr;
|
|
|
|
bicc_prm2msg(&msg_union[pid], &writePrim_union[pid], M_SAM);
|
|
*(flw_ptr++) = M_SAM;
|
|
pointer_ptr = flw_ptr;
|
|
flw_ptr += 2;
|
|
*(pointer_ptr++) = 2;
|
|
*pointer_ptr = 0;
|
|
flw_ptr[0] = bicc_encode_subseqnum(flw_ptr+1, &sam_ptr->subseqNum);
|
|
flw_ptr += flw_ptr[0] + 1;
|
|
if(*pointer_ptr != 0)
|
|
*(flw_ptr++) = 0; //End of optional parameters
|
|
port_ptr->s_mtp_msg.len = flw_ptr - port_ptr->s_mtp_msg.msgList;
|
|
BICC_msdc_proc(pid, &(port_ptr->s_mtp_msg));
|
|
}
|