Commit c4424763 authored by cucengineer's avatar cucengineer

Fixed nas message decode

parent fe13ce77
......@@ -93,6 +93,27 @@ int decode_fgs_network_feature_support(FGSNetworkFeatureSupport *fgsnetworkfeatu
return decoded;
}
int decode_fgs_gprs_timer3(GPRStimer3 *gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
if (iei > 0) {
CHECK_IEI_DECODER(iei, *buffer);
gprstimer3->iei = *(buffer + decoded);
decoded ++;
}
gprstimer3->length = *(buffer + decoded);
decoded ++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
gprstimer3->unit = (*(buffer + decoded)>>5) & 0x3;
gprstimer3->timervalue = *(buffer + decoded) & 0x1f;
decoded ++;
return decoded;
}
int decode_fgs_registration_accept(fgs_registration_accept_msg *fgs_registration_acc, uint8_t *buffer, uint32_t len)
{
int decoded = 0;
......@@ -143,6 +164,15 @@ int decode_fgs_registration_accept(fgs_registration_accept_msg *fgs_registration
break;
}
case REGISTRATION_ACCEPT_5GS_GPRS_timer3_T3512_value:
if ((decode_result = decode_fgs_gprs_timer3(&fgs_registration_acc->gprstimer3, REGISTRATION_ACCEPT_5GS_GPRS_timer3_T3512_value, buffer +
decoded, len - decoded)) < 0) { //Return in case of error
return decode_result;
} else {
decoded += decode_result;
break;
}
default:
return TLV_DECODE_UNEXPECTED_IEI;
}
......
......@@ -20,6 +20,7 @@
#define REGISTRATION_ACCEPT_5GS_TRACKING_AREA_IDENTITY_LIST 0x54
#define REGISTRATION_ACCEPT_ALLOWED_NSSA 0x15
#define REGISTRATION_ACCEPT_5GS_NETWORK_FEATURE_SUPPORT 0x21
#define REGISTRATION_ACCEPT_5GS_GPRS_timer3_T3512_value 0x5E
typedef struct FGSTrackingAreaIdentityList_tag {
#define TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS 0b00
......@@ -52,6 +53,13 @@ typedef struct FGSNetworkFeatureSupport_tag {
unsigned int EMCN3:1;
} FGSNetworkFeatureSupport;
typedef struct GPRStimer3_tag {
uint8_t iei;
uint8_t length;
unsigned int unit:3;
unsigned int timervalue:5;
} GPRStimer3;
typedef struct fgs_registration_accept_msg_tag {
/* Mandatory fields */
ExtendedProtocolDiscriminator protocoldiscriminator;
......@@ -63,11 +71,13 @@ typedef struct fgs_registration_accept_msg_tag {
FGSTrackingAreaIdentityList tailist ;
NSSAI nssai;
FGSNetworkFeatureSupport fgsnetworkfeaturesupport;
GPRStimer3 gprstimer3;
} fgs_registration_accept_msg;
int decode_fgs_tracking_area_identity_list(FGSTrackingAreaIdentityList *tailist, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_fgs_allowed_nssa(NSSAI *nssai, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_fgs_network_feature_support(FGSNetworkFeatureSupport *fgsnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_fgs_registration_accept(fgs_registration_accept_msg *fgs_registration_acc, uint8_t *buffer, uint32_t len);
int decode_fgs_gprs_timer3(GPRStimer3 *gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len);
#endif /* FGS REGISTRATION ACCEPT_H_*/
\ No newline at end of file
......@@ -55,7 +55,6 @@ int decode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
}
IES_DECODE_U16(buffer, decoded, ielen);
decoded += 2;
CHECK_LENGTH_DECODER(len - decoded, ielen);
uint8_t typeofidentity = *(buffer + decoded) & 0x7;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment