Decode Registration Accept to receive GUTI
This commit is contained in:
@@ -50,6 +50,16 @@ int decode_registration_accept(registration_accept_msg *registration_accept, uin
|
||||
|
||||
decoded += decoded_result;
|
||||
|
||||
if (decoded < len && buffer[decoded] == 0x77) {
|
||||
registration_accept->guti = calloc(1, sizeof(*registration_accept->guti));
|
||||
if (!registration_accept->guti)
|
||||
return -1;
|
||||
int mi_dec = decode_5gs_mobile_identity(registration_accept->guti, 0x77, buffer + decoded, len - decoded);
|
||||
if (mi_dec < 0)
|
||||
return -1;
|
||||
decoded += mi_dec;
|
||||
}
|
||||
|
||||
// todo ,Decoding optional fields
|
||||
return decoded;
|
||||
}
|
||||
@@ -64,6 +74,13 @@ int encode_registration_accept(registration_accept_msg *registration_accept, uin
|
||||
*(buffer + encoded) = encode_fgs_registration_result(®istration_accept->fgsregistrationresult);
|
||||
encoded = encoded + 2;
|
||||
|
||||
if (registration_accept->guti) {
|
||||
int mi_enc = encode_5gs_mobile_identity(registration_accept->guti, 0x77, buffer + encoded, len - encoded);
|
||||
if (mi_enc < 0)
|
||||
return mi_enc;
|
||||
encoded += mi_enc;
|
||||
}
|
||||
|
||||
// todo ,Encoding optional fields
|
||||
LOG_FUNC_RETURN(encoded);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "SpareHalfOctet.h"
|
||||
#include "MessageType.h"
|
||||
#include "FGSRegistrationResult.h"
|
||||
#include "FGSMobileIdentity.h"
|
||||
|
||||
#ifndef REGISTRATION_ACCEPT_H_
|
||||
#define REGISTRATION_ACCEPT_H_
|
||||
@@ -56,6 +57,9 @@ typedef struct registration_accept_msg_tag {
|
||||
SpareHalfOctet sparehalfoctet:4;
|
||||
MessageType messagetype;
|
||||
FGSRegistrationResult fgsregistrationresult;
|
||||
|
||||
/* Optional fields */
|
||||
FGSMobileIdentity *guti;
|
||||
} registration_accept_msg;
|
||||
|
||||
int decode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len);
|
||||
|
||||
Reference in New Issue
Block a user