Commit 47faa845 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent 96bda27e
...@@ -68,7 +68,7 @@ uint8_t GPRS_Timer_3::getValue() { ...@@ -68,7 +68,7 @@ uint8_t GPRS_Timer_3::getValue() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) { int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding GPRS_Timer_3 iei(0x%x)", _iei); Logger::nas_mm().debug("Encoding GPRS_Timer_3 IEI (0x%x)", _iei);
if (len < 3) { if (len < 3) {
Logger::nas_mm().error("len is less than 3"); Logger::nas_mm().error("len is less than 3");
return 0; return 0;
...@@ -83,20 +83,20 @@ int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) { ...@@ -83,20 +83,20 @@ int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) {
encoded_size++; encoded_size++;
*(buf + encoded_size) = octet; *(buf + encoded_size) = octet;
encoded_size++; encoded_size++;
Logger::nas_mm().debug("encoded GPRS_Timer_3 conent(0x%x)", octet); Logger::nas_mm().debug("Encoded GPRS_Timer_3 content (0x%x)", octet);
} else { } else {
*(buf + encoded_size) = 1; *(buf + encoded_size) = 1;
encoded_size++; encoded_size++;
*(buf + encoded_size) = octet; *(buf + encoded_size) = octet;
encoded_size++; encoded_size++;
} }
Logger::nas_mm().debug("encoded GPRS_Timer_3 len(%d)", encoded_size); Logger::nas_mm().debug("Encoded GPRS_Timer_3 len (%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding GPRS_Timer_3 iei(0x%x)", *buf); Logger::nas_mm().debug("Decoding GPRS_Timer_3 IEI (0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
_iei = *buf; _iei = *buf;
...@@ -109,8 +109,8 @@ int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -109,8 +109,8 @@ int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
decoded_size++; decoded_size++;
UNIT = (octet & 0xe0) >> 5; UNIT = (octet & 0xe0) >> 5;
_value = octet & 0x1f; _value = octet & 0x1f;
Logger::nas_mm().debug("decoded GPRS_Timer_3 conent(0x%x)", octet); Logger::nas_mm().debug("Decoded GPRS_Timer_3 content (0x%x)", octet);
Logger::nas_mm().debug("decoded GPRS_Timer_3 len(%d)", decoded_size); Logger::nas_mm().debug("Decoded GPRS_Timer_3 len (%d)", decoded_size);
return decoded_size; return decoded_size;
} }
...@@ -73,7 +73,7 @@ bool NSSAI::getValue(std::vector<struct SNSSAI_s> &nssai) { ...@@ -73,7 +73,7 @@ bool NSSAI::getValue(std::vector<struct SNSSAI_s> &nssai) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int NSSAI::encode2buffer(uint8_t *buf, int len) { int NSSAI::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding NSSAI iei(0x%x)", _iei); Logger::nas_mm().debug("Encoding NSSAI IEI (0x%x)", _iei);
if (len < length) { if (len < length) {
Logger::nas_mm().error("len is less than %d", length); Logger::nas_mm().error("len is less than %d", length);
return 0; return 0;
...@@ -94,13 +94,13 @@ int NSSAI::encode2buffer(uint8_t *buf, int len) { ...@@ -94,13 +94,13 @@ int NSSAI::encode2buffer(uint8_t *buf, int len) {
len_s_nssai += 3; len_s_nssai += 3;
*(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x00ff0000) >> 16; *(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x00ff0000) >> 16;
encoded_size++; encoded_size++;
Logger::nas_mm().debug("decoded NSSAI len(%x)", *(buf + encoded_size - 1)); Logger::nas_mm().debug("Encoded NSSAI len (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x0000ff00) >> 8; *(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x0000ff00) >> 8;
encoded_size++; encoded_size++;
Logger::nas_mm().debug("decoded NSSAI len(%x)", *(buf + encoded_size - 1)); Logger::nas_mm().debug("Encoded NSSAI len (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = S_NSSAI.at(i).sd & 0x000000ff; *(buf + encoded_size) = S_NSSAI.at(i).sd & 0x000000ff;
encoded_size++; encoded_size++;
Logger::nas_mm().debug("decoded NSSAI len(%x)", *(buf + encoded_size - 1)); Logger::nas_mm().debug("Encoded NSSAI len (%x)", *(buf + encoded_size - 1));
} }
if (S_NSSAI.at(i).mHplmnSst != -1) { if (S_NSSAI.at(i).mHplmnSst != -1) {
len_s_nssai += 1; len_s_nssai += 1;
...@@ -122,13 +122,13 @@ int NSSAI::encode2buffer(uint8_t *buf, int len) { ...@@ -122,13 +122,13 @@ int NSSAI::encode2buffer(uint8_t *buf, int len) {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
Logger::nas_mm().debug("encoded NSSAI len(%d)", encoded_size); Logger::nas_mm().debug("Encoded NSSAI len (%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding NSSAI iei(0x%x)", *buf); Logger::nas_mm().debug("Decoding NSSAI IEI (0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
SNSSAI_s a = { 0, 0, 0, 0 }; SNSSAI_s a = { 0, 0, 0, 0 };
if (is_option) { if (is_option) {
...@@ -136,15 +136,15 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -136,15 +136,15 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
} }
length = *(buf + decoded_size); length = *(buf + decoded_size);
decoded_size++; decoded_size++;
int LEAGTH = length; int length_tmp = length;
while (LEAGTH) { while (length_tmp) {
switch (*(buf + decoded_size)) { switch (*(buf + decoded_size)) {
case 1: { case 1: {
decoded_size++; //snssai—leagth decoded_size++; //snssai—leagth
LEAGTH--; length_tmp--;
a.sst = *(buf + decoded_size); a.sst = *(buf + decoded_size);
decoded_size++; //无 sd decoded_size++;
LEAGTH--; length_tmp--;
a.sd = -1; a.sd = -1;
a.mHplmnSst = -1; a.mHplmnSst = -1;
a.mHplmnSd = -1; a.mHplmnSd = -1;
...@@ -152,79 +152,79 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -152,79 +152,79 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
break; break;
case 4: { case 4: {
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sst = *(buf + decoded_size); a.sst = *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.mHplmnSst = -1; a.mHplmnSst = -1;
a.mHplmnSd = -1; a.mHplmnSd = -1;
} }
break; break;
case 5: { case 5: {
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sst = *(buf + decoded_size); a.sst = *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.mHplmnSst = *(buf + decoded_size); a.mHplmnSst = *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.mHplmnSd = -1; a.mHplmnSd = -1;
} }
break; break;
case 8: { case 8: {
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sst = *(buf + decoded_size); a.sst = *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.sd << 8; a.sd << 8;
a.sd |= *(buf + decoded_size); a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.mHplmnSst = *(buf + decoded_size); a.mHplmnSst = *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; length_tmp--;
a.mHplmnSd |= *(buf + decoded_size); a.mHplmnSd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.mHplmnSd << 16; a.mHplmnSd << 16;
a.mHplmnSd |= *(buf + decoded_size); a.mHplmnSd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
a.mHplmnSd << 8; a.mHplmnSd << 8;
a.mHplmnSd |= *(buf + decoded_size); a.mHplmnSd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
LEAGTH--; //有 sd length_tmp--;
} }
break; break;
} }
...@@ -234,9 +234,9 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -234,9 +234,9 @@ int NSSAI::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
} }
for (int i = 0; i < S_NSSAI.size(); i++) { for (int i = 0; i < S_NSSAI.size(); i++) {
Logger::nas_mm().debug("decoded NSSAI SST(0x%x) SD(0x%x) hplmnSST(0x%x) hplmnSD(%d)", S_NSSAI.at(i).sst, S_NSSAI.at(i).sd, S_NSSAI.at(i).mHplmnSst, S_NSSAI.at(i).mHplmnSd); Logger::nas_mm().debug("Decoded NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD (%d)", S_NSSAI.at(i).sst, S_NSSAI.at(i).sd, S_NSSAI.at(i).mHplmnSst, S_NSSAI.at(i).mHplmnSd);
} }
Logger::nas_mm().debug("decoded NSSAI len(%d)", decoded_size); Logger::nas_mm().debug("Decoded NSSAI len (%d)", decoded_size);
return decoded_size; return decoded_size;
} }
...@@ -114,8 +114,7 @@ int UESecurityCapability::decodefrombuffer(uint8_t *buf, int len, bool is_option ...@@ -114,8 +114,7 @@ int UESecurityCapability::decodefrombuffer(uint8_t *buf, int len, bool is_option
decoded_size++; decoded_size++;
_5g_IASel = *(buf + decoded_size); _5g_IASel = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Decoded UESecurityCapability EA 0x%d,IA 0x%d", _5g_EASel, _5g_IASel); Logger::nas_mm().debug("UESecurityCapability EA 0x%d,IA 0x%d", _5g_EASel, _5g_IASel);
Logger::nas_mm().debug("Decoded UESecurityCapability (len %d)", decoded_size);
return decoded_size; return decoded_size;
} }
...@@ -61,7 +61,7 @@ uint8_t _5GS_Network_Feature_Support::getValue() { ...@@ -61,7 +61,7 @@ uint8_t _5GS_Network_Feature_Support::getValue() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int _5GS_Network_Feature_Support::encode2buffer(uint8_t *buf, int len) { int _5GS_Network_Feature_Support::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding _5GS_Network_Feature_Support iei(0x%x)", _iei); Logger::nas_mm().debug("Encoding _5GS_Network_Feature_Support IEI (0x%x)", _iei);
if (len < length) { if (len < length) {
Logger::nas_mm().error("len is less than %d", length); Logger::nas_mm().error("len is less than %d", length);
return 0; return 0;
...@@ -82,13 +82,13 @@ int _5GS_Network_Feature_Support::encode2buffer(uint8_t *buf, int len) { ...@@ -82,13 +82,13 @@ int _5GS_Network_Feature_Support::encode2buffer(uint8_t *buf, int len) {
// *(buf + encoded_size) = _5g_EASel; encoded_size++; // *(buf + encoded_size) = _5g_EASel; encoded_size++;
// *(buf + encoded_size) = _5g_IASel; encoded_size++; // *(buf + encoded_size) = _5g_IASel; encoded_size++;
} }
Logger::nas_mm().debug("encoded _5GS_Network_Feature_Support len(%d)", encoded_size); Logger::nas_mm().debug("Encoded _5GS_Network_Feature_Support len (%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int _5GS_Network_Feature_Support::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int _5GS_Network_Feature_Support::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding _5GS_Network_Feature_Support iei(0x%x)", *buf); Logger::nas_mm().debug("Decoding _5GS_Network_Feature_Support IEI (0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
...@@ -97,8 +97,8 @@ int _5GS_Network_Feature_Support::decodefrombuffer(uint8_t *buf, int len, bool i ...@@ -97,8 +97,8 @@ int _5GS_Network_Feature_Support::decodefrombuffer(uint8_t *buf, int len, bool i
decoded_size++; decoded_size++;
_value = *(buf + decoded_size); _value = *(buf + decoded_size);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("decoded _5GS_Network_Feature_Support value(0x%x)", _value); Logger::nas_mm().debug("Decoded _5GS_Network_Feature_Support value (0x%x)", _value);
Logger::nas_mm().debug("decoded _5GS_Network_Feature_Support len(%d)", decoded_size); Logger::nas_mm().debug("Decoded _5GS_Network_Feature_Support len (%d)", decoded_size);
return decoded_size; return decoded_size;
} }
...@@ -82,14 +82,14 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) { ...@@ -82,14 +82,14 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding AuthenticationFailure message"); Logger::nas_mm().debug("encoding AuthenticationFailure message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_5gmm_cause) { if (!ie_5gmm_cause) {
Logger::nas_mm().warn("IE ie_5gmm_cause is not avaliable"); Logger::nas_mm().warn("IE ie_5gmm_cause is not available");
} else { } else {
if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -98,7 +98,7 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) { ...@@ -98,7 +98,7 @@ int AuthenticationFailure::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_authentication_failure_parameter) { if (!ie_authentication_failure_parameter) {
Logger::nas_mm().warn("IE ie_authentication_failure_parameter is not avaliable"); Logger::nas_mm().warn("IE ie_authentication_failure_parameter is not available");
} else { } else {
if (int size = ie_authentication_failure_parameter->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_authentication_failure_parameter->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -59,14 +59,14 @@ int AuthenticationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -59,14 +59,14 @@ int AuthenticationReject::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding AuthenticationReject message"); Logger::nas_mm().debug("encoding AuthenticationReject message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -85,14 +85,14 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) { ...@@ -85,14 +85,14 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding AuthenticationResponse message"); Logger::nas_mm().debug("encoding AuthenticationResponse message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_authentication_response_parameter) { if (!ie_authentication_response_parameter) {
Logger::nas_mm().warn("IE ie_authentication_response_parameter is not avaliable"); Logger::nas_mm().warn("IE ie_authentication_response_parameter is not available");
} else { } else {
if (int size = ie_authentication_response_parameter->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_authentication_response_parameter->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -102,7 +102,7 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) { ...@@ -102,7 +102,7 @@ int AuthenticationResponse::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -71,14 +71,14 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) { ...@@ -71,14 +71,14 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding AuthenticationResult message"); Logger::nas_mm().debug("encoding AuthenticationResult message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_ngKSI) { if (!ie_ngKSI) {
Logger::nas_mm().warn("IE ie_ngKSI is not avaliable"); Logger::nas_mm().warn("IE ie_ngKSI is not available");
} else { } else {
if (int size = ie_ngKSI->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ngKSI->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -88,7 +88,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) { ...@@ -88,7 +88,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -98,7 +98,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) { ...@@ -98,7 +98,7 @@ int AuthenticationResult::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_abba) { if (!ie_abba) {
Logger::nas_mm().warn("IE ie_abba is not avaliable"); Logger::nas_mm().warn("IE ie_abba is not available");
} else { } else {
if (int size = ie_abba->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_abba->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -96,14 +96,14 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -96,14 +96,14 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding DLNASTransport message"); Logger::nas_mm().debug("encoding DLNASTransport message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_payload_container_type) { if (!ie_payload_container_type) {
Logger::nas_mm().warn("IE ie_payload_container_type is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container_type is not available");
} else { } else {
if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -113,7 +113,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -113,7 +113,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_payload_container) { if (!ie_payload_container) {
Logger::nas_mm().warn("IE ie_payload_container is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container is not available");
} else { } else {
if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -123,7 +123,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -123,7 +123,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_pdu_session_identity_2) { if (!ie_pdu_session_identity_2) {
Logger::nas_mm().warn("IE ie_pdu_session_identity_2 is not avaliable"); Logger::nas_mm().warn("IE ie_pdu_session_identity_2 is not available");
} else { } else {
if (int size = ie_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -134,7 +134,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -134,7 +134,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_additional_information) { if (!ie_additional_information) {
Logger::nas_mm().warn("IE ie_additional_information is not avaliable"); Logger::nas_mm().warn("IE ie_additional_information is not available");
} else { } else {
if (int size = ie_additional_information->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_additional_information->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -145,7 +145,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -145,7 +145,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_5gmm_cause) { if (!ie_5gmm_cause) {
Logger::nas_mm().warn("IE ie_5gmm_cause is not avaliable"); Logger::nas_mm().warn("IE ie_5gmm_cause is not available");
} else { } else {
if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -154,7 +154,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -154,7 +154,7 @@ int DLNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_back_off_timer_value) { if (!ie_back_off_timer_value) {
Logger::nas_mm().warn("IE ie_back_off_timer_value is not avaliable"); Logger::nas_mm().warn("IE ie_back_off_timer_value is not available");
} else { } else {
if (int size = ie_back_off_timer_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_back_off_timer_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -59,14 +59,14 @@ int IdentityRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -59,14 +59,14 @@ int IdentityRequest::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding IdentityRequest message"); Logger::nas_mm().debug("encoding IdentityRequest message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!_5gs_identity_type) { if (!_5gs_identity_type) {
Logger::nas_mm().warn("IE _5gs_identity_type is not avaliable"); Logger::nas_mm().warn("IE _5gs_identity_type is not available");
} else { } else {
if (int size = _5gs_identity_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = _5gs_identity_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -80,14 +80,14 @@ int IdentityResponse::encode2buffer(uint8_t *buf, int len) { ...@@ -80,14 +80,14 @@ int IdentityResponse::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding IdentityResponse message"); Logger::nas_mm().debug("encoding IdentityResponse message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_mobility_id) { if (!ie_mobility_id) {
Logger::nas_mm().warn("IE ie_mobility_id is not avaliable"); Logger::nas_mm().warn("IE ie_mobility_id is not available");
} else { } else {
if (int size = ie_mobility_id->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_mobility_id->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -83,7 +83,7 @@ void RegistrationAccept::set_5GS_Registration_Result(bool emergency, bool nssaa, ...@@ -83,7 +83,7 @@ void RegistrationAccept::set_5GS_Registration_Result(bool emergency, bool nssaa,
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setSUCI_SUPI_format_IMSI(const string mcc, const string mnc, const string routingInd, uint8_t protection_sch_id, const string msin) { void RegistrationAccept::setSUCI_SUPI_format_IMSI(const string mcc, const string mnc, const string routingInd, uint8_t protection_sch_id, const string msin) {
if (protection_sch_id != NULL_SCHEME) { if (protection_sch_id != NULL_SCHEME) {
Logger::nas_mm().error("encoding suci and supi format for imsi error, please choose right interface"); Logger::nas_mm().error("Encoding SUCI and SUPI format for IMSI error, please choose right interface");
return; return;
} else { } else {
ie_5g_guti = new _5GSMobilityIdentity(mcc, mnc, routingInd, protection_sch_id, msin); ie_5g_guti = new _5GSMobilityIdentity(mcc, mnc, routingInd, protection_sch_id, msin);
...@@ -246,538 +246,538 @@ void RegistrationAccept::setTaiList(std::vector<p_tai_t> tai_list) { ...@@ -246,538 +246,538 @@ void RegistrationAccept::setTaiList(std::vector<p_tai_t> tai_list) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int RegistrationAccept::encode2buffer(uint8_t *buf, int len) { int RegistrationAccept::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding RegistrationAccept message"); Logger::nas_mm().debug("Encoding RegistrationAccept message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_5gs_registration_result) { if (!ie_5gs_registration_result) {
Logger::nas_mm().warn("IE ie_5gs_registration_result is not avaliable"); Logger::nas_mm().warn("IE ie_5gs_registration_result is not available");
} else { } else {
if (int size = ie_5gs_registration_result->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gs_registration_result->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_5gs_registration_result error"); Logger::nas_mm().error("Encoding ie_5gs_registration_result error");
return 0; return 0;
} }
} }
if (!ie_5g_guti) { if (!ie_5g_guti) {
Logger::nas_mm().warn("IE ie_5g_guti is not avaliable"); Logger::nas_mm().warn("IE ie_5g_guti is not available");
} else { } else {
int size = ie_5g_guti->encode2buffer(buf + encoded_size, len - encoded_size); int size = ie_5g_guti->encode2buffer(buf + encoded_size, len - encoded_size);
if (size) { if (size) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_5g_guti error"); Logger::nas_mm().error("Encoding ie_5g_guti error");
return 0; return 0;
} }
} }
if (!ie_tai_list) { if (!ie_tai_list) {
Logger::nas_mm().warn("IE ie_tai_list is not avaliable"); Logger::nas_mm().warn("IE ie_tai_list is not available");
} else { } else {
int size = ie_tai_list->encode2buffer(buf + encoded_size, len - encoded_size); int size = ie_tai_list->encode2buffer(buf + encoded_size, len - encoded_size);
if (size != -1) { if (size != -1) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_tai_list error"); Logger::nas_mm().error("Encoding ie_tai_list error");
return 0; return 0;
} }
} }
if (!ie_equivalent_plmns) { if (!ie_equivalent_plmns) {
Logger::nas_mm().warn("IE ie_equivalent_plmns is not avaliable"); Logger::nas_mm().warn("IE ie_equivalent_plmns is not available");
} else { } else {
if (int size = ie_equivalent_plmns->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_equivalent_plmns->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_equivalent_plmns error"); Logger::nas_mm().error("Encoding ie_equivalent_plmns error");
return 0; return 0;
} }
} }
if (!ie_allowed_nssai) { if (!ie_allowed_nssai) {
Logger::nas_mm().warn("IE ie_allowed_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_allowed_nssai is not available");
} else { } else {
if (int size = ie_allowed_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_allowed_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_allowed_nssai error"); Logger::nas_mm().error("Encoding ie_allowed_nssai error");
return 0; return 0;
} }
} }
if (!ie_rejected_nssai) { if (!ie_rejected_nssai) {
Logger::nas_mm().warn("IE ie_rejected_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_rejected_nssai is not available");
} else { } else {
if (int size = ie_rejected_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_rejected_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_rejected_nssai error"); Logger::nas_mm().error("Encoding ie_rejected_nssai error");
} }
} }
if (!ie_configured_nssai) { if (!ie_configured_nssai) {
Logger::nas_mm().warn("IE ie_configured_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_configured_nssai is not available");
} else { } else {
if (int size = ie_configured_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_configured_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_configured_nssai error"); Logger::nas_mm().error("Encoding ie_configured_nssai error");
return 0; return 0;
} }
} }
if (!ie_5gs_network_feature_support) { if (!ie_5gs_network_feature_support) {
Logger::nas_mm().warn("IE ie_5gs_network_feature_support is not avaliable"); Logger::nas_mm().warn("IE ie_5gs_network_feature_support is not available");
} else { } else {
if (int size = ie_5gs_network_feature_support->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gs_network_feature_support->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_5gs_network_feature_support error"); Logger::nas_mm().error("Encoding ie_5gs_network_feature_support error");
return 0; return 0;
} }
} }
if (!ie_PDU_session_status) { if (!ie_PDU_session_status) {
Logger::nas_mm().warn("IE ie_PDU_session_status is not avaliable"); Logger::nas_mm().warn("IE ie_PDU_session_status is not available");
} else { } else {
if (int size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_PDU_session_status error"); Logger::nas_mm().error("Encoding ie_PDU_session_status error");
return 0; return 0;
} }
} }
if (!ie_pdu_session_reactivation_result) { if (!ie_pdu_session_reactivation_result) {
Logger::nas_mm().warn("IE ie_pdu_session_reactivation_result is not avaliable"); Logger::nas_mm().warn("IE ie_pdu_session_reactivation_result is not available");
} else { } else {
if (int size = ie_pdu_session_reactivation_result->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_pdu_session_reactivation_result->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_pdu_session_reactivation_result error"); Logger::nas_mm().error("Encoding ie_pdu_session_reactivation_result error");
return 0; return 0;
} }
} }
if (!ie_pdu_session_reactivation_result_error_cause) { if (!ie_pdu_session_reactivation_result_error_cause) {
Logger::nas_mm().warn("IE ie_pdu_session_reactivation_result_error_cause is not avaliable"); Logger::nas_mm().warn("IE ie_pdu_session_reactivation_result_error_cause is not available");
} else { } else {
if (int size = ie_pdu_session_reactivation_result_error_cause->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_pdu_session_reactivation_result_error_cause->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_pdu_session_reactivation_result_error_cause error"); Logger::nas_mm().error("Encoding ie_pdu_session_reactivation_result_error_cause error");
return 0; return 0;
} }
} }
if (!ie_MICO_indicationl) { if (!ie_MICO_indicationl) {
Logger::nas_mm().warn("IE ie_MICO_indicationl is not avaliable"); Logger::nas_mm().warn("IE ie_MICO_indicationl is not available");
} else { } else {
if (int size = ie_MICO_indicationl->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_MICO_indicationl->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_MICO_indicationl error"); Logger::nas_mm().error("Encoding ie_MICO_indicationl error");
return 0; return 0;
} }
} }
if (!ie_network_slicing_indication) { if (!ie_network_slicing_indication) {
Logger::nas_mm().warn("IE ie_network_slicing_indication is not avaliable"); Logger::nas_mm().warn("IE ie_network_slicing_indication is not available");
} else { } else {
if (int size = ie_network_slicing_indication->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_network_slicing_indication->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_network_slicing_indication error"); Logger::nas_mm().error("Encoding ie_network_slicing_indication error");
return 0; return 0;
} }
} }
if (!ie_T3512_value) { if (!ie_T3512_value) {
Logger::nas_mm().warn("IE ie_T3512_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3512_value is not available");
} else { } else {
if (int size = ie_T3512_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3512_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_T3512_value error"); Logger::nas_mm().error("Encoding ie_T3512_value error");
return 0; return 0;
} }
} }
if (!ie_Non_3GPP_de_registration_timer_value) { if (!ie_Non_3GPP_de_registration_timer_value) {
Logger::nas_mm().warn("IE ie_Non_3GPP_de_registration_timer_value is not avaliable"); Logger::nas_mm().warn("IE ie_Non_3GPP_de_registration_timer_value is not available");
} else { } else {
if (int size = ie_Non_3GPP_de_registration_timer_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_Non_3GPP_de_registration_timer_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_Non_3GPP_de_registration_timer_value error"); Logger::nas_mm().error("Encoding ie_Non_3GPP_de_registration_timer_value error");
return 0; return 0;
} }
} }
if (!ie_T3502_value) { if (!ie_T3502_value) {
Logger::nas_mm().warn("IE ie_T3502_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3502_value is not available");
} else { } else {
if (int size = ie_T3502_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3502_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_T3502_value error"); Logger::nas_mm().error("Encoding ie_T3502_value error");
return 0; return 0;
} }
} }
if (!ie_sor_transparent_container) { if (!ie_sor_transparent_container) {
Logger::nas_mm().warn("IE ie_sor_transparent_container is not avaliable"); Logger::nas_mm().warn("IE ie_sor_transparent_container is not available");
} else { } else {
if (int size = ie_sor_transparent_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_sor_transparent_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_sor_transparent_container error"); Logger::nas_mm().error("Encoding ie_sor_transparent_container error");
return 0; return 0;
} }
} }
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_eap_message error"); Logger::nas_mm().error("Encoding ie_eap_message error");
return 0; return 0;
} }
} }
if (!ie_nssai_inclusion_mode) { if (!ie_nssai_inclusion_mode) {
Logger::nas_mm().warn("IE ie_nssai_inclusion_mode is not avaliable"); Logger::nas_mm().warn("IE ie_nssai_inclusion_mode is not available");
} else { } else {
if (int size = ie_nssai_inclusion_mode->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_nssai_inclusion_mode->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_nssai_inclusion_mode error"); Logger::nas_mm().error("Encoding ie_nssai_inclusion_mode error");
return 0; return 0;
} }
} }
if (!ie_negotiated_drx_parameters) { if (!ie_negotiated_drx_parameters) {
Logger::nas_mm().warn("IE ie_negotiated_drx_parameters is not avaliable"); Logger::nas_mm().warn("IE ie_negotiated_drx_parameters is not available");
} else { } else {
if (int size = ie_negotiated_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_negotiated_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_negotiated_drx_parameters error"); Logger::nas_mm().error("Encoding ie_negotiated_drx_parameters error");
return 0; return 0;
} }
} }
if (!ie_non_3gpp_nw_policies) { if (!ie_non_3gpp_nw_policies) {
Logger::nas_mm().warn("IE ie_non_3gpp_nw_policies is not avaliable"); Logger::nas_mm().warn("IE ie_non_3gpp_nw_policies is not available");
} else { } else {
if (int size = ie_non_3gpp_nw_policies->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_non_3gpp_nw_policies->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_non_3gpp_nw_policies error"); Logger::nas_mm().error("Encoding ie_non_3gpp_nw_policies error");
return 0; return 0;
} }
} }
if (!ie_eps_bearer_context_status) { if (!ie_eps_bearer_context_status) {
Logger::nas_mm().warn("IE ie_eps_bearer_context_status is not avaliable"); Logger::nas_mm().warn("IE ie_eps_bearer_context_status is not available");
} else { } else {
if (int size = ie_eps_bearer_context_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eps_bearer_context_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_eps_bearer_context_status error"); Logger::nas_mm().error("Encoding ie_eps_bearer_context_status error");
return 0; return 0;
} }
} }
if (!ie_extended_drx_parameters) { if (!ie_extended_drx_parameters) {
Logger::nas_mm().warn("IE ie_extended_drx_parameters is not avaliable"); Logger::nas_mm().warn("IE ie_extended_drx_parameters is not available");
} else { } else {
if (int size = ie_extended_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_extended_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_extended_drx_parameters error"); Logger::nas_mm().error("Encoding ie_extended_drx_parameters error");
return 0; return 0;
} }
} }
if (!ie_T3447_value) { if (!ie_T3447_value) {
Logger::nas_mm().warn("IE ie_T3447_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3447_value is not available");
} else { } else {
if (int size = ie_T3447_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3447_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_T3447_value error"); Logger::nas_mm().error("Encoding ie_T3447_value error");
return 0; return 0;
} }
} }
if (!ie_T3448_value) { if (!ie_T3448_value) {
Logger::nas_mm().warn("IE ie_T3448_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3448_value is not available");
} else { } else {
if (int size = ie_T3448_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3448_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_T3448_value error"); Logger::nas_mm().error("Encoding ie_T3448_value error");
return 0; return 0;
} }
} }
if (!ie_T3324_value) { if (!ie_T3324_value) {
Logger::nas_mm().warn("IE ie_T3324_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3324_value is not available");
} else { } else {
if (int size = ie_T3324_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3324_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_T3324_value error"); Logger::nas_mm().error("Encoding ie_T3324_value error");
return 0; return 0;
} }
} }
if (!ie_ue_radio_capability_id) { if (!ie_ue_radio_capability_id) {
Logger::nas_mm().warn("IE ie_ue_radio_capability_id is not avaliable"); Logger::nas_mm().warn("IE ie_ue_radio_capability_id is not available");
} else { } else {
if (int size = ie_ue_radio_capability_id->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ue_radio_capability_id->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_ue_radio_capability_id error"); Logger::nas_mm().error("Encoding ie_ue_radio_capability_id error");
return 0; return 0;
} }
} }
if (!ie_pending_nssai) { if (!ie_pending_nssai) {
Logger::nas_mm().warn("IE ie_pending_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_pending_nssai is not available");
} else { } else {
if (int size = ie_pending_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_pending_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
} else { } else {
Logger::nas_mm().error("encoding ie_pending_nssai error"); Logger::nas_mm().error("Encoding ie_pending_nssai error");
return 0; return 0;
} }
} }
#if 0 #if 0
if(!ie_tai_list){ if(!ie_tai_list){
Logger::nas_mm().warn("IE ie_tai_list is not avaliable"); Logger::nas_mm().warn("IE ie_tai_list is not available");
}else{ }else{
int size = ie_tai_list->encode2buffer(buf+encoded_size, len-encoded_size); int size = ie_tai_list->encode2buffer(buf+encoded_size, len-encoded_size);
if(size != -1){ if(size != -1){
encoded_size += size; encoded_size += size;
}else{ }else{
Logger::nas_mm().error("encoding ie_tai_list error"); Logger::nas_mm().error("Encoding ie_tai_list error");
return 0; return 0;
} }
} }
#endif #endif
Logger::nas_mm().debug("encoded RegistrationAccept message len(%d)", encoded_size); Logger::nas_mm().debug("Encoded RegistrationAccept message len (%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int RegistrationAccept::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) { int RegistrationAccept::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) {
Logger::nas_mm().debug("decoding RegistrationAccept message"); Logger::nas_mm().debug("Decoding RegistrationAccept message");
int decoded_size = 3; int decoded_size = 3;
plain_header = header; plain_header = header;
ie_5gs_registration_result = new _5GS_Registration_Result(); ie_5gs_registration_result = new _5GS_Registration_Result();
decoded_size += ie_5gs_registration_result->decodefrombuffer(buf + decoded_size, len - decoded_size, false); decoded_size += ie_5gs_registration_result->decodefrombuffer(buf + decoded_size, len - decoded_size, false);
Logger::nas_mm().debug("decoded_size(%d)", decoded_size); Logger::nas_mm().debug("Decoded_size(%d)", decoded_size);
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("first option iei(0x%x)", octet); Logger::nas_mm().debug("First option IEI (0x%x)", octet);
while ((octet != 0x0)) { while ((octet != 0x0)) {
switch ((octet & 0xf0) >> 4) { switch ((octet & 0xf0) >> 4) {
case 0xB: { case 0xB: {
Logger::nas_mm().debug("decoding iei(0xB)"); Logger::nas_mm().debug("Decoding IEI (0xB)");
ie_MICO_indicationl = new MICO_Indication(); ie_MICO_indicationl = new MICO_Indication();
decoded_size += ie_MICO_indicationl->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_MICO_indicationl->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x9: { case 0x9: {
Logger::nas_mm().debug("decoding iei(0x9)"); Logger::nas_mm().debug("Decoding IEI (0x9)");
ie_network_slicing_indication = new Network_Slicing_Indication(); ie_network_slicing_indication = new Network_Slicing_Indication();
decoded_size += ie_network_slicing_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_network_slicing_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0xA: { case 0xA: {
Logger::nas_mm().debug("decoding iei(0xA)"); Logger::nas_mm().debug("Decoding IEI (0xA)");
ie_nssai_inclusion_mode = new NSSAI_Inclusion_Mode(); ie_nssai_inclusion_mode = new NSSAI_Inclusion_Mode();
decoded_size += ie_nssai_inclusion_mode->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_nssai_inclusion_mode->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0xD: { case 0xD: {
Logger::nas_mm().debug("decoding iei(0xD)"); Logger::nas_mm().debug("Decoding IEI (0xD)");
ie_non_3gpp_nw_policies = new Non_3GPP_NW_Provided_Policies(); ie_non_3gpp_nw_policies = new Non_3GPP_NW_Provided_Policies();
decoded_size += ie_non_3gpp_nw_policies->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_non_3gpp_nw_policies->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
} }
switch (octet) { switch (octet) {
case 0x77: { case 0x77: {
Logger::nas_mm().debug("decoding iei(0x77)"); Logger::nas_mm().debug("Decoding IEI (0x77)");
ie_5g_guti = new _5GSMobilityIdentity(); ie_5g_guti = new _5GSMobilityIdentity();
decoded_size += ie_5g_guti->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_5g_guti->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x15: { case 0x15: {
Logger::nas_mm().debug("decoding iei(0x15)"); Logger::nas_mm().debug("Decoding IEI (0x15)");
ie_allowed_nssai = new NSSAI(); ie_allowed_nssai = new NSSAI();
decoded_size += ie_allowed_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_allowed_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x11: { case 0x11: {
Logger::nas_mm().debug("decoding iei(0x11)"); Logger::nas_mm().debug("Decoding IEI (0x11)");
ie_rejected_nssai = new Rejected_NSSAI(); ie_rejected_nssai = new Rejected_NSSAI();
decoded_size += ie_rejected_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_rejected_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x31: { case 0x31: {
Logger::nas_mm().debug("decoding iei(0x31)"); Logger::nas_mm().debug("Decoding IEI (0x31)");
ie_configured_nssai = new NSSAI(); ie_configured_nssai = new NSSAI();
decoded_size += ie_configured_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_configured_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x21: { case 0x21: {
Logger::nas_mm().debug("decoding iei(0x21)"); Logger::nas_mm().debug("Decoding IEI (0x21)");
ie_5gs_network_feature_support = new _5GS_Network_Feature_Support(); ie_5gs_network_feature_support = new _5GS_Network_Feature_Support();
decoded_size += ie_5gs_network_feature_support->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_5gs_network_feature_support->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x50: { case 0x50: {
Logger::nas_mm().debug("decoding iei(0x50)"); Logger::nas_mm().debug("Decoding IEI (0x50)");
ie_PDU_session_status = new PDU_Session_Status(); ie_PDU_session_status = new PDU_Session_Status();
decoded_size += ie_PDU_session_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_PDU_session_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x26: { case 0x26: {
Logger::nas_mm().debug("decoding iei(0x26)"); Logger::nas_mm().debug("Decoding IEI (0x26)");
ie_pdu_session_reactivation_result = new PDU_Session_Reactivation_Result(); ie_pdu_session_reactivation_result = new PDU_Session_Reactivation_Result();
decoded_size += ie_pdu_session_reactivation_result->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_pdu_session_reactivation_result->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x72: { case 0x72: {
Logger::nas_mm().debug("decoding iei(0x72)"); Logger::nas_mm().debug("Decoding IEI (0x72)");
ie_pdu_session_reactivation_result_error_cause = new PDU_Session_Reactivation_Result_Error_Cause(); ie_pdu_session_reactivation_result_error_cause = new PDU_Session_Reactivation_Result_Error_Cause();
decoded_size += ie_pdu_session_reactivation_result_error_cause->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_pdu_session_reactivation_result_error_cause->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x5E: { case 0x5E: {
Logger::nas_mm().debug("decoding iei(0x5E)"); Logger::nas_mm().debug("Decoding IEI (0x5E)");
ie_T3512_value = new GPRS_Timer_3(); ie_T3512_value = new GPRS_Timer_3();
decoded_size += ie_T3512_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_T3512_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x5D: { case 0x5D: {
Logger::nas_mm().debug("decoding iei(0x5D)"); Logger::nas_mm().debug("Decoding IEI (0x5D)");
ie_Non_3GPP_de_registration_timer_value = new GPRS_Timer_2(); ie_Non_3GPP_de_registration_timer_value = new GPRS_Timer_2();
decoded_size += ie_Non_3GPP_de_registration_timer_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_Non_3GPP_de_registration_timer_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x16: { case 0x16: {
Logger::nas_mm().debug("decoding iei(0x16)"); Logger::nas_mm().debug("Decoding IEI (0x16)");
ie_T3502_value = new GPRS_Timer_2(); ie_T3502_value = new GPRS_Timer_2();
decoded_size += ie_T3502_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_T3502_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x73: { case 0x73: {
Logger::nas_mm().debug("decoding iei(0x73)"); Logger::nas_mm().debug("Decoding IEI (0x73)");
ie_sor_transparent_container = new SOR_Transparent_Container(); ie_sor_transparent_container = new SOR_Transparent_Container();
decoded_size += ie_sor_transparent_container->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_sor_transparent_container->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x78: { case 0x78: {
Logger::nas_mm().debug("decoding iei(0x78)"); Logger::nas_mm().debug("Decoding IEI (0x78)");
ie_eap_message = new EAP_Message(); ie_eap_message = new EAP_Message();
decoded_size += ie_eap_message->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_eap_message->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x51: { case 0x51: {
Logger::nas_mm().debug("decoding iei(0x51)"); Logger::nas_mm().debug("Decoding IEI (0x51)");
ie_negotiated_drx_parameters = new _5GS_DRX_arameters(); ie_negotiated_drx_parameters = new _5GS_DRX_arameters();
decoded_size += ie_negotiated_drx_parameters->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_negotiated_drx_parameters->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x60: { case 0x60: {
Logger::nas_mm().debug("decoding iei(0x60)"); Logger::nas_mm().debug("Decoding IEI (0x60)");
ie_eps_bearer_context_status = new EPS_Bearer_Context_Status(); ie_eps_bearer_context_status = new EPS_Bearer_Context_Status();
decoded_size += ie_eps_bearer_context_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_eps_bearer_context_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x6E: { case 0x6E: {
Logger::nas_mm().debug("decoding iei(0x6E)"); Logger::nas_mm().debug("Decoding IEI (0x6E)");
ie_extended_drx_parameters = new Extended_DRX_Parameters(); ie_extended_drx_parameters = new Extended_DRX_Parameters();
decoded_size += ie_extended_drx_parameters->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_extended_drx_parameters->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x6C: { case 0x6C: {
Logger::nas_mm().debug("decoding iei(0x6C)"); Logger::nas_mm().debug("Decoding IEI (0x6C)");
ie_T3447_value = new GPRS_Timer_3(); ie_T3447_value = new GPRS_Timer_3();
decoded_size += ie_T3447_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_T3447_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x6B: { case 0x6B: {
Logger::nas_mm().debug("decoding iei(0x6B)"); Logger::nas_mm().debug("Decoding IEI (0x6B)");
ie_T3448_value = new GPRS_Timer_3(); ie_T3448_value = new GPRS_Timer_3();
decoded_size += ie_T3448_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_T3448_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x6A: { case 0x6A: {
Logger::nas_mm().debug("decoding iei(0x6A)"); Logger::nas_mm().debug("Decoding IEI (0x6A)");
ie_T3324_value = new GPRS_Timer_3(); ie_T3324_value = new GPRS_Timer_3();
decoded_size += ie_T3324_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_T3324_value->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x67: { case 0x67: {
Logger::nas_mm().debug("decoding iei(0x67)"); Logger::nas_mm().debug("Decoding IEI (0x67)");
ie_ue_radio_capability_id = new UE_Radio_Capability_ID(); ie_ue_radio_capability_id = new UE_Radio_Capability_ID();
decoded_size += ie_ue_radio_capability_id->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_ue_radio_capability_id->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x39: { case 0x39: {
Logger::nas_mm().debug("decoding iei(0x39)"); Logger::nas_mm().debug("Decoding IEI (0x39)");
ie_pending_nssai = new NSSAI(); ie_pending_nssai = new NSSAI();
decoded_size += ie_pending_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_pending_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x4A: { case 0x4A: {
Logger::nas_mm().debug("decoding iei(0x4A)"); Logger::nas_mm().debug("Decoding IEI (0x4A)");
ie_equivalent_plmns = new PLMN_List(); ie_equivalent_plmns = new PLMN_List();
decoded_size += ie_equivalent_plmns->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_equivalent_plmns->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
} }
} }
Logger::nas_mm().debug("decoded RegistrationAccept message len(%d)", decoded_size); Logger::nas_mm().debug("Decoded RegistrationAccept message len (%d)", decoded_size);
} }
...@@ -59,14 +59,14 @@ int RegistrationComplete::encode2buffer(uint8_t *buf, int len) { ...@@ -59,14 +59,14 @@ int RegistrationComplete::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding RegistrationComplete message"); Logger::nas_mm().debug("encoding RegistrationComplete message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_sor_transparent_container) { if (!ie_sor_transparent_container) {
Logger::nas_mm().warn("IE ie_sor_transparent_container is not avaliable"); Logger::nas_mm().warn("IE ie_sor_transparent_container is not available");
} else { } else {
if (int size = ie_sor_transparent_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_sor_transparent_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -83,14 +83,14 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -83,14 +83,14 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding RegistrationReject message"); Logger::nas_mm().debug("encoding RegistrationReject message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_5gmm_cause) { if (!ie_5gmm_cause) {
Logger::nas_mm().warn("IE ie_5gmm_cause is not avaliable"); Logger::nas_mm().warn("IE ie_5gmm_cause is not available");
} else { } else {
if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -99,7 +99,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -99,7 +99,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_T3346_value) { if (!ie_T3346_value) {
Logger::nas_mm().warn("IE ie_T3346_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3346_value is not available");
} else { } else {
if (int size = ie_T3346_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3346_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -109,7 +109,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -109,7 +109,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_T3502_value) { if (!ie_T3502_value) {
Logger::nas_mm().warn("IE ie_T3502_value is not avaliable"); Logger::nas_mm().warn("IE ie_T3502_value is not available");
} else { } else {
if (int size = ie_T3502_value->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_T3502_value->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -119,7 +119,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -119,7 +119,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -129,7 +129,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) { ...@@ -129,7 +129,7 @@ int RegistrationReject::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_rejected_nssai) { if (!ie_rejected_nssai) {
Logger::nas_mm().warn("IE ie_rejected_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_rejected_nssai is not available");
} else { } else {
if (int size = ie_rejected_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_rejected_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -493,19 +493,19 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -493,19 +493,19 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding RegistrationRequest message"); Logger::nas_mm().debug("encoding RegistrationRequest message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!ie_5gsregistrationtype) { if (!ie_5gsregistrationtype) {
Logger::nas_mm().error("Mandontary IE missing ie_5gsregistrationtype"); Logger::nas_mm().error("Mandatory IE missing ie_5gsregistrationtype");
return 0; return 0;
} }
if (!ie_ngKSI) { if (!ie_ngKSI) {
Logger::nas_mm().error("Mandontary IE missing ie_ngKSI"); Logger::nas_mm().error("Mandatory IE missing ie_ngKSI");
return 0; return 0;
} }
if (!ie_5gs_mobility_id) { if (!ie_5gs_mobility_id) {
Logger::nas_mm().error("Mandontary IE missing ie_5gs_mobility_id"); Logger::nas_mm().error("Mandatory IE missing ie_5gs_mobility_id");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
...@@ -529,7 +529,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -529,7 +529,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
return 0; return 0;
} }
if (!ie_non_current_native_nas_ksi) { if (!ie_non_current_native_nas_ksi) {
Logger::nas_mm().warn("IE non_current_native_nas_ksi is not avaliable"); Logger::nas_mm().warn("IE non_current_native_nas_ksi is not available");
} else { } else {
if (ie_non_current_native_nas_ksi->encode2buffer(buf + encoded_size, len - encoded_size) == 1) { if (ie_non_current_native_nas_ksi->encode2buffer(buf + encoded_size, len - encoded_size) == 1) {
encoded_size++; encoded_size++;
...@@ -538,7 +538,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -538,7 +538,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_5g_mm_capability) { if (!ie_5g_mm_capability) {
Logger::nas_mm().warn("IE ie_5g_mm_capability is not avaliable"); Logger::nas_mm().warn("IE ie_5g_mm_capability is not available");
} else { } else {
if (int size = ie_5g_mm_capability->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5g_mm_capability->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -548,7 +548,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -548,7 +548,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ue_security_capability) { if (!ie_ue_security_capability) {
Logger::nas_mm().warn("IE ie_ue_security_capability is not avaliable"); Logger::nas_mm().warn("IE ie_ue_security_capability is not available");
} else { } else {
if (int size = ie_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -558,7 +558,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -558,7 +558,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_requested_NSSAI) { if (!ie_requested_NSSAI) {
Logger::nas_mm().warn("IE ie_requested_NSSAI is not avaliable"); Logger::nas_mm().warn("IE ie_requested_NSSAI is not available");
} else { } else {
if (int size = ie_requested_NSSAI->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_requested_NSSAI->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -568,7 +568,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -568,7 +568,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_last_visited_registered_TAI) { if (!ie_last_visited_registered_TAI) {
Logger::nas_mm().warn("IE ie_Last_visited_registered_TAI is not avaliable"); Logger::nas_mm().warn("IE ie_Last_visited_registered_TAI is not available");
} else { } else {
if (int size = ie_last_visited_registered_TAI->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_last_visited_registered_TAI->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -578,7 +578,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -578,7 +578,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_s1_ue_network_capability) { if (!ie_s1_ue_network_capability) {
Logger::nas_mm().warn("IE ie_s1_ue_network_capability is not avaliable"); Logger::nas_mm().warn("IE ie_s1_ue_network_capability is not available");
} else { } else {
if (int size = ie_s1_ue_network_capability->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_s1_ue_network_capability->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -588,7 +588,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -588,7 +588,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_uplink_data_status) { if (!ie_uplink_data_status) {
Logger::nas_mm().warn("IE ie_uplink_data_status is not avaliable"); Logger::nas_mm().warn("IE ie_uplink_data_status is not available");
} else { } else {
if (int size = ie_uplink_data_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_uplink_data_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -598,7 +598,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -598,7 +598,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_PDU_session_status) { if (!ie_PDU_session_status) {
Logger::nas_mm().warn("IE ie_PDU_session_status is not avaliable"); Logger::nas_mm().warn("IE ie_PDU_session_status is not available");
} else { } else {
if (int size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -608,7 +608,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -608,7 +608,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_MICO_indicationl) { if (!ie_MICO_indicationl) {
Logger::nas_mm().warn("IE ie_MICO_indicationl is not avaliable"); Logger::nas_mm().warn("IE ie_MICO_indicationl is not available");
} else { } else {
if (int size = ie_MICO_indicationl->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_MICO_indicationl->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -618,7 +618,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -618,7 +618,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ue_status) { if (!ie_ue_status) {
Logger::nas_mm().warn("IE ie_ue_status is not avaliable"); Logger::nas_mm().warn("IE ie_ue_status is not available");
} else { } else {
if (int size = ie_ue_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ue_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -628,7 +628,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -628,7 +628,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_additional_guti) { if (!ie_additional_guti) {
Logger::nas_mm().warn("IE ie_additional_guti- is not avaliable"); Logger::nas_mm().warn("IE ie_additional_guti- is not available");
} else { } else {
if (int size = ie_additional_guti->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_additional_guti->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -639,7 +639,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -639,7 +639,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_allowed_PDU_session_status) { if (!ie_allowed_PDU_session_status) {
Logger::nas_mm().warn("IE ie_allowed_PDU_session_status is not avaliable"); Logger::nas_mm().warn("IE ie_allowed_PDU_session_status is not available");
} else { } else {
if (int size = ie_allowed_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_allowed_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -649,7 +649,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -649,7 +649,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ues_usage_setting) { if (!ie_ues_usage_setting) {
Logger::nas_mm().warn("IE ie_ues_usage_setting is not avaliable"); Logger::nas_mm().warn("IE ie_ues_usage_setting is not available");
} else { } else {
if (int size = ie_ues_usage_setting->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ues_usage_setting->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -659,7 +659,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -659,7 +659,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_5gs_drx_parameters) { if (!ie_5gs_drx_parameters) {
Logger::nas_mm().warn("IE ie_5gs_drx_parameters is not avaliable"); Logger::nas_mm().warn("IE ie_5gs_drx_parameters is not available");
} else { } else {
if (int size = ie_5gs_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gs_drx_parameters->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -669,7 +669,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -669,7 +669,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eps_nas_message_container) { if (!ie_eps_nas_message_container) {
Logger::nas_mm().warn("IE ie_eps_nas_message_container is not avaliable"); Logger::nas_mm().warn("IE ie_eps_nas_message_container is not available");
} else { } else {
if (int size = ie_eps_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eps_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -679,7 +679,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -679,7 +679,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ladn_indication) { if (!ie_ladn_indication) {
Logger::nas_mm().warn("IE ie_ladn_indication is not avaliable"); Logger::nas_mm().warn("IE ie_ladn_indication is not available");
} else { } else {
if (int size = ie_ladn_indication->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ladn_indication->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -689,7 +689,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -689,7 +689,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_payload_container_type) { if (!ie_payload_container_type) {
Logger::nas_mm().warn("IE ie_payload_container_type is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container_type is not available");
} else { } else {
if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -699,7 +699,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -699,7 +699,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_payload_container) { if (!ie_payload_container) {
Logger::nas_mm().warn("IE ie_payload_container is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container is not available");
} else { } else {
if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -709,7 +709,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -709,7 +709,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_network_slicing_indication) { if (!ie_network_slicing_indication) {
Logger::nas_mm().warn("IE ie_network_slicing_indication is not avaliable"); Logger::nas_mm().warn("IE ie_network_slicing_indication is not available");
} else { } else {
if (int size = ie_network_slicing_indication->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_network_slicing_indication->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -719,7 +719,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -719,7 +719,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_5gs_update_type) { if (!ie_5gs_update_type) {
Logger::nas_mm().warn("IE ie_5gs_update_type is not avaliable"); Logger::nas_mm().warn("IE ie_5gs_update_type is not available");
} else { } else {
if (int size = ie_5gs_update_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gs_update_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -730,7 +730,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -730,7 +730,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_nas_message_container) { if (!ie_nas_message_container) {
Logger::nas_mm().warn("IE ie_nas_message_container is not avaliable"); Logger::nas_mm().warn("IE ie_nas_message_container is not available");
} else { } else {
if (int size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -740,7 +740,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -740,7 +740,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eps_bearer_context_status) { if (!ie_eps_bearer_context_status) {
Logger::nas_mm().warn("IE ie_eps_bearer_context_status is not avaliable"); Logger::nas_mm().warn("IE ie_eps_bearer_context_status is not available");
} else { } else {
if (int size = ie_eps_bearer_context_status->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eps_bearer_context_status->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -756,7 +756,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -756,7 +756,7 @@ int RegistrationRequest::encode2buffer(uint8_t *buf, int len) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) { int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) {
Logger::nas_mm().debug("Decoding RegistrationRequest message"); Logger::nas_mm().debug("****Decoding RegistrationRequest message****");
int decoded_size = 3; int decoded_size = 3;
plain_header = header; plain_header = header;
ie_5gsregistrationtype = new _5GSRegistrationType(); ie_5gsregistrationtype = new _5GSRegistrationType();
...@@ -766,7 +766,6 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -766,7 +766,6 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
decoded_size++; decoded_size++;
ie_5gs_mobility_id = new _5GSMobilityIdentity(); ie_5gs_mobility_id = new _5GSMobilityIdentity();
decoded_size += ie_5gs_mobility_id->decodefrombuffer(buf + decoded_size, len - decoded_size, false); decoded_size += ie_5gs_mobility_id->decodefrombuffer(buf + decoded_size, len - decoded_size, false);
Logger::nas_mm().debug("Decoded_size %d", decoded_size);
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("First option IEI 0x%x", octet); Logger::nas_mm().debug("First option IEI 0x%x", octet);
while ((octet != 0x0)) { while ((octet != 0x0)) {
...@@ -796,7 +795,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -796,7 +795,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x9: { case 0x9: {
Logger::nas_mm().debug("Decoding IEI(0x9)"); Logger::nas_mm().debug("Decoding IEI (0x9)");
ie_network_slicing_indication = new Network_Slicing_Indication(); ie_network_slicing_indication = new Network_Slicing_Indication();
decoded_size += ie_network_slicing_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_network_slicing_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -807,7 +806,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -807,7 +806,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
switch (octet) { switch (octet) {
case 0x10: { case 0x10: {
Logger::nas_mm().debug("Decoding IEI(0x10)"); Logger::nas_mm().debug("Decoding IEI (0x10)");
ie_5g_mm_capability = new _5GMMCapability(); ie_5g_mm_capability = new _5GMMCapability();
decoded_size += ie_5g_mm_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_5g_mm_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -815,7 +814,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -815,7 +814,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x2E: { case 0x2E: {
Logger::nas_mm().debug("Decoding IEI(0x2E)"); Logger::nas_mm().debug("Decoding IEI (0x2E)");
ie_ue_security_capability = new UESecurityCapability(); ie_ue_security_capability = new UESecurityCapability();
decoded_size += ie_ue_security_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_ue_security_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -823,7 +822,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -823,7 +822,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x2F: { case 0x2F: {
Logger::nas_mm().debug("Decoding IEI(0x2F)"); Logger::nas_mm().debug("Decoding IEI (0x2F)");
ie_requested_NSSAI = new NSSAI(); ie_requested_NSSAI = new NSSAI();
decoded_size += ie_requested_NSSAI->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_requested_NSSAI->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -839,7 +838,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -839,7 +838,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x17: { case 0x17: {
Logger::nas_mm().debug("Decoding IEI(0x17)"); Logger::nas_mm().debug("Decoding IEI (0x17)");
ie_s1_ue_network_capability = new UENetworkCapability(); ie_s1_ue_network_capability = new UENetworkCapability();
decoded_size += ie_s1_ue_network_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_s1_ue_network_capability->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -856,7 +855,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -856,7 +855,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x50: { case 0x50: {
Logger::nas_mm().debug("Decoding IEI(0x50)"); Logger::nas_mm().debug("Decoding IEI (0x50)");
ie_PDU_session_status = new PDU_Session_Status(); ie_PDU_session_status = new PDU_Session_Status();
decoded_size += ie_PDU_session_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_PDU_session_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -864,7 +863,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -864,7 +863,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x2B: { case 0x2B: {
Logger::nas_mm().debug("Decoding IEI(0x2B)"); Logger::nas_mm().debug("Decoding IEI (0x2B)");
ie_ue_status = new UE_Status(); ie_ue_status = new UE_Status();
decoded_size += ie_ue_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_ue_status->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -872,7 +871,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -872,7 +871,7 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
} }
break; break;
case 0x77: { case 0x77: {
Logger::nas_mm().debug("Decoding IEI(0x77)"); Logger::nas_mm().debug("Decoding IEI (0x77)");
ie_additional_guti = new _5GSMobilityIdentity(); ie_additional_guti = new _5GSMobilityIdentity();
decoded_size += ie_additional_guti->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_additional_guti->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
...@@ -955,6 +954,6 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf ...@@ -955,6 +954,6 @@ int RegistrationRequest::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf
break; break;
} }
} }
Logger::nas_mm().debug("Decoded RegistrationRequest message (len %d)", decoded_size); Logger::nas_mm().debug("****Decoded RegistrationRequest message (len %d)****", decoded_size);
} }
...@@ -106,14 +106,14 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -106,14 +106,14 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding SecurityModeCommand message"); Logger::nas_mm().debug("encoding SecurityModeCommand message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_selected_nas_security_algorithms) { if (!ie_selected_nas_security_algorithms) {
Logger::nas_mm().warn("IE ie_selected_nas_security_algorithms is not avaliable"); Logger::nas_mm().warn("IE ie_selected_nas_security_algorithms is not available");
} else { } else {
if (int size = ie_selected_nas_security_algorithms->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_selected_nas_security_algorithms->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -123,7 +123,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -123,7 +123,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ngKSI) { if (!ie_ngKSI) {
Logger::nas_mm().warn("IE ie_ngKSI is not avaliable"); Logger::nas_mm().warn("IE ie_ngKSI is not available");
} else { } else {
if (int size = ie_ngKSI->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ngKSI->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -133,7 +133,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -133,7 +133,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_ue_security_capability) { if (!ie_ue_security_capability) {
Logger::nas_mm().warn("IE ie_ue_security_capability is not avaliable"); Logger::nas_mm().warn("IE ie_ue_security_capability is not available");
} else { } else {
if (int size = ie_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -143,7 +143,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -143,7 +143,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_imeisv_request) { if (!ie_imeisv_request) {
Logger::nas_mm().warn("IE ie_imeisv_request is not avaliable"); Logger::nas_mm().warn("IE ie_imeisv_request is not available");
} else { } else {
if (int size = ie_imeisv_request->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_imeisv_request->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -153,7 +153,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -153,7 +153,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eps_nas_security_algorithms) { if (!ie_eps_nas_security_algorithms) {
Logger::nas_mm().warn("IE ie_eps_nas_security_algorithms is not avaliable"); Logger::nas_mm().warn("IE ie_eps_nas_security_algorithms is not available");
} else { } else {
if (int size = ie_eps_nas_security_algorithms->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eps_nas_security_algorithms->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -163,7 +163,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -163,7 +163,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_additional_5G_security_information) { if (!ie_additional_5G_security_information) {
Logger::nas_mm().warn("IE ie_additional_5G_security_information is not avaliable"); Logger::nas_mm().warn("IE ie_additional_5G_security_information is not available");
} else { } else {
if (int size = ie_additional_5G_security_information->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_additional_5G_security_information->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -173,7 +173,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -173,7 +173,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_eap_message) { if (!ie_eap_message) {
Logger::nas_mm().warn("IE ie_eap_message is not avaliable"); Logger::nas_mm().warn("IE ie_eap_message is not available");
} else { } else {
if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_eap_message->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -183,7 +183,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -183,7 +183,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_abba) { if (!ie_abba) {
Logger::nas_mm().warn("IE ie_abba is not avaliable"); Logger::nas_mm().warn("IE ie_abba is not available");
} else { } else {
if (int size = ie_abba->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_abba->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -193,7 +193,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) { ...@@ -193,7 +193,7 @@ int SecurityModeCommand::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_s1_ue_security_capability) { if (!ie_s1_ue_security_capability) {
Logger::nas_mm().warn("IE ie_s1_ue_security_capability is not avaliable"); Logger::nas_mm().warn("IE ie_s1_ue_security_capability is not available");
} else { } else {
if (int size = ie_s1_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_s1_ue_security_capability->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -106,14 +106,14 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) { ...@@ -106,14 +106,14 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding SecurityModeComplete message"); Logger::nas_mm().debug("encoding SecurityModeComplete message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_imeisv) { if (!ie_imeisv) {
Logger::nas_mm().warn("IE ie_imeisv is not avaliable"); Logger::nas_mm().warn("IE ie_imeisv is not available");
} else { } else {
if (int size = ie_imeisv->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_imeisv->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -124,7 +124,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) { ...@@ -124,7 +124,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_nas_message_container) { if (!ie_nas_message_container) {
Logger::nas_mm().warn("IE ie_nas_message_container is not avaliable"); Logger::nas_mm().warn("IE ie_nas_message_container is not available");
} else { } else {
if (int size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -134,7 +134,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) { ...@@ -134,7 +134,7 @@ int SecurityModeComplete::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_non_imeisvpei) { if (!ie_non_imeisvpei) {
Logger::nas_mm().warn("IE ie_non_imeisvpei is not avaliable"); Logger::nas_mm().warn("IE ie_non_imeisvpei is not available");
} else { } else {
if (int size = ie_non_imeisvpei->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_non_imeisvpei->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -59,14 +59,14 @@ int SecurityModeReject::encode2buffer(uint8_t *buf, int len) { ...@@ -59,14 +59,14 @@ int SecurityModeReject::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding SecurityModeReject message"); Logger::nas_mm().debug("encoding SecurityModeReject message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_5gmm_cause) { if (!ie_5gmm_cause) {
Logger::nas_mm().warn("IE ie_5gmm_cause is not avaliable"); Logger::nas_mm().warn("IE ie_5gmm_cause is not available");
} else { } else {
if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_5gmm_cause->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
......
...@@ -86,19 +86,19 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -86,19 +86,19 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding ServiceRequest message..."); Logger::nas_mm().debug("encoding ServiceRequest message...");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!ie_ngKSI) { if (!ie_ngKSI) {
Logger::nas_mm().error("Mandontary IE missing ie_ngKSI"); Logger::nas_mm().error("Mandatory IE missing ie_ngKSI");
return 0; return 0;
} }
if (!ie_service_type) { if (!ie_service_type) {
Logger::nas_mm().error("Mandontary IE missing ie_service_type"); Logger::nas_mm().error("Mandatory IE missing ie_service_type");
return 0; return 0;
} }
if (!ie_5g_s_tmsi) { if (!ie_5g_s_tmsi) {
Logger::nas_mm().error("Mandontary IE missing ie_5g_s_tmsi"); Logger::nas_mm().error("Mandatory IE missing ie_5g_s_tmsi");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
...@@ -123,7 +123,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -123,7 +123,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
return 0; return 0;
} }
if (!ie_uplink_data_status) { if (!ie_uplink_data_status) {
Logger::nas_mm().warn("IE ie_uplink_data_status is not avaliable"); Logger::nas_mm().warn("IE ie_uplink_data_status is not available");
} else { } else {
size = ie_uplink_data_status->encode2buffer(buf + encoded_size, len - encoded_size); size = ie_uplink_data_status->encode2buffer(buf + encoded_size, len - encoded_size);
if (size != 0) { if (size != 0) {
...@@ -134,7 +134,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -134,7 +134,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_PDU_session_status) { if (!ie_PDU_session_status) {
Logger::nas_mm().warn("IE ie_PDU_session_status is not avaliable"); Logger::nas_mm().warn("IE ie_PDU_session_status is not available");
} else { } else {
size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size); size = ie_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size);
if (size != 0) { if (size != 0) {
...@@ -145,7 +145,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -145,7 +145,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_allowed_PDU_session_status) { if (!ie_allowed_PDU_session_status) {
Logger::nas_mm().warn("IE ie_allowed_PDU_session_status is not avaliable"); Logger::nas_mm().warn("IE ie_allowed_PDU_session_status is not available");
} else { } else {
size = ie_allowed_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size); size = ie_allowed_PDU_session_status->encode2buffer(buf + encoded_size, len - encoded_size);
if (size != 0) { if (size != 0) {
...@@ -156,7 +156,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) { ...@@ -156,7 +156,7 @@ int ServiceRequest::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_nas_message_container) { if (!ie_nas_message_container) {
Logger::nas_mm().warn("IE ie_nas_message_container is not avaliable"); Logger::nas_mm().warn("IE ie_nas_message_container is not available");
} else { } else {
size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size); size = ie_nas_message_container->encode2buffer(buf + encoded_size, len - encoded_size);
if (size != 0) { if (size != 0) {
......
...@@ -34,7 +34,6 @@ using namespace nas; ...@@ -34,7 +34,6 @@ using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
ULNASTransport::ULNASTransport() { ULNASTransport::ULNASTransport() {
Logger::nas_mm().debug("initiating class ULNASTransport");
plain_header = NULL; plain_header = NULL;
ie_payload_container_type = NULL; ie_payload_container_type = NULL;
ie_payload_container = NULL; ie_payload_container = NULL;
...@@ -183,14 +182,14 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -183,14 +182,14 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding ULNASTransport message"); Logger::nas_mm().debug("encoding ULNASTransport message");
int encoded_size = 0; int encoded_size = 0;
if (!plain_header) { if (!plain_header) {
Logger::nas_mm().error("Mandontary IE missing Header"); Logger::nas_mm().error("Mandatory IE missing Header");
return 0; return 0;
} }
if (!(plain_header->encode2buffer(buf, len))) if (!(plain_header->encode2buffer(buf, len)))
return 0; return 0;
encoded_size += 3; encoded_size += 3;
if (!ie_payload_container_type) { if (!ie_payload_container_type) {
Logger::nas_mm().warn("IE ie_payload_container_type is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container_type is not available");
} else { } else {
if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -200,7 +199,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -200,7 +199,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_payload_container) { if (!ie_payload_container) {
Logger::nas_mm().warn("IE ie_payload_container is not avaliable"); Logger::nas_mm().warn("IE ie_payload_container is not available");
} else { } else {
if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_payload_container->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -210,7 +209,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -210,7 +209,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
} }
if (!ie_pdu_session_identity_2) { if (!ie_pdu_session_identity_2) {
Logger::nas_mm().warn("IE ie_pdu_session_identity_2 is not avaliable"); Logger::nas_mm().warn("IE ie_pdu_session_identity_2 is not available");
} else { } else {
if (int size = ie_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -221,7 +220,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -221,7 +220,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_old_pdu_session_identity_2) { if (!ie_old_pdu_session_identity_2) {
Logger::nas_mm().warn("IE ie_old_pdu_session_identity_2 is not avaliable"); Logger::nas_mm().warn("IE ie_old_pdu_session_identity_2 is not available");
} else { } else {
if (int size = ie_old_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_old_pdu_session_identity_2->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -232,7 +231,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -232,7 +231,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_request_type) { if (!ie_request_type) {
Logger::nas_mm().warn("IE ie_request_type is not avaliable"); Logger::nas_mm().warn("IE ie_request_type is not available");
} else { } else {
if (int size = ie_request_type->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_request_type->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -243,7 +242,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -243,7 +242,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_s_nssai) { if (!ie_s_nssai) {
Logger::nas_mm().warn("IE ie_s_nssai is not avaliable"); Logger::nas_mm().warn("IE ie_s_nssai is not available");
} else { } else {
if (int size = ie_s_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_s_nssai->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -254,7 +253,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -254,7 +253,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_dnn) { if (!ie_dnn) {
Logger::nas_mm().warn("IE ie_dnn is not avaliable"); Logger::nas_mm().warn("IE ie_dnn is not available");
} else { } else {
if (int size = ie_dnn->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_dnn->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -265,7 +264,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -265,7 +264,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_additional_information) { if (!ie_additional_information) {
Logger::nas_mm().warn("IE ie_additional_information is not avaliable"); Logger::nas_mm().warn("IE ie_additional_information is not available");
} else { } else {
if (int size = ie_additional_information->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_additional_information->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -276,7 +275,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -276,7 +275,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_ma_pdu_session_information) { if (!ie_ma_pdu_session_information) {
Logger::nas_mm().warn("IE ie_ma_pdu_session_information is not avaliable"); Logger::nas_mm().warn("IE ie_ma_pdu_session_information is not available");
} else { } else {
if (int size = ie_ma_pdu_session_information->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_ma_pdu_session_information->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -287,7 +286,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -287,7 +286,7 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
} }
if (!ie_release_assistance_indication) { if (!ie_release_assistance_indication) {
Logger::nas_mm().warn("IE ie_release_assistance_indication is not avaliable"); Logger::nas_mm().warn("IE ie_release_assistance_indication is not available");
} else { } else {
if (int size = ie_release_assistance_indication->encode2buffer(buf + encoded_size, len - encoded_size)) { if (int size = ie_release_assistance_indication->encode2buffer(buf + encoded_size, len - encoded_size)) {
encoded_size += size; encoded_size += size;
...@@ -303,82 +302,82 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) { ...@@ -303,82 +302,82 @@ int ULNASTransport::encode2buffer(uint8_t *buf, int len) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int ULNASTransport::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) { int ULNASTransport::decodefrombuffer(NasMmPlainHeader *header, uint8_t *buf, int len) {
Logger::nas_mm().debug("decoding ULNASTransport message"); Logger::nas_mm().debug("Decoding ULNASTransport message");
int decoded_size = 3; int decoded_size = 3;
plain_header = header; plain_header = header;
ie_payload_container_type = new Payload_Container_Type(); ie_payload_container_type = new Payload_Container_Type();
decoded_size += ie_payload_container_type->decodefrombuffer(buf + decoded_size, len - decoded_size, false); decoded_size += ie_payload_container_type->decodefrombuffer(buf + decoded_size, len - decoded_size, false);
ie_payload_container = new Payload_Container(); ie_payload_container = new Payload_Container();
decoded_size += ie_payload_container->decodefrombuffer(buf + decoded_size, len - decoded_size, false, ie_payload_container_type->getValue()); decoded_size += ie_payload_container->decodefrombuffer(buf + decoded_size, len - decoded_size, false, ie_payload_container_type->getValue());
Logger::nas_mm().debug("decoded_size(%d)", decoded_size); Logger::nas_mm().debug("Decoded_size (%d)", decoded_size);
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("first option iei(0x%x)", octet); Logger::nas_mm().debug("First option IEI (0x%x)", octet);
while ((octet != 0x0)) { while ((octet != 0x0)) {
switch ((octet & 0xf0) >> 4) { switch ((octet & 0xf0) >> 4) {
case 0x8: { case 0x8: {
Logger::nas_mm().debug("decoding iei(0x8)"); Logger::nas_mm().debug("Decoding IEI (0x8)");
ie_request_type = new Request_Type(); ie_request_type = new Request_Type();
decoded_size += ie_request_type->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_request_type->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0xA: { case 0xA: {
Logger::nas_mm().debug("decoding iei(0xA)"); Logger::nas_mm().debug("Decoding IEI (0xA)");
ie_ma_pdu_session_information = new MA_PDU_Session_Information(); ie_ma_pdu_session_information = new MA_PDU_Session_Information();
decoded_size += ie_ma_pdu_session_information->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_ma_pdu_session_information->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0xF: { case 0xF: {
Logger::nas_mm().debug("decoding iei(0xF)"); Logger::nas_mm().debug("Decoding IEI (0xF)");
ie_release_assistance_indication = new Release_Assistance_Indication(); ie_release_assistance_indication = new Release_Assistance_Indication();
decoded_size += ie_release_assistance_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_release_assistance_indication->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
} }
switch (octet) { switch (octet) {
case 0x12: { case 0x12: {
Logger::nas_mm().debug("decoding iei(0x12)"); Logger::nas_mm().debug("Decoding IEI (0x12)");
ie_pdu_session_identity_2 = new PDU_Session_Identity_2(); ie_pdu_session_identity_2 = new PDU_Session_Identity_2();
decoded_size += ie_pdu_session_identity_2->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_pdu_session_identity_2->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x59: { case 0x59: {
Logger::nas_mm().debug("decoding iei(0x59)"); Logger::nas_mm().debug("Decoding IEI (0x59)");
ie_old_pdu_session_identity_2 = new PDU_Session_Identity_2(); ie_old_pdu_session_identity_2 = new PDU_Session_Identity_2();
decoded_size += ie_old_pdu_session_identity_2->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_old_pdu_session_identity_2->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x22: { case 0x22: {
Logger::nas_mm().debug("decoding iei(0x22)"); Logger::nas_mm().debug("Decoding IEI (0x22)");
ie_s_nssai = new S_NSSAI(); ie_s_nssai = new S_NSSAI();
decoded_size += ie_s_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_s_nssai->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x25: { case 0x25: {
Logger::nas_mm().debug("decoding iei(0x25)"); Logger::nas_mm().debug("Decoding IEI (0x25)");
ie_dnn = new DNN(); ie_dnn = new DNN();
decoded_size += ie_dnn->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_dnn->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
case 0x24: { case 0x24: {
Logger::nas_mm().debug("decoding iei(0x24)"); Logger::nas_mm().debug("Decoding IEI (0x24)");
ie_additional_information = new Additional_Information(); ie_additional_information = new Additional_Information();
decoded_size += ie_additional_information->decodefrombuffer(buf + decoded_size, len - decoded_size, true); decoded_size += ie_additional_information->decodefrombuffer(buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("next iei(0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} }
break; break;
} }
......
...@@ -37,7 +37,6 @@ extern "C" { ...@@ -37,7 +37,6 @@ extern "C" {
} }
#include <iostream> #include <iostream>
using namespace std;
namespace ngap { namespace ngap {
...@@ -70,7 +69,7 @@ void InitialContextSetupResponseMsg::setMessageType() { ...@@ -70,7 +69,7 @@ void InitialContextSetupResponseMsg::setMessageType() {
initialContextSetupResponsePduTypeIE.encode2pdu(initialContextSetupResponsePdu); initialContextSetupResponsePduTypeIE.encode2pdu(initialContextSetupResponsePdu);
initialContextSetupResponseIEs = &(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice.InitialContextSetupResponse); initialContextSetupResponseIEs = &(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice.InitialContextSetupResponse);
} else { } else {
cout << "[warning] This information doesn't refer to InitialContextSetupResponse Message!!!" << endl; std::cout << "[Warning] This information doesn't refer to InitialContextSetupResponse message!" << std::endl;
} }
} }
...@@ -87,13 +86,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) { ...@@ -87,13 +86,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode AMF_UE_NGAP_ID IE error" << endl; std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -109,13 +108,13 @@ void InitialContextSetupResponseMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -109,13 +108,13 @@ void InitialContextSetupResponseMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode RAN_UE_NGAP_ID IE error" << endl; std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -141,13 +140,13 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList(std: ...@@ -141,13 +140,13 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList(std:
int ret = pduSessionResourceSetupResponseList->encode2PDUSessionResourceSetupListCxtRes(&ie->value.choice.PDUSessionResourceSetupListCxtRes); int ret = pduSessionResourceSetupResponseList->encode2PDUSessionResourceSetupListCxtRes(&ie->value.choice.PDUSessionResourceSetupListCxtRes);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceSetupListCxtRes IE error" << endl; std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceSetupListCxtRes IE error" << endl; std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error" << std::endl;
} }
...@@ -174,13 +173,13 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(std: ...@@ -174,13 +173,13 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(std:
int ret = pduSessionResourceFailedToSetupResponseList->encode2PDUSessionResourceFailedToSetupListCxtRes(&ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes); int ret = pduSessionResourceFailedToSetupResponseList->encode2PDUSessionResourceFailedToSetupListCxtRes(&ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListCxtRes IE error" << endl; std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListCxtRes IE error" << endl; std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error" << std::endl;
} }
...@@ -188,7 +187,7 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(std: ...@@ -188,7 +187,7 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(std:
int InitialContextSetupResponseMsg::encode2buffer(uint8_t *buf, int buf_size) { int InitialContextSetupResponseMsg::encode2buffer(uint8_t *buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialContextSetupResponsePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialContextSetupResponsePdu);
asn_enc_rval_t er = aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf, buf_size); asn_enc_rval_t er = aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
return er.encoded; return er.encoded;
} }
...@@ -202,11 +201,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu ...@@ -202,11 +201,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu
&& initialContextSetupResponsePdu->choice.successfulOutcome->value.present == Ngap_SuccessfulOutcome__value_PR_InitialContextSetupResponse) { && initialContextSetupResponsePdu->choice.successfulOutcome->value.present == Ngap_SuccessfulOutcome__value_PR_InitialContextSetupResponse) {
initialContextSetupResponseIEs = &initialContextSetupResponsePdu->choice.successfulOutcome->value.choice.InitialContextSetupResponse; initialContextSetupResponseIEs = &initialContextSetupResponsePdu->choice.successfulOutcome->value.choice.InitialContextSetupResponse;
} else { } else {
cout << "Check InitialContextSetupResponse message error!!!" << endl; std::cout << "Check InitialContextSetupResponse message error!" << std::endl;
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; std::cout << "MessageType error!" << std::endl;
return false; return false;
} }
for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count; i++) { for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count; i++) {
...@@ -215,11 +214,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu ...@@ -215,11 +214,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu
if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_AMF_UE_NGAP_ID) { if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_AMF_UE_NGAP_ID) {
amfUeNgapId = new AMF_UE_NGAP_ID(); amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.AMF_UE_NGAP_ID)) { if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} }
...@@ -228,11 +227,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu ...@@ -228,11 +227,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu
if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_RAN_UE_NGAP_ID) { if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_RAN_UE_NGAP_ID) {
ranUeNgapId = new RAN_UE_NGAP_ID(); ranUeNgapId = new RAN_UE_NGAP_ID();
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.RAN_UE_NGAP_ID)) { if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} }
...@@ -241,11 +240,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu ...@@ -241,11 +240,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu
if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_PDUSessionResourceSetupListCxtRes) { if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_PDUSessionResourceSetupListCxtRes) {
pduSessionResourceSetupResponseList = new PDUSessionResourceSetupListCxtRes(); pduSessionResourceSetupResponseList = new PDUSessionResourceSetupListCxtRes();
if (!pduSessionResourceSetupResponseList->decodefromPDUSessionResourceSetupListCxtRes(&initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.PDUSessionResourceSetupListCxtRes)) { if (!pduSessionResourceSetupResponseList->decodefromPDUSessionResourceSetupListCxtRes(&initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.PDUSessionResourceSetupListCxtRes)) {
cout << "decoded ngap PDUSessionResourceSetupListCxtRes IE error" << endl; std::cout << "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceSetupListCxtRes IE error" << endl; std::cout << "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error" << std::endl;
return false; return false;
} }
} }
...@@ -254,18 +253,18 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu ...@@ -254,18 +253,18 @@ bool InitialContextSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu
if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListCxtRes) { if (initialContextSetupResponseIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.present == Ngap_InitialContextSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListCxtRes) {
pduSessionResourceFailedToSetupResponseList = new PDUSessionResourceFailedToSetupListCxtRes(); pduSessionResourceFailedToSetupResponseList = new PDUSessionResourceFailedToSetupListCxtRes();
if (!pduSessionResourceFailedToSetupResponseList->decodefromPDUSessionResourceFailedToSetupListCxtRes(&initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.PDUSessionResourceFailedToSetupListCxtRes)) { if (!pduSessionResourceFailedToSetupResponseList->decodefromPDUSessionResourceFailedToSetupListCxtRes(&initialContextSetupResponseIEs->protocolIEs.list.array[i]->value.choice.PDUSessionResourceFailedToSetupListCxtRes)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtRes IE error" << endl; std::cout << "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtRes IE error!" << endl; std::cout << "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE error!" << std::endl;
return false; return false;
} }
} }
break; break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; std::cout << "Decoded NGAP message PDU error" << std::endl;
return false; return false;
} }
} }
......
...@@ -37,7 +37,6 @@ extern "C" { ...@@ -37,7 +37,6 @@ extern "C" {
} }
#include <iostream> #include <iostream>
using namespace std;
namespace ngap { namespace ngap {
...@@ -70,7 +69,7 @@ void UplinkNASTransportMsg::setMessageType() { ...@@ -70,7 +69,7 @@ void UplinkNASTransportMsg::setMessageType() {
uplinkNASTransportPduTypeIE.encode2pdu(uplinkNASTransportPdu); uplinkNASTransportPduTypeIE.encode2pdu(uplinkNASTransportPdu);
uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage->value.choice.UplinkNASTransport); uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage->value.choice.UplinkNASTransport);
} else { } else {
cout << "[warning] This information doesn't refer to UplinkNASTransport Message!!!" << endl; std::cout << "[Warning] This information doesn't refer to UplinkNASTransport Message!" << std::endl;
} }
} }
...@@ -87,13 +86,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) { ...@@ -87,13 +86,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode AMF_UE_NGAP_ID IE error" << endl; std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -109,13 +108,13 @@ void UplinkNASTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -109,13 +108,13 @@ void UplinkNASTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode RAN_UE_NGAP_ID IE error" << endl; std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -132,13 +131,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t *nas, size_t sizeofnas) { ...@@ -132,13 +131,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t *nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU); int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) { if (!ret) {
cout << "encode NAS_PDU IE error" << endl; std::cout << "Encode NAS_PDU IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode NAS_PDU IE error" << endl; std::cout << "Encode NAS_PDU IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -171,20 +170,20 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(struct NrCgi_s cig, struct Tai ...@@ -171,20 +170,20 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(struct NrCgi_s cig, struct Tai
int ret = userLocationInformation->encodefromUserLocationInformation(&ie->value.choice.UserLocationInformation); int ret = userLocationInformation->encodefromUserLocationInformation(&ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
cout << "encode UserLocationInformation IE error" << endl; std::cout << "Encode UserLocationInformation IE error" << std::endl;
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode UserLocationInformation IE error" << endl; std::cout << "Encode UserLocationInformation IE error" << std::endl;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int UplinkNASTransportMsg::encode2buffer(uint8_t *buf, int buf_size) { int UplinkNASTransportMsg::encode2buffer(uint8_t *buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, uplinkNASTransportPdu, buf, buf_size); asn_enc_rval_t er = aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, uplinkNASTransportPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
return er.encoded; return er.encoded;
} }
...@@ -198,11 +197,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) { ...@@ -198,11 +197,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) {
&& uplinkNASTransportPdu->choice.initiatingMessage->value.present == Ngap_InitiatingMessage__value_PR_UplinkNASTransport) { && uplinkNASTransportPdu->choice.initiatingMessage->value.present == Ngap_InitiatingMessage__value_PR_UplinkNASTransport) {
uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage->value.choice.UplinkNASTransport; uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage->value.choice.UplinkNASTransport;
} else { } else {
cout << "Check UplinkNASTransport message error!!!" << endl; std::cout << "Check UplinkNASTransport message error!!!" << std::endl;
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; std::cout << "MessageType error!!!" << std::endl;
return false; return false;
} }
for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) { for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) {
...@@ -211,11 +210,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) { ...@@ -211,11 +210,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) {
if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_AMF_UE_NGAP_ID) { if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_AMF_UE_NGAP_ID) {
amfUeNgapId = new AMF_UE_NGAP_ID(); amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.AMF_UE_NGAP_ID)) { if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} }
...@@ -224,11 +223,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) { ...@@ -224,11 +223,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) {
if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_RAN_UE_NGAP_ID) { if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_RAN_UE_NGAP_ID) {
ranUeNgapId = new RAN_UE_NGAP_ID(); ranUeNgapId = new RAN_UE_NGAP_ID();
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.RAN_UE_NGAP_ID)) { if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl;
return false; return false;
} }
} }
...@@ -237,11 +236,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) { ...@@ -237,11 +236,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) {
if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_NAS_PDU) { if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_reject && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_NAS_PDU) {
nasPdu = new NAS_PDU(); nasPdu = new NAS_PDU();
if (!nasPdu->decodefromoctetstring(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.NAS_PDU)) { if (!nasPdu->decodefromoctetstring(uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.NAS_PDU)) {
cout << "decoded ngap NAS_PDU IE error" << endl; std::cout << "decoded ngap NAS_PDU IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap NAS_PDU IE error" << endl; std::cout << "decoded ngap NAS_PDU IE error" << std::endl;
return false; return false;
} }
} }
...@@ -250,18 +249,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) { ...@@ -250,18 +249,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) {
if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation) { if (uplinkNASTransportIEs->protocolIEs.list.array[i]->criticality == Ngap_Criticality_ignore && uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation) {
userLocationInformation = new UserLocationInformation(); userLocationInformation = new UserLocationInformation();
if (!userLocationInformation->decodefromUserLocationInformation(&uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.UserLocationInformation)) { if (!userLocationInformation->decodefromUserLocationInformation(&uplinkNASTransportIEs->protocolIEs.list.array[i]->value.choice.UserLocationInformation)) {
cout << "decoded ngap UserLocationInformation IE error" << endl; std::cout << "decoded ngap UserLocationInformation IE error" << std::endl;
return false; return false;
} }
} else { } else {
cout << "decoded ngap UserLocationInformation IE error" << endl; std::cout << "decoded ngap UserLocationInformation IE error" << std::endl;
return false; return false;
} }
} }
break; break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; std::cout << "decoded ngap message pdu error" << std::endl;
return false; return false;
} }
} }
......
...@@ -90,11 +90,11 @@ int ngap_amf_handle_initial_ue_message(const sctp_assoc_id_t assoc_id, const sct ...@@ -90,11 +90,11 @@ int ngap_amf_handle_initial_ue_message(const sctp_assoc_id_t assoc_id, const sct
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) { int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) {
Logger::ngap().debug("Sending itti up link nas transport message to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Uplink NAS Transport message to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
UplinkNASTransportMsg *uplinkNasT = new UplinkNASTransportMsg(); UplinkNASTransportMsg *uplinkNasT = new UplinkNASTransportMsg();
if (!uplinkNasT->decodefrompdu(message_p)) { if (!uplinkNasT->decodefrompdu(message_p)) {
Logger::ngap().error("decoding UplinkNasTransport message error"); Logger::ngap().error("Decoding UplinkNasTransport message error");
return -1; return -1;
} }
itti_ul_nas_transport *itti_ul_nas = new itti_ul_nas_transport(TASK_NGAP, TASK_AMF_N2); itti_ul_nas_transport *itti_ul_nas = new itti_ul_nas_transport(TASK_NGAP, TASK_AMF_N2);
...@@ -110,7 +110,8 @@ int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const s ...@@ -110,7 +110,8 @@ int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const s
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int ngap_amf_handle_initial_context_setup_response(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) { int ngap_amf_handle_initial_context_setup_response(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) {
Logger::ngap().debug("Sending itti initial context setup response to TASK_AMF_N11"); Logger::ngap().debug("Handling Initial Context Setup Response...");
Logger::ngap().debug("Sending ITTI Initial Context Setup Response to TASK_AMF_N11");
InitialContextSetupResponseMsg *initCtxResp = new InitialContextSetupResponseMsg(); InitialContextSetupResponseMsg *initCtxResp = new InitialContextSetupResponseMsg();
if (!initCtxResp->decodefrompdu(message_p)) { if (!initCtxResp->decodefrompdu(message_p)) {
Logger::ngap().error("Decoding InitialContextSetupResponse message error"); Logger::ngap().error("Decoding InitialContextSetupResponse message error");
......
...@@ -185,7 +185,7 @@ int sctp_server::sctp_read_from_socket(int sd, uint32_t ppid) { ...@@ -185,7 +185,7 @@ int sctp_server::sctp_read_from_socket(int sd, uint32_t ppid) {
Logger::sctp().error("Received data from peer with unsolicited PPID (%d), expecting (%d)", ntohl(sinfo.sinfo_ppid), association->ppid); Logger::sctp().error("Received data from peer with unsolicited PPID (%d), expecting (%d)", ntohl(sinfo.sinfo_ppid), association->ppid);
return SCTP_RC_ERROR; return SCTP_RC_ERROR;
} }
Logger::sctp().info("[Assoc_id %d, Socket %d] Received a msg (length %d) from port %d, on stream %d, PPID %d", sinfo.sinfo_assoc_id, sd, n, ntohs(addr.sin6_port), sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); Logger::sctp().info("****[Assoc_id %d, Socket %d] Received a msg (length %d) from port %d, on stream %d, PPID %d ****", sinfo.sinfo_assoc_id, sd, n, ntohs(addr.sin6_port), sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid));
bstring payload = blk2bstr(buffer, n); bstring payload = blk2bstr(buffer, n);
//handle payload //handle payload
app_->handle_receive(payload, (sctp_assoc_id_t) sinfo.sinfo_assoc_id, sinfo.sinfo_stream, association->instreams, association->outstreams); app_->handle_receive(payload, (sctp_assoc_id_t) sinfo.sinfo_assoc_id, sinfo.sinfo_stream, association->instreams, association->outstreams);
......
...@@ -377,7 +377,6 @@ void Authentication_5gaka::derive_knas(algorithm_type_dist_t nas_alg_type, uint8 ...@@ -377,7 +377,6 @@ void Authentication_5gaka::derive_knas(algorithm_type_dist_t nas_alg_type, uint8
//memcpy (knas, &out[31 - 16 + 1], 16); //memcpy (knas, &out[31 - 16 + 1], 16);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
knas[i] = out[16 + i]; knas[i] = out[16 + i];
Logger::amf_n1().debug("derive_knas finished!");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
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