abisptl.cpp
来自「ABis无线接口全套资料」· C++ 代码 · 共 1,460 行 · 第 1/3 页
CPP
1,460 行
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_BS_POWER_PARAMETERS, (UINT8)length, pos);
pos += length;
}
break;
case ABIS_NT_IE_PHYSICAL_CONTEXT:
{
UINT8 length = *(pos+1);
pos += 2;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_PHYSICAL_CONTEXT, (UINT8)length, pos);
pos += length;
}
break;
case ABIS_NT_IE_SACCH_INFORMATION:
{
UINT8 totallen = *(pos+1);
UINT8 numberOfMsg = *(pos+2);
pos+=3;
for(int i=0; i<numberOfMsg; ++i)
{
UINT8 msgType = *(pos);
UINT8 msglen = *(pos+1);
pos += 2;
parser_layer3_info_system((unsigned char*)pos, msglen, *this, msgType);
pos += msglen;
}
}
break;
case ABIS_NT_IE_UIC:
{
UINT8 length = *(pos+1);
pos += 2;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_UIC, (UINT8)length, pos);
pos += length;
}
break;
case ABIS_NT_IE_MAIN_CHANNEL_REFERNCE:
{
UINT8 length = 1;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MAIN_CHANNEL_REFERNCE, (UINT8)length, pos);
pos += length;
pos += 1;
}
break;
case ABIS_NT_IE_MULTIRATE_CONFIGURATION:
{
UINT8 length = *(pos+1);
pos += 2;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MULTIRATE_CONFIGURATION, (UINT8)length, pos);
pos += length;
}
break;
case ABIS_NT_IE_MULITRATE_CONTROL:
{
UINT8 length = *(pos+1);
pos += 2;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_UIC, (UINT8)length, pos);
pos += length;
}
break;
case ABIS_NT_IE_SUPPORTED_CODEC_TYPES:
{
UINT8 length = *(pos+1);
pos += 2;
if(len < (pos-ptr)+length)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_SUPPORTED_CODEC_TYPES, (UINT8)length, pos);
pos += length;
}
break;
}
goto optional;
return ret;
}
/*
MEASUREMENT RESULT
This message from BTS to BSC is used to report to BSC the results of radio channel measurements made by BTS
(uplink) and to convey the measurement reports from MS received on SACCH and in the L1 headers.
INFORMATION ELEMENT REFERENCE PRESENCE FORMAT LENGTH
Message discriminator 9.1 M V 1
Message type 9.2 M V 1
Channel number 9.3.1 M TV 2
Measurement result number 9.3.27 M TV 2
Uplink Measurements 9.3.25 M TLV >=5
BS Power 9.3.4 M TV 2
L1 Information 9.3.10 O 1) TV 3
L3 Info(MEAS REP or EXT MEAS
REP)
9.3.11 O 1) TLV 21
MS Timing Offset 9.3.37 O 2) TV 2
1) The L1 Information element contains the last received L1-header (MS Power and Timing Advance) from
MS and the L3 Information element contains the complete MEASurement REPort message or EXTended
MEASurement REPort message freceived from MS. They are included only if received since last
(EXTended) MEASurement RESult message.
2) MS Timing Offset can be optionally included to increase the accuracy of possible distance measurements.
*/
int CAbisPdu::MeasurementRetDecoder(char* ptr, UINT16 len)
{// GSM_08.58_ts_100596v070401p.pdf-8.4.8
/// must
//printf("MeasurementRetDecoder len = %d", len);
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 channumlen = sizeof(SChannelNumber);
pos += 1;
if(len < (pos-ptr)+channumlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_CHANNEL_NUMBER, (UINT8)channumlen, pos);
pos += channumlen;
UINT8 msurretlen = sizeof(SMeasurementResultNumber);
pos += 1;
if(len < (pos-ptr)+msurretlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MEASUREMENT_RESULT_NUMBER, (UINT8)msurretlen, pos);
pos += msurretlen;
UINT8 uplinklen = *(pos+1);
pos += 2;
if(len < (pos-ptr)+uplinklen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_UPLINK_MEASUREMENTS, (UINT8)uplinklen, pos);
pos += uplinklen;
UINT8 bspowerlen = sizeof(SBsPower);
pos += 1;
if(len < (pos-ptr)+bspowerlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_BS_POWER, (UINT8)bspowerlen, pos);
pos += bspowerlen;
/// option
optional :
if((pos-ptr) == len)
return ret;
if((pos-ptr) > len)
return ABIS_DC_ERROR_INVLID;
UINT8 eleID = *pos;
switch(eleID)
{
default:
return ABIS_DC_ERROR_INVLID;
break;
case ABIS_NT_IE_L1_INFORMATION:
{
UINT8 l1len;
l1len = sizeof(SL1Information);
pos += 1;
if(len < (pos-ptr)+l1len)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_L1_INFORMATION, (UINT8)l1len, pos);
pos += l1len;
}
break;
case ABIS_NT_IE_L3_INFORMATION:
{
UINT16 l3len = 0;
UINT8 high = (UINT8)*(pos+1);
UINT8 low = (UINT8)*(pos+2);
l3len = high << 8;
l3len |= low;
pos += 3;
if(len < (pos-ptr)+l3len)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_L3_INFORMATION, (UINT8)l3len, pos);
parser_layer3_info((unsigned char*)pos, l3len, *this);
pos += l3len;
}
break;
case ABIS_NT_IE_MS_TIMING_OFFSET:
{
UINT8 mstiminglen = sizeof(SMsTimingOffset);
pos += 1;
if(len < (pos-ptr)+mstiminglen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MS_TIMING_OFFSET, (UINT8)mstiminglen, pos);
pos += mstiminglen;
}
break;
}
goto optional;
return ret;
}
//------------------------------------------------------------------------------------------
// GSM_08.58_ts_100596v070401p.pdf-8.4.18
int CAbisPdu::PreprocessedMeasurementRetDeocder(char* ptr, UINT16 len)
{
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 channumlen = sizeof(SChannelNumber);
pos += 1;
if(len < (pos-ptr)+channumlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_CHANNEL_NUMBER, (UINT8)channumlen, pos);
pos += channumlen;
UINT8 preprocessedmeasurementslen = (UINT8)(*(pos+1));
pos += 2;
if(len < (pos-ptr)+preprocessedmeasurementslen)
return ABIS_DC_ERROR_DECODE;
ret = PutIE(ABIS_NT_IE_PRE_PROCESSED_MEASUREMENTS, \
(UINT8) preprocessedmeasurementslen, pos);
return ret;
}
// GSM_08.58_ts_100596v070401p.pdf-8.4.20
int CAbisPdu::SacchInfoModifyDecoder(char* ptr, UINT16 len)
{
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 channumlen = sizeof(SChannelNumber);
pos += 1;
if(len < (pos-ptr)+channumlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_CHANNEL_NUMBER, (UINT8)channumlen, pos);
pos += channumlen;
UINT8 sysinfotypelen = sizeof(SSystemInfoType);
pos += 1;
UINT8 system_type = *pos;
if(len < (pos-ptr)+sysinfotypelen)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_SYSTEM_INFO_TYPE, (UINT8)sysinfotypelen, pos);
pos += sysinfotypelen;
/// option
optional :
if((pos-ptr) == len)
return ret;
UINT8 eleID = *pos;
switch(eleID)
{
default:
return ABIS_DC_ERROR_INVLID;
break;
case ABIS_NT_IE_L3_INFORMATION:
{
UINT16 l3len = 0;
UINT8 high = (UINT8)*(pos+1);
UINT8 low = (UINT8)*(pos+2);
l3len = high << 8;
l3len |= low;
pos += 3;
if(len < (pos-ptr)+l3len)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_L3_INFORMATION, (UINT8)l3len, pos);
//parser_layer3_info((unsigned char*)pos, l3len, *this);
parser_layer3_info_system((unsigned char*)pos, l3len, *this, system_type);
pos += l3len;
}
break;
case ABIS_NT_IE_STARTING_TIME:
{
UINT8 startingtimelen = sizeof(SStartingTime);
pos += 1;
if(len < (pos-ptr)+startingtimelen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MS_TIMING_OFFSET, (UINT8)startingtimelen, pos);
pos += startingtimelen;
}
break;
}
goto optional;
return ret;
}
int CAbisPdu::BcchInfoDecoder(char* ptr, UINT16 len)
{
///must
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 channumlen = sizeof(SChannelNumber);
UINT8 system_type = 0;
pos += 1;
if(len < (pos-ptr)+channumlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_CHANNEL_NUMBER, (UINT8)channumlen, pos);
pos += channumlen;
//system type, TV
UINT8 sysinfotypelen = sizeof(SSystemInfoType);
pos += 1;
if(len < (pos-ptr)+sysinfotypelen)
return ABIS_DC_ERROR_SHORT;
// ret = PutIE(ABIS_NT_IE_SYSTEM_INFO_TYPE, (UINT8)SSystemInfoType, pos);
system_type = *pos;
pos += sysinfotypelen;
/// optional
optional:
if((pos-ptr) == len)
return ret;
if((pos-ptr) > len)
return ABIS_DC_ERROR_INVLID;
UINT8 eleID = *pos;
switch(eleID)
{
default:
return ABIS_DC_ERROR_INVLID;
break;
case ABIS_NT_IE_FULL_BCCH_INFORMATION:
{
UINT8 fullbcchinfolen = *(pos+1);
pos += 2;
if(len < (pos-ptr)+fullbcchinfolen)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_L3_INFORMATION, (UINT8)l3len, pos);
parser_layer3_info_system((unsigned char*)pos, fullbcchinfolen, *this,system_type);/* Xiao Debug for segmentation fault */
pos += fullbcchinfolen;
}
break;
case ABIS_NT_IE_PAGING_LOAD:
{
UINT8 startingtimelen = sizeof(SStartingTime);
pos += 1;
if(len < (pos-ptr)+sysinfotypelen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_STARTING_TIME, sizeof(SSystemInfoType), pos);
pos += startingtimelen;
}
break;
}
goto optional;
return ret;
}
int CAbisPdu::CcchLoadIndDeoder(char* ptr, UINT16 len)
{
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 channumlen = sizeof(SChannelNumber);
pos += 1;
if(len < (pos-ptr)+channumlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_CHANNEL_NUMBER, (UINT8)channumlen, pos);
pos += channumlen;
/// option
optional :
if((pos-ptr) == len)
return ret;
UINT8 eleID = *pos;
switch(eleID)
{
default:
return ABIS_DC_ERROR_INVLID;
break;
case ABIS_NT_IE_RACH_LOAD:
{
UINT8 rachloadlen = *(pos+1);
pos += 2;
if(len < (pos-ptr)+rachloadlen)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_L3_INFORMATION, (UINT8)l3len, pos);
parser_layer3_info((unsigned char*)pos, rachloadlen, *this);
pos += rachloadlen;
}
break;
case ABIS_NT_IE_PAGING_LOAD:
{
UINT8 pagingloadlen = *(pos+1);
pos += 2;
if(len < (pos-ptr)+ pagingloadlen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MS_TIMING_OFFSET, (UINT8)pagingloadlen, pos);
pos += pagingloadlen;
}
break;
}
goto optional;
return ret;
}
// TRX management messages
int CAbisPdu::SacchFillingDecoder(char* ptr, UINT16 len)
{
int ret = ABIS_DC_SUCCESS;
char* pos = ptr;
UINT8 sysinfotypelen = sizeof(SSystemInfoType);
pos += 1;
UINT8 system_type = *pos;
if(len < (pos-ptr)+sysinfotypelen)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_SYSTEM_INFO_TYPE, (UINT8)sysinfotypelen, pos);
pos += sysinfotypelen;
/// option
optional :
if((pos-ptr) == len)
return ret;
UINT8 eleID = *pos;
switch(eleID)
{
default:
return ABIS_DC_ERROR_INVLID;
break;
case ABIS_NT_IE_L3_INFORMATION:
{
UINT16 l3len = 0;
UINT8 high = (UINT8)*(pos+1);
UINT8 low = (UINT8)*(pos+2);
l3len = high << 8;
l3len |= low;
pos += 3;
if(len < (pos-ptr)+l3len)
return ABIS_DC_ERROR_SHORT;
//ret = PutIE(ABIS_NT_IE_L3_INFORMATION, (UINT8)l3len, pos);
//parser_layer3_info((unsigned char*)pos, l3len, *this);
parser_layer3_info_system((unsigned char*)pos, l3len, *this, system_type);
pos += l3len;
}
break;
case ABIS_NT_IE_STARTING_TIME:
{
UINT8 startingtimelen = sizeof(SStartingTime);
pos += 1;
if(len < (pos-ptr)+startingtimelen)
return ABIS_DC_ERROR_SHORT;
ret = PutIE(ABIS_NT_IE_MS_TIMING_OFFSET, (UINT8)startingtimelen, pos);
pos += startingtimelen;
}
break;
}
goto optional;
return ret;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?