diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index eea548774a..5c682a1a52 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1173,6 +1173,7 @@ set(libnas_ies_OBJS
${NAS_SRC}COMMON/IES/MobileStationClassmark2.c
${NAS_SRC}COMMON/IES/MobileStationClassmark3.c
${NAS_SRC}COMMON/IES/MsNetworkCapability.c
+ ${NAS_SRC}COMMON/IES/MsNetworkFeatureSupport.c
${NAS_SRC}COMMON/IES/NasKeySetIdentifier.c
${NAS_SRC}COMMON/IES/NasMessageContainer.c
${NAS_SRC}COMMON/IES/NasRequestType.c
diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c
index 15a29b1f29..f301b44a86 100644
--- a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c
+++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c
@@ -217,8 +217,9 @@ int decode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, u
case ATTACH_REQUEST_SUPPORTED_CODECS_IEI:
if ((decoded_result =
decode_supported_codec_list(&attach_request->supportedcodecs,
- ATTACH_REQUEST_SUPPORTED_CODECS_IEI, buffer + decoded, len
- - decoded)) <= 0) {
+ ATTACH_REQUEST_SUPPORTED_CODECS_IEI,
+ buffer + decoded,
+ len - decoded)) <= 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
}
@@ -270,12 +271,26 @@ int decode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, u
attach_request->presencemask |= ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT;
break;
-
+ case ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI:
+ if ((decoded_result =
+ decode_ms_network_feature_support(&attach_request->msnetworkfeaturesupport,
+ ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI,
+ buffer + decoded, len - decoded)) <= 0) {
+ // return decoded_result;
+ LOG_FUNC_RETURN(decoded_result);
+ }
+
+ decoded += decoded_result;
+ /* Set corresponding mask to 1 in presencemask */
+ attach_request->presencemask |= ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT;
+ break;
default:
+
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
{
// return TLV_DECODE_UNEXPECTED_IEI;
- LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI);
+ LOG_TRACE(INFO,"EMM: Can't decode the message with iei %d\n",ieiDecoded);
+ LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI);
}
}
}
@@ -469,6 +484,19 @@ int encode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, u
encoded += encode_result;
}
+ if ((attach_request->presencemask & ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT)
+ == ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT) {
+ if ((encode_result =
+ encode_ms_network_feature_support(&attach_request->msnetworkfeaturesupport,
+ ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI,
+ buffer + encoded,
+ len - encoded)) < 0)
+ // Return in case of error
+ return encode_result;
+ else
+ encoded += encode_result;
+ }
+
return encoded;
}
diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h
index 5368df7fc7..f19c53f1ad 100644
--- a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h
+++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h
@@ -42,6 +42,7 @@
#include "TrackingAreaIdentity.h"
#include "DrxParameter.h"
#include "MsNetworkCapability.h"
+#include "MsNetworkFeatureSupport.h"
#include "LocationAreaIdentification.h"
#include "TmsiStatus.h"
#include "MobileStationClassmark2.h"
@@ -74,6 +75,7 @@
TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \
DRX_PARAMETER_MAXIMUM_LENGTH + \
MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
+ MS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH + \
LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \
TMSI_STATUS_MAXIMUM_LENGTH + \
MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH + \
@@ -98,12 +100,14 @@
# define ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT (1<<10)
# define ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT (1<<11)
# define ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT (1<<12)
+# define ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT (1<<13)
typedef enum attach_request_iei_tag {
ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI = 0x19, /* 0x19 = 25 */
ATTACH_REQUEST_ADDITIONAL_GUTI_IEI = 0x50, /* 0x50 = 80 */
ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */
ATTACH_REQUEST_DRX_PARAMETER_IEI = 0x5C, /* 0x5C = 92 */
+ ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI = 0xC0, /* 0xC- = 192- */
ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI = 0x31, /* 0x31 = 49 */
ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */
ATTACH_REQUEST_TMSI_STATUS_IEI = 0x90, /* 0x90 = 144 */
@@ -147,6 +151,7 @@ typedef struct attach_request_msg_tag {
AdditionalUpdateType additionalupdatetype;
GutiType oldgutitype;
VoiceDomainPreferenceAndUeUsageSetting voicedomainpreferenceandueusagesetting;
+ MsNetworkFeatureSupport msnetworkfeaturesupport;
} attach_request_msg;
int decode_attach_request(attach_request_msg *attachrequest, uint8_t *buffer, uint32_t len);
diff --git a/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.c b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.c
new file mode 100644
index 0000000000..e05968c2d5
--- /dev/null
+++ b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.c
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+#include
+#include
+#include
+
+
+#include "TLVEncoder.h"
+#include "TLVDecoder.h"
+#include "MsNetworkFeatureSupport.h"
+
+int decode_ms_network_feature_support(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len)
+{
+ int decoded = 0;
+
+
+ if (iei > 0) {
+ CHECK_IEI_DECODER(iei, (*buffer & 0xc0));
+ }
+ msnetworkfeaturesupport->spare_bits= (*(buffer + decoded) >> 3) & 0x7;
+ msnetworkfeaturesupport->extended_periodic_timers= *(buffer + decoded) & 0x1;
+ decoded++;
+
+#if defined (NAS_DEBUG)
+ dump_ms_network_feature_support_xml(msnetworkfeaturesupport, iei);
+#endif
+ return decoded;
+}
+int encode_ms_network_feature_support(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len)
+{
+ uint8_t *lenPtr;
+ uint32_t encoded = 0;
+ int encode_result;
+ /* Checking IEI and pointer */
+ CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MS_NETWORK_FEATURE_SUPPORT_MINIMUM_LENGTH, len);
+#if defined (NAS_DEBUG)
+ dump_ms_network_feature_support_xml(msnetworkfeaturesupport, iei);
+#endif
+
+
+ *(buffer + encoded) = 0x00 | ((msnetworkfeaturesupport->spare_bits & 0x7) << 3)
+ | (msnetworkfeaturesupport->extended_periodic_timers & 0x1);
+ encoded++;
+ return encoded;
+}
+
+void dump_ms_network_feature_support_xml(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei)
+{
+ printf("\n");
+
+ if (iei > 0)
+ /* Don't display IEI if = 0 */
+ printf(" 0x%X\n", iei);
+
+ printf(" %u\n",msnetworkfeaturesupport->spare_bits);
+ printf(" %u\n",msnetworkfeaturesupport->extended_periodic_timers);
+ printf("\n");
+}
+
diff --git a/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h
new file mode 100644
index 0000000000..334430de1a
--- /dev/null
+++ b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ OpenAirInterface
+ Copyright(c) 1999 - 2014 Eurecom
+
+ OpenAirInterface is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+
+ OpenAirInterface is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenAirInterface.The full GNU General Public License is
+ included in this distribution in the file called "COPYING". If not,
+ see .
+
+ Contact Information
+ OpenAirInterface Admin: openair_admin@eurecom.fr
+ OpenAirInterface Tech : openair_tech@eurecom.fr
+ OpenAirInterface Dev : openair4g-devel@eurecom.fr
+
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
+
+ *******************************************************************************/
+#include
+#include
+#include
+
+#include "OctetString.h"
+
+#ifndef MS_NETWORK_FEATURE_SUPPORT_H_
+#define MS_NETWORK_FEATURE_SUPPORT_H_
+
+#define MS_NETWORK_FEATURE_SUPPORT_MINIMUM_LENGTH 3
+#define MS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH 10
+
+typedef struct MsNetworkFeatureSupport_tag {
+ uint8_t spare_bits:3;
+ uint8_t extended_periodic_timers:1;
+} MsNetworkFeatureSupport;
+
+int encode_ms_network_feature_support(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len);
+
+int decode_ms_network_feature_support(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len);
+
+void dump_ms_network_feature_support_xml(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei);
+
+#endif /* MS NETWORK CAPABILITY_H_ */
+
diff --git a/openair-cn/NAS/COMMON/UTIL/TLVDecoder.h b/openair-cn/NAS/COMMON/UTIL/TLVDecoder.h
index 6e1764edad..152fd9c737 100644
--- a/openair-cn/NAS/COMMON/UTIL/TLVDecoder.h
+++ b/openair-cn/NAS/COMMON/UTIL/TLVDecoder.h
@@ -132,7 +132,7 @@ void tlv_decode_perror(void);
if(iEI != bUFFER) \
{ \
printf("IEI is different than the one expected." \
- "(Got: 0x%x, expecting: 0x%x\n", bUFFER, iEI); \
+ "(Got: 0x%x, expecting: 0x%x)\n", bUFFER, iEI); \
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; \
LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI); \
}